X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fsaleae-logic-pro%2Fapi.c;h=0a2a2728633e3cf42c9e463153c65d060aa5eb6c;hb=34ce5b0439f0c162da795ba761b48c61517d8e93;hp=bd96e3de051b54f0dba011edb97cd70fffa65b59;hpb=463160cbca37367ef94dfead0c64531d82b83ab8;p=libsigrok.git diff --git a/src/hardware/saleae-logic-pro/api.c b/src/hardware/saleae-logic-pro/api.c index bd96e3de..0a2a2728 100644 --- a/src/hardware/saleae-logic-pro/api.c +++ b/src/hardware/saleae-logic-pro/api.c @@ -26,8 +26,6 @@ #define BUF_SIZE (16 * 1024) #define BUF_TIMEOUT 1000 -SR_PRIV struct sr_dev_driver saleae_logic_pro_driver_info; - static const uint32_t scanopts[] = { SR_CONF_CONN, }; @@ -200,10 +198,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) continue; if (!scan_firmware(devlist[i])) { + const char *fwname; sr_info("Found a Logic Pro 16 device (no firmware loaded)."); + fwname = "saleae-logicpro16-fx3.fw"; if (upload_firmware(drvc->sr_ctx, devlist[i], - "saleae-logicpro16-fx3.fw") != SR_OK) { - sr_err("Firmware upload failed."); + fwname) != SR_OK) { + sr_err("Firmware upload failed, name %s.", fwname); continue; }; fw_loaded = TRUE; @@ -240,7 +240,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) if (des.idVendor != 0x21a9 || des.idProduct != 0x1006) continue; - usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)); + if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0) + continue; sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INITIALIZING; @@ -300,7 +301,7 @@ static int dev_close(struct sr_dev_inst *sdi) } static int config_get(uint32_t key, GVariant **data, - const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct sr_usb_dev_inst *usb; struct dev_context *devc; @@ -328,7 +329,7 @@ static int config_get(uint32_t key, GVariant **data, } static int config_set(uint32_t key, GVariant *data, - const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -348,14 +349,14 @@ static int config_set(uint32_t key, GVariant *data, } static int config_list(uint32_t key, GVariant **data, - const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { switch (key) { case SR_CONF_SCAN_OPTIONS: case SR_CONF_DEVICE_OPTIONS: return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts); case SR_CONF_SAMPLERATE: - *data = std_gvar_samplerates(samplerates, ARRAY_SIZE(samplerates)); + *data = std_gvar_samplerates(ARRAY_AND_SIZE(samplerates)); break; default: return SR_ERR_NA; @@ -456,7 +457,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) return SR_OK; } -SR_PRIV struct sr_dev_driver saleae_logic_pro_driver_info = { +static struct sr_dev_driver saleae_logic_pro_driver_info = { .name = "saleae-logic-pro", .longname = "Saleae Logic Pro", .api_version = 1, @@ -474,5 +475,4 @@ SR_PRIV struct sr_dev_driver saleae_logic_pro_driver_info = { .dev_acquisition_stop = dev_acquisition_stop, .context = NULL, }; - SR_REGISTER_DEV_DRIVER(saleae_logic_pro_driver_info);