X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fhantek-dso%2Fapi.c;h=19ddd86e40a4d0f9df746892d9c2324aef31fb1a;hb=9116262931773877e4dd279336ebb2be8f182c05;hp=8d9a8b08cefbd0aa5860e791689a88b023fc7f22;hpb=d4abb463a749cd3d614e98c7fe7f5d28ad69475d;p=libsigrok.git diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index 8d9a8b08..19ddd86e 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -53,8 +53,7 @@ static const int hwcaps[] = { }; static const char *probe_names[] = { - "CH1", - "CH2", + "CH1", "CH2", NULL, }; @@ -143,7 +142,7 @@ static const char *coupling[] = { }; SR_PRIV struct sr_dev_driver hantek_dso_driver_info; -static struct sr_dev_driver *hdi = &hantek_dso_driver_info; +static struct sr_dev_driver *di = &hantek_dso_driver_info; static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data); @@ -159,7 +158,7 @@ static struct sr_dev_inst *dso_dev_new(int index, const struct dso_profile *prof prof->vendor, prof->model, NULL); if (!sdi) return NULL; - sdi->driver = hdi; + sdi->driver = di; /* * Add only the real probes -- EXT isn't a source of data, only @@ -194,7 +193,7 @@ static struct sr_dev_inst *dso_dev_new(int index, const struct dso_profile *prof devc->triggersource = g_strdup(DEFAULT_TRIGGER_SOURCE); devc->triggerposition = DEFAULT_HORIZ_TRIGGERPOS; sdi->priv = devc; - drvc = hdi->priv; + drvc = di->priv; drvc->instances = g_slist_append(drvc->instances, sdi); return sdi; @@ -228,7 +227,7 @@ static int clear_instances(void) struct dev_context *devc; GSList *l; - drvc = hdi->priv; + drvc = di->priv; for (l = drvc->instances; l; l = l->next) { if (!(sdi = l->data)) { /* Log error, but continue cleaning up the rest. */ @@ -263,7 +262,7 @@ static int hw_init(struct sr_context *sr_ctx) } drvc->sr_ctx = sr_ctx; - hdi->priv = drvc; + di->priv = drvc; return SR_OK; } @@ -283,7 +282,7 @@ static GSList *hw_scan(GSList *options) devcnt = 0; devices = 0; - drvc = hdi->priv; + drvc = di->priv; drvc->instances = NULL; clear_instances(); @@ -292,7 +291,8 @@ static GSList *hw_scan(GSList *options) libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist); for (i = 0; devlist[i]; i++) { if ((ret = libusb_get_device_descriptor(devlist[i], &des))) { - sr_err("Failed to get device descriptor: %d.", ret); + sr_err("Failed to get device descriptor: %s.", + libusb_error_name(ret)); continue; } @@ -347,7 +347,7 @@ static GSList *hw_dev_list(void) { struct drv_context *drvc; - drvc = hdi->priv; + drvc = di->priv; return drvc->instances; } @@ -390,7 +390,8 @@ static int hw_dev_open(struct sr_dev_inst *sdi) err = libusb_claim_interface(devc->usb->devhdl, USB_INTERFACE); if (err != 0) { - sr_err("Unable to claim interface: %d.", err); + sr_err("Unable to claim interface: %s.", + libusb_error_name(err)); return SR_ERR; } @@ -408,7 +409,7 @@ static int hw_cleanup(void) { struct drv_context *drvc; - if (!(drvc = hdi->priv)) + if (!(drvc = di->priv)) return SR_OK; clear_instances(); @@ -732,7 +733,7 @@ static int handle_event(int fd, int revents, void *cb_data) struct sr_datafeed_packet packet; struct timeval tv; struct dev_context *devc; - struct drv_context *drvc = hdi->priv; + struct drv_context *drvc = di->priv; const struct libusb_pollfd **lupfd; int num_probes, i; uint32_t trigger_offset; @@ -849,7 +850,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, struct sr_datafeed_header header; struct sr_datafeed_meta_analog meta; struct dev_context *devc; - struct drv_context *drvc = hdi->priv; + struct drv_context *drvc = di->priv; int i; if (sdi->status != SR_ST_ACTIVE)