X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Ffx2lafw%2Ffx2lafw.c;h=4344cf24199e4913b3313d09fafb89abe58f26e1;hb=dd34b8d3c4da18f8cf339c5bb8f0d6268f3d13f6;hp=951c9196ffeebd147e8e38075676c52f5caba8ce;hpb=0e8d0e24d00dcf6dd661e4fb15cedf79ce45c248;p=libsigrok.git diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index 951c9196..4344cf24 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -382,26 +382,28 @@ static struct context *fx2lafw_dev_new(void) * API callbacks */ -static int hw_init(const char *devinfo) +static int hw_init(void) +{ + + if (libusb_init(&usb_context) != 0) { + sr_warn("fx2lafw: Failed to initialize libusb."); + return SR_ERR; + } + + return SR_OK; +} + +static int hw_scan(void) { struct sr_dev_inst *sdi; struct libusb_device_descriptor des; const struct fx2lafw_profile *prof; struct context *ctx; libusb_device **devlist; - int ret; - int devcnt = 0; - int i, j; - - /* Avoid compiler warnings. */ - (void)devinfo; - - if (libusb_init(&usb_context) != 0) { - sr_warn("fx2lafw: Failed to initialize libusb."); - return 0; - } + int devcnt, ret, i, j; /* Find all fx2lafw compatible devices and upload firmware to them. */ + devcnt = 0; libusb_get_device_list(usb_context, &devlist); for (i = 0; devlist[i]; i++) { @@ -1012,6 +1014,7 @@ SR_PRIV struct sr_dev_driver fx2lafw_driver_info = { .api_version = 1, .init = hw_init, .cleanup = hw_cleanup, + .scan = hw_scan, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .dev_info_get = hw_dev_info_get,