sysclk-lwla: Set USB device configuration

After opening the USB device, set the device configuration to 1.
Actually, do it twice, just as the vendor driver seems to do. This
is supposed to trigger a lightweight reset of the device.

Originally, I omitted this reset sequence from the sigrok driver
because it simply did not work at all for me. However, it does seem
to work now, so that may have been a problem in libusb or the kernel
which is now fixed.

With some luck, this change may finally fix #327.
This commit is contained in:
Daniel Elstner 2015-09-16 22:35:13 +02:00
parent c81069b337
commit ad6181e25e
2 changed files with 13 additions and 0 deletions

View File

@ -203,6 +203,18 @@ static int dev_open(struct sr_dev_inst *sdi)
if (ret != SR_OK)
return ret;
/* Set the configuration twice to trigger a lightweight reset.
*/
ret = libusb_set_configuration(usb->devhdl, USB_CONFIG);
if (ret == 0)
ret = libusb_set_configuration(usb->devhdl, USB_CONFIG);
if (ret != 0) {
sr_err("Failed to set USB configuration: %s.",
libusb_error_name(ret));
sr_usb_close(usb);
return SR_ERR;
}
ret = libusb_claim_interface(usb->devhdl, USB_INTERFACE);
if (ret < 0) {
sr_err("Failed to claim interface: %s.",

View File

@ -34,6 +34,7 @@
#define MODEL_NAME "LWLA1034"
#define USB_VID_PID "2961.6689"
#define USB_CONFIG 1
#define USB_INTERFACE 0
#define USB_TIMEOUT_MS 3000