Discussion:
[libusb] Unable to clear LIBUSB_ERROR_PIPE on first run after installing the device driver
Christopher Flordeliza
2017-07-12 03:51:59 UTC
Permalink
Hi All,

OS: Windows 10
Problem: Pipe error on first run after the driver installation
Driver: libusb0.sys
Driver Installer: libwdi by Pete Batard

We are receiving LIBUSB_ERROR_PIPE from libusb_bulk_transfer during transfer of data from host to device. Even after clearing the halt (libusb_clear_halt), the same error is returned by libusb_bulk_transfer. We are not able to recover from the stalled condition. We checked the endpoint status (via libusb_control_transfer) after receiving this error and the status is 0 (not halted). This only happens on first run after we installed the device driver while our target device is connected to the USB. Once we unplug and plug our device, this problem does not happen.

Any idea what is happening? How to recover from stalled condition?

Thank you very much in advanced.

Regards,

Christopher
Peter Stuge
2017-07-12 21:13:30 UTC
Permalink
Post by Christopher Flordeliza
Any idea what is happening?
Sounds like this is a bug in the libusb Windows code.
Post by Christopher Flordeliza
How to recover from stalled condition?
You could try closing the device handle, destroying the context,
creating a new context and reopening the device. That's as
comprehensive a "library reset" as you can do. If that also doesn't
work then I'm afraid I don't think there's any workaround you can do
in the application. :\


//Peter
Pete Batard
2017-07-13 11:17:31 UTC
Permalink
Oh, how I wish I could stop peeking at this mailing list every now and
again, and relish in the idea that I don't have to tackle Peter's
continuing attempts to test the waters and see how much he can get away
with, before his attempts to seize control of a narrative devolve into
an actual nuisance for this project...
Post by Peter Stuge
Sounds like this is a bug in the libusb Windows code.
Biased much?

You've been a member of this list way too long to know that, without
further information from OP, there exist at least 4 layers where the
issue might reside:

- OP's firmware, which we have no knowledge of, and which may be custom
- OP's code, which we have not seen, and which may be doing something
that might trigger this behaviour (even if unlikely)
- The libusb0 driver layer, since OP *very explictly* pointed out that
he was using libusb0, and that is something I would expect any long
standing mailing-list member to latch on
- The library code that interfaces with the libusb0 driver

If, without any additional information, your conclusion is to point the
finger at a single layer I really have to wonder what the heck you are
still trying to accomplish on this project because, *CLEARLY*, your goal
is not to help its users.

Instead, here is the minimum level of advice I would expect to come, as
an initial reply, from someone who is supposed to have long standing
knowledge of libusb and who actually wants to help:

1. Ask OP whether he is using a custom firmware
2. Ask OP what version of the library he is using
3. Ask OP whether he can provide us a debug libusb log from his app
4. Ask OP whether he may be able to replicate this behaviour with xusb
or any means that can try to eliminate OP's code as the culprit
5. Ask OP whether he may be able to replicate this behaviour with a
different device (eliminate OP's firmware)
6. And, most importantly, ask OP whether he has tried with WinUSB
instead of libusb0. Again, you're supposed to have been on this list
long enough to know that the first thing we ask, when someone mentions
that they are using libusb0.sys (given that there are known
instabilities when using this driver with libusb) is to try a different
driver.

Oh, and you could also have tried to be helpful by asking the finer
details, which I would also expect you to know, such as whether
libusb0.sys was installed as a filter driver (another source of issues),
in which case you may advise OP to try with the usbdk layer of libusb if
they prefer, instead of WinUSB, try to accomplish the same with a
different OS, and so on.

But of course, by performing the above, one runs the risk of finding out
that this may have little to do with a "a bug in the libusb Windows
code", and it's of course hard to see why anyone would pass a good
opportunity of throwing FUD around (which, personally, when enacted by
the same person on a reoccurring basis, is something that I would tend
to qualify as "trolling behaviour"... but what do I know)?

I'll just conclude with some more free advice, which I think may be
needed: Pointing out someone's repeated shortcomings, when they are
clearly preventing users of a project from receiving the appropriate
level of help, is neither ad hominem nor trolling.

Regards,

/Pete
Christopher Flordeliza
2017-07-17 00:47:19 UTC
Permalink
Dear All,

I apologise if my earlier message created confusions. Please see below the sample code I am using to reproduced the problem I described on my earlier email:

#include <stdio.h>
#include <time.h>
#include "libusb.h"

#define TEST_USB_CONFIG_VALUE 3
#define TEST_USB_SERIAL_LENGTH 14
#define TEST_USB_INTERFACE 0
#define TEST_USB_ENDPOINT_IN 0x81
#define TEST_USB_ENDPOINT_OUT 0x02
#define TEST_USB_ENDPOINT_SIZE 64
#define TEST_USB_TIMEOUT_MS 1000
#define TEST_USB_MAX_TRY 5
#define TEST_USB_SUCCESS (0)
#define TEST_USB_FAILED (-1)

unsigned char test_usb_in_buffer[TEST_USB_ENDPOINT_SIZE];
unsigned char test_usb_temp_buffer[TEST_USB_ENDPOINT_SIZE];
unsigned char discovery[] =
{
0x05, 0x00, 0x15, 0x00, 0x4E, 0xF0, 0xAD, 0xE0,
0x01, 0x00, 0x09, 0x04, 0x00, 0x06, 0x01, 0xC6,
0x00, 0x00, 0x00, 0x0F, 0x4E, 0x7F, 0x63, 0xB2
};

const char* getDateTime(void)
{
time_t timer;
struct tm tm_info;

time(&timer);
localtime_s(&tm_info, &timer);

memset(test_usb_temp_buffer, 0, TEST_USB_ENDPOINT_SIZE);
strftime((char *)test_usb_temp_buffer, TEST_USB_ENDPOINT_SIZE, "%Y.%m.%d %H:%M:%S >>", &tm_info);

return test_usb_temp_buffer;

}

const libusb_device_handle* UsbOpen(libusb_context** context, char* serialNumber)
{
struct libusb_device_descriptor deviceDescriptor;
libusb_device_handle* handle = NULL;
libusb_device *currentDevice = NULL;
/* list devices */
libusb_device **devices = 0;
int result, transfered;
uint8_t portNo, busNo;

unsigned char sn_ascii[TEST_USB_SERIAL_LENGTH] = { 0 };

result = libusb_init(context);
if (result != LIBUSB_SUCCESS)
{
printf("%s [ERROR] Failed to init libusb! Error: %s\n", getDateTime(), libusb_error_name(result));
return handle;
}
ssize_t deviceCount = libusb_get_device_list(*context, &devices);
for (int index = 0; index < deviceCount; index++)
{
currentDevice = devices[index];
result = libusb_get_device_descriptor(currentDevice, &deviceDescriptor);
if (result != LIBUSB_SUCCESS)
{
printf("%s [ERROR] Failed to get the device descriptor! Error: %s\n", getDateTime(), libusb_error_name(result));
continue;
}
/* check if this is the target device */
if ((deviceDescriptor.idVendor != 0x0525)
|| (deviceDescriptor.idProduct != 0xA4A4))
{
continue;
}
if (libusb_open(currentDevice, &handle) != LIBUSB_SUCCESS)
{
printf("%s [ERROR] Failed to open the handle for the device! Error: %s\n", getDateTime(), libusb_error_name(result));
continue;
}
/* get device port and bus number */
busNo = libusb_get_bus_number(currentDevice);
portNo = libusb_get_port_number(currentDevice);

/* check if the device is what we are looking */
memset(sn_ascii, 0, TEST_USB_SERIAL_LENGTH);
result = libusb_get_string_descriptor_ascii(handle, deviceDescriptor.iSerialNumber, sn_ascii, TEST_USB_SERIAL_LENGTH);
if (result <= LIBUSB_SUCCESS)
{
libusb_close(handle);
handle = NULL;
currentDevice = NULL;
printf("%s [ERROR] Failed to get serial number: Error %s\n", getDateTime(), libusb_error_name(result));
continue;
}
/* if serial number is not specified, just get the first device matching the vendor and product ids*/
if (serialNumber == NULL)
{
break;
}
if (memcmp(serialNumber, sn_ascii, TEST_USB_SERIAL_LENGTH) == 0)
{
break;
}
if (handle)
{
libusb_close(handle);
}
handle = NULL;
currentDevice = NULL;
}
libusb_free_device_list(devices, 1);
if (handle == NULL)
{
libusb_exit(*context);
*context = NULL;
printf("%s [ERROR] Failed to find the device (Serial: %s)\n", getDateTime(), serialNumber ? serialNumber : "---");
return handle;
}

/* set configuration */
if ((result = libusb_set_configuration(handle, TEST_USB_CONFIG_VALUE)) != LIBUSB_SUCCESS)
{
printf("%s [ERROR] Failed to set the configuration (Serial#%s): Error %s\n", getDateTime(), sn_ascii, libusb_error_name(result));
libusb_close(handle);
libusb_exit(*context);
*context = NULL;
handle = NULL;
currentDevice = NULL;
return handle;
}
result = libusb_claim_interface(handle, TEST_USB_INTERFACE);
if (result != LIBUSB_SUCCESS)
{
printf("%s [ERROR] Failed to claim the interface (#%d, Serial#5s): Error %s\n", getDateTime(), TEST_USB_INTERFACE, sn_ascii, libusb_error_name(result));
libusb_close(handle);
libusb_exit(*context);
*context = NULL;
handle = NULL;
currentDevice = NULL;
return handle;
}

/* flush rx buffer*/
while (libusb_bulk_transfer(handle, TEST_USB_ENDPOINT_IN, test_usb_in_buffer, TEST_USB_ENDPOINT_SIZE, &transfered, TEST_USB_TIMEOUT_MS) == LIBUSB_SUCCESS){}
/* device ready for use*/
printf("%s USB device ready for use!\n", getDateTime());
printf(" Serial No: %s\n", sn_ascii);
printf(" Bus No: %d\n", busNo);
printf(" Port No: %d\n", portNo);
return handle;
}

static int UsbTransfer(const libusb_device_handle* handle, unsigned char endpoint, unsigned char* buffer, unsigned int length)
{
int result;
int actualLength;
int iTransferred;
int totalTransferred = 0;
int maxTry = TEST_USB_MAX_TRY;

if ( handle == NULL
|| buffer == NULL
|| length == 0
|| endpoint == 0)
{
printf("%s [ERROR] Error: One or more invalid parameters\n", getDateTime());
return TEST_USB_FAILED;
}
do
{
/* make sure length is not more than the endpoint packet size */
actualLength = length > TEST_USB_ENDPOINT_SIZE ? actualLength : length;
result = libusb_bulk_transfer((libusb_device_handle*)handle, endpoint, &buffer[totalTransferred], actualLength, &iTransferred, TEST_USB_TIMEOUT_MS);
if (result != LIBUSB_SUCCESS)
{
switch (result)
{
case LIBUSB_ERROR_TIMEOUT:
/* while there are data transferred when timeout occured, try again*/
if (iTransferred == 0)
{
/* during received we may received less data than expected so timeout should not be a failure*/
if (totalTransferred == 0)
{
printf("%s [ERROR] Endpoint: %d, Error: %s\n", getDateTime(), endpoint, libusb_error_name(result));
return TEST_USB_FAILED;
}
else
{
return totalTransferred;
}
}
break;
case LIBUSB_ERROR_PIPE:
/* we don't want to clear the pipe halt condition forever*/
if (maxTry == 0)
{
printf("%s [ERROR] Endpoint(%d) is still halted after trying %dx to clear it\n", getDateTime(), endpoint, TEST_USB_MAX_TRY);
return TEST_USB_FAILED;
}
printf("[WARNING] Endpoint (%d) halted!\n", endpoint);
result = libusb_clear_halt((libusb_device_handle*)handle, endpoint);
if (result != LIBUSB_SUCCESS)
{
printf("%s [ERROR] Unable to clear HALT condition. Endpoint: %d, Error: %s\n", getDateTime(), endpoint, libusb_error_name(result));
}
maxTry--;
break;
default:
printf("%s [ERROR] Transfer failed! Error: %s\n", getDateTime(), libusb_error_name(result));
return TEST_USB_FAILED;
}
}
length -= iTransferred;
totalTransferred += iTransferred;
} while (length);
return totalTransferred;
}

static void UsbClose(libusb_context** context, libusb_device_handle** handle)
{
if ( *handle == NULL
|| *context == NULL)
{
return;
}
libusb_close(*handle);
libusb_exit(*context);
*handle = NULL;
*context = NULL;
}

void displayBuffer(char* label, const unsigned char* data, unsigned int length)
{
printf("%s %s:\n", getDateTime(), label);
for (unsigned int index = 0; index < length; index++)
{
if (index != 0 && index % 8 == 0)
{
printf("\n");
}
printf("%02X ", data[index]);
}
printf("\n");
}
int main(int argc, char *argv[])
{
const libusb_context* context = NULL;
const libusb_device_handle* handle = NULL;
int testmax = 100000;
int testcounter = 1;
int received;
char *serial = NULL;

if (argc == 3)
{
if (strcmp(argv[1],"-sn") == 0)
{
serial = argv[2];
}
}

do
{
printf("---------------------------------\n");
if (handle == NULL)
{
handle = UsbOpen((libusb_context**)&context, serial);
if (handle == NULL)
{
printf("FAILED TO OPEN DEVICE!\n");
continue;
}
}

/* send discovery */
if (UsbTransfer(handle, TEST_USB_ENDPOINT_OUT, discovery, sizeof(discovery)) != sizeof(discovery))
{
printf("FAILED TO SEND DISCOVERY MESSAGE!\n");
if (handle)
{
UsbClose((libusb_context**)&context, (libusb_device_handle**)&handle);
continue;
}

}
else
{
displayBuffer("REQUEST", discovery, sizeof(discovery));
}

memset(test_usb_in_buffer, 0xFF, TEST_USB_ENDPOINT_SIZE);
received = UsbTransfer(handle, TEST_USB_ENDPOINT_IN, test_usb_in_buffer, TEST_USB_ENDPOINT_SIZE);
/* received data */
if (received == TEST_USB_FAILED)
{
printf("FAILED TO RECEIVED DISCOVERY REPLY!\n");
if (handle)
{
UsbClose((libusb_context**)&context, (libusb_device_handle**)&handle);
continue;
}
}
else
{
displayBuffer("RESPONSE", test_usb_in_buffer, received);
}

testcounter++;
} while (testcounter <= testmax);

if (handle)
{
UsbClose((libusb_context**)&context, (libusb_device_handle**)&handle);
}

return 0;
}
This application is using libusb-1.0.21 to access the USB device and running in Windows 10 x64. The installer we use is libwdi by Pete Batard. About the USB driver our device's firmware, I was informed by our embedded guys that they are using VFAT to mount the USB (they are using 2.6.26 uCLinux/ColdFire, generic usb driver )


To reproduce the problem:
1. Installed libusbsys0.dll (v2.6.0) by executing installDriver.exe without parameter. Can also use DpInst.exe without parameters.
2. Run the test application.
3. Pipe error occurred!

Currently, we have two applications that are also accessing the device. Both these applications are using LibUsbDotNet C# USB Library. When I installed the same driver (libusb0.sys) using the same procedures (call installDriver.exe without parameter), both applications were able to communicate to the USB device.

We also tried installing the driver then running the test application (it failed), then run either one of the other applications (also failed to communicate on this situation).

Thank you very much for the support.

Kind Regards,
Christopher


-----Original Message-----
From: Pete Batard [mailto:***@akeo.ie]
Sent: Thursday, 13 July 2017 9:18 PM
To: libusb-***@lists.sourceforge.net
Subject: Re: [libusb] Unable to clear LIBUSB_ERROR_PIPE on first run after installing the device driver

Oh, how I wish I could stop peeking at this mailing list every now and again, and relish in the idea that I don't have to tackle Peter's continuing attempts to test the waters and see how much he can get away with, before his attempts to seize control of a narrative devolve into an actual nuisance for this project...
Post by Peter Stuge
Sounds like this is a bug in the libusb Windows code.
Biased much?

You've been a member of this list way too long to know that, without further information from OP, there exist at least 4 layers where the issue might reside:

- OP's firmware, which we have no knowledge of, and which may be custom
- OP's code, which we have not seen, and which may be doing something that might trigger this behaviour (even if unlikely)
- The libusb0 driver layer, since OP *very explictly* pointed out that he was using libusb0, and that is something I would expect any long standing mailing-list member to latch on
- The library code that interfaces with the libusb0 driver

If, without any additional information, your conclusion is to point the finger at a single layer I really have to wonder what the heck you are still trying to accomplish on this project because, *CLEARLY*, your goal is not to help its users.

Instead, here is the minimum level of advice I would expect to come, as an initial reply, from someone who is supposed to have long standing knowledge of libusb and who actually wants to help:

1. Ask OP whether he is using a custom firmware 2. Ask OP what version of the library he is using 3. Ask OP whether he can provide us a debug libusb log from his app 4. Ask OP whether he may be able to replicate this behaviour with xusb or any means that can try to eliminate OP's code as the culprit 5. Ask OP whether he may be able to replicate this behaviour with a different device (eliminate OP's firmware) 6. And, most importantly, ask OP whether he has tried with WinUSB instead of libusb0. Again, you're supposed to have been on this list long enough to know that the first thing we ask, when someone mentions that they are using libusb0.sys (given that there are known instabilities when using this driver with libusb) is to try a different driver.

Oh, and you could also have tried to be helpful by asking the finer details, which I would also expect you to know, such as whether libusb0.sys was installed as a filter driver (another source of issues), in which case you may advise OP to try with the usbdk layer of libusb if they prefer, instead of WinUSB, try to accomplish the same with a different OS, and so on.

But of course, by performing the above, one runs the risk of finding out that this may have little to do with a "a bug in the libusb Windows code", and it's of course hard to see why anyone would pass a good opportunity of throwing FUD around (which, personally, when enacted by the same person on a reoccurring basis, is something that I would tend to qualify as "trolling behaviour"... but what do I know)?

I'll just conclude with some more free advice, which I think may be
needed: Pointing out someone's repeated shortcomings, when they are clearly preventing users of a project from receiving the appropriate level of help, is neither ad hominem nor trolling.

Regards,

/Pete

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________
libusb-devel mailing list
libusb-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Christopher Flordeliza
2017-07-17 01:31:25 UTC
Permalink
Correction on the driver the firmware is using, it is not VFAT but Gadgetfs

Kind Regards,
Christopher


-----Original Message-----
From: Christopher Flordeliza [mailto:***@nojapower.com.au]
Sent: Monday, 17 July 2017 10:47 AM
To: Pete Batard <***@akeo.ie>; libusb-***@lists.sourceforge.net; Peter Stuge <***@stuge.se>
Subject: Re: [libusb] Unable to clear LIBUSB_ERROR_PIPE on first run after installing the device driver

Dear All,

I apologise if my earlier message created confusions. Please see below the sample code I am using to reproduced the problem I described on my earlier email:

#include <stdio.h>
#include <time.h>
#include "libusb.h"

#define TEST_USB_CONFIG_VALUE 3
#define TEST_USB_SERIAL_LENGTH 14
#define TEST_USB_INTERFACE 0
#define TEST_USB_ENDPOINT_IN 0x81
#define TEST_USB_ENDPOINT_OUT 0x02
#define TEST_USB_ENDPOINT_SIZE 64
#define TEST_USB_TIMEOUT_MS 1000
#define TEST_USB_MAX_TRY 5
#define TEST_USB_SUCCESS (0)
#define TEST_USB_FAILED (-1)

unsigned char test_usb_in_buffer[TEST_USB_ENDPOINT_SIZE];
unsigned char test_usb_temp_buffer[TEST_USB_ENDPOINT_SIZE];
unsigned char discovery[] =
{
0x05, 0x00, 0x15, 0x00, 0x4E, 0xF0, 0xAD, 0xE0,
0x01, 0x00, 0x09, 0x04, 0x00, 0x06, 0x01, 0xC6,
0x00, 0x00, 0x00, 0x0F, 0x4E, 0x7F, 0x63, 0xB2 };

const char* getDateTime(void)
{
time_t timer;
struct tm tm_info;

time(&timer);
localtime_s(&tm_info, &timer);

memset(test_usb_temp_buffer, 0, TEST_USB_ENDPOINT_SIZE);
strftime((char *)test_usb_temp_buffer, TEST_USB_ENDPOINT_SIZE, "%Y.%m.%d %H:%M:%S >>", &tm_info);

return test_usb_temp_buffer;

}

const libusb_device_handle* UsbOpen(libusb_context** context, char* serialNumber) {
struct libusb_device_descriptor deviceDescriptor;
libusb_device_handle* handle = NULL;
libusb_device *currentDevice = NULL;
/* list devices */
libusb_device **devices = 0;
int result, transfered;
uint8_t portNo, busNo;

unsigned char sn_ascii[TEST_USB_SERIAL_LENGTH] = { 0 };

result = libusb_init(context);
if (result != LIBUSB_SUCCESS)
{
printf("%s [ERROR] Failed to init libusb! Error: %s\n", getDateTime(), libusb_error_name(result));
return handle;
}
ssize_t deviceCount = libusb_get_device_list(*context, &devices);
for (int index = 0; index < deviceCount; index++)
{
currentDevice = devices[index];
result = libusb_get_device_descriptor(currentDevice, &deviceDescriptor);
if (result != LIBUSB_SUCCESS)
{
printf("%s [ERROR] Failed to get the device descriptor! Error: %s\n", getDateTime(), libusb_error_name(result));
continue;
}
/* check if this is the target device */
if ((deviceDescriptor.idVendor != 0x0525)
|| (deviceDescriptor.idProduct != 0xA4A4))
{
continue;
}
if (libusb_open(currentDevice, &handle) != LIBUSB_SUCCESS)
{
printf("%s [ERROR] Failed to open the handle for the device! Error: %s\n", getDateTime(), libusb_error_name(result));
continue;
}
/* get device port and bus number */
busNo = libusb_get_bus_number(currentDevice);
portNo = libusb_get_port_number(currentDevice);

/* check if the device is what we are looking */
memset(sn_ascii, 0, TEST_USB_SERIAL_LENGTH);
result = libusb_get_string_descriptor_ascii(handle, deviceDescriptor.iSerialNumber, sn_ascii, TEST_USB_SERIAL_LENGTH);
if (result <= LIBUSB_SUCCESS)
{
libusb_close(handle);
handle = NULL;
currentDevice = NULL;
printf("%s [ERROR] Failed to get serial number: Error %s\n", getDateTime(), libusb_error_name(result));
continue;
}
/* if serial number is not specified, just get the first device matching the vendor and product ids*/
if (serialNumber == NULL)
{
break;
}
if (memcmp(serialNumber, sn_ascii, TEST_USB_SERIAL_LENGTH) == 0)
{
break;
}
if (handle)
{
libusb_close(handle);
}
handle = NULL;
currentDevice = NULL;
}
libusb_free_device_list(devices, 1);
if (handle == NULL)
{
libusb_exit(*context);
*context = NULL;
printf("%s [ERROR] Failed to find the device (Serial: %s)\n", getDateTime(), serialNumber ? serialNumber : "---");
return handle;
}

/* set configuration */
if ((result = libusb_set_configuration(handle, TEST_USB_CONFIG_VALUE)) != LIBUSB_SUCCESS)
{
printf("%s [ERROR] Failed to set the configuration (Serial#%s): Error %s\n", getDateTime(), sn_ascii, libusb_error_name(result));
libusb_close(handle);
libusb_exit(*context);
*context = NULL;
handle = NULL;
currentDevice = NULL;
return handle;
}
result = libusb_claim_interface(handle, TEST_USB_INTERFACE);
if (result != LIBUSB_SUCCESS)
{
printf("%s [ERROR] Failed to claim the interface (#%d, Serial#5s): Error %s\n", getDateTime(), TEST_USB_INTERFACE, sn_ascii, libusb_error_name(result));
libusb_close(handle);
libusb_exit(*context);
*context = NULL;
handle = NULL;
currentDevice = NULL;
return handle;
}

/* flush rx buffer*/
while (libusb_bulk_transfer(handle, TEST_USB_ENDPOINT_IN, test_usb_in_buffer, TEST_USB_ENDPOINT_SIZE, &transfered, TEST_USB_TIMEOUT_MS) == LIBUSB_SUCCESS){}
/* device ready for use*/
printf("%s USB device ready for use!\n", getDateTime());
printf(" Serial No: %s\n", sn_ascii);
printf(" Bus No: %d\n", busNo);
printf(" Port No: %d\n", portNo);
return handle;
}

static int UsbTransfer(const libusb_device_handle* handle, unsigned char endpoint, unsigned char* buffer, unsigned int length) {
int result;
int actualLength;
int iTransferred;
int totalTransferred = 0;
int maxTry = TEST_USB_MAX_TRY;

if ( handle == NULL
|| buffer == NULL
|| length == 0
|| endpoint == 0)
{
printf("%s [ERROR] Error: One or more invalid parameters\n", getDateTime());
return TEST_USB_FAILED;
}
do
{
/* make sure length is not more than the endpoint packet size */
actualLength = length > TEST_USB_ENDPOINT_SIZE ? actualLength : length;
result = libusb_bulk_transfer((libusb_device_handle*)handle, endpoint, &buffer[totalTransferred], actualLength, &iTransferred, TEST_USB_TIMEOUT_MS);
if (result != LIBUSB_SUCCESS)
{
switch (result)
{
case LIBUSB_ERROR_TIMEOUT:
/* while there are data transferred when timeout occured, try again*/
if (iTransferred == 0)
{
/* during received we may received less data than expected so timeout should not be a failure*/
if (totalTransferred == 0)
{
printf("%s [ERROR] Endpoint: %d, Error: %s\n", getDateTime(), endpoint, libusb_error_name(result));
return TEST_USB_FAILED;
}
else
{
return totalTransferred;
}
}
break;
case LIBUSB_ERROR_PIPE:
/* we don't want to clear the pipe halt condition forever*/
if (maxTry == 0)
{
printf("%s [ERROR] Endpoint(%d) is still halted after trying %dx to clear it\n", getDateTime(), endpoint, TEST_USB_MAX_TRY);
return TEST_USB_FAILED;
}
printf("[WARNING] Endpoint (%d) halted!\n", endpoint);
result = libusb_clear_halt((libusb_device_handle*)handle, endpoint);
if (result != LIBUSB_SUCCESS)
{
printf("%s [ERROR] Unable to clear HALT condition. Endpoint: %d, Error: %s\n", getDateTime(), endpoint, libusb_error_name(result));
}
maxTry--;
break;
default:
printf("%s [ERROR] Transfer failed! Error: %s\n", getDateTime(), libusb_error_name(result));
return TEST_USB_FAILED;
}
}
length -= iTransferred;
totalTransferred += iTransferred;
} while (length);
return totalTransferred;
}

static void UsbClose(libusb_context** context, libusb_device_handle** handle)
{
if ( *handle == NULL
|| *context == NULL)
{
return;
}
libusb_close(*handle);
libusb_exit(*context);
*handle = NULL;
*context = NULL;
}

void displayBuffer(char* label, const unsigned char* data, unsigned int length) {
printf("%s %s:\n", getDateTime(), label);
for (unsigned int index = 0; index < length; index++)
{
if (index != 0 && index % 8 == 0)
{
printf("\n");
}
printf("%02X ", data[index]);
}
printf("\n");
}
int main(int argc, char *argv[])
{
const libusb_context* context = NULL;
const libusb_device_handle* handle = NULL;
int testmax = 100000;
int testcounter = 1;
int received;
char *serial = NULL;

if (argc == 3)
{
if (strcmp(argv[1],"-sn") == 0)
{
serial = argv[2];
}
}

do
{
printf("---------------------------------\n");
if (handle == NULL)
{
handle = UsbOpen((libusb_context**)&context, serial);
if (handle == NULL)
{
printf("FAILED TO OPEN DEVICE!\n");
continue;
}
}

/* send discovery */
if (UsbTransfer(handle, TEST_USB_ENDPOINT_OUT, discovery, sizeof(discovery)) != sizeof(discovery))
{
printf("FAILED TO SEND DISCOVERY MESSAGE!\n");
if (handle)
{
UsbClose((libusb_context**)&context, (libusb_device_handle**)&handle);
continue;
}

}
else
{
displayBuffer("REQUEST", discovery, sizeof(discovery));
}

memset(test_usb_in_buffer, 0xFF, TEST_USB_ENDPOINT_SIZE);
received = UsbTransfer(handle, TEST_USB_ENDPOINT_IN, test_usb_in_buffer, TEST_USB_ENDPOINT_SIZE);
/* received data */
if (received == TEST_USB_FAILED)
{
printf("FAILED TO RECEIVED DISCOVERY REPLY!\n");
if (handle)
{
UsbClose((libusb_context**)&context, (libusb_device_handle**)&handle);
continue;
}
}
else
{
displayBuffer("RESPONSE", test_usb_in_buffer, received);
}

testcounter++;
} while (testcounter <= testmax);

if (handle)
{
UsbClose((libusb_context**)&context, (libusb_device_handle**)&handle);
}

return 0;
}
This application is using libusb-1.0.21 to access the USB device and running in Windows 10 x64. The installer we use is libwdi by Pete Batard. About the USB driver our device's firmware, I was informed by our embedded guys that they are using VFAT to mount the USB (they are using 2.6.26 uCLinux/ColdFire, generic usb driver )


To reproduce the problem:
1. Installed libusbsys0.dll (v2.6.0) by executing installDriver.exe without parameter. Can also use DpInst.exe without parameters.
2. Run the test application.
3. Pipe error occurred!

Currently, we have two applications that are also accessing the device. Both these applications are using LibUsbDotNet C# USB Library. When I installed the same driver (libusb0.sys) using the same procedures (call installDriver.exe without parameter), both applications were able to communicate to the USB device.

We also tried installing the driver then running the test application (it failed), then run either one of the other applications (also failed to communicate on this situation).

Thank you very much for the support.

Kind Regards,
Christopher


-----Original Message-----
From: Pete Batard [mailto:***@akeo.ie]
Sent: Thursday, 13 July 2017 9:18 PM
To: libusb-***@lists.sourceforge.net
Subject: Re: [libusb] Unable to clear LIBUSB_ERROR_PIPE on first run after installing the device driver

Oh, how I wish I could stop peeking at this mailing list every now and again, and relish in the idea that I don't have to tackle Peter's continuing attempts to test the waters and see how much he can get away with, before his attempts to seize control of a narrative devolve into an actual nuisance for this project...
Post by Peter Stuge
Sounds like this is a bug in the libusb Windows code.
Biased much?

You've been a member of this list way too long to know that, without further information from OP, there exist at least 4 layers where the issue might reside:

- OP's firmware, which we have no knowledge of, and which may be custom
- OP's code, which we have not seen, and which may be doing something that might trigger this behaviour (even if unlikely)
- The libusb0 driver layer, since OP *very explictly* pointed out that he was using libusb0, and that is something I would expect any long standing mailing-list member to latch on
- The library code that interfaces with the libusb0 driver

If, without any additional information, your conclusion is to point the finger at a single layer I really have to wonder what the heck you are still trying to accomplish on this project because, *CLEARLY*, your goal is not to help its users.

Instead, here is the minimum level of advice I would expect to come, as an initial reply, from someone who is supposed to have long standing knowledge of libusb and who actually wants to help:

1. Ask OP whether he is using a custom firmware 2. Ask OP what version of the library he is using 3. Ask OP whether he can provide us a debug libusb log from his app 4. Ask OP whether he may be able to replicate this behaviour with xusb or any means that can try to eliminate OP's code as the culprit 5. Ask OP whether he may be able to replicate this behaviour with a different device (eliminate OP's firmware) 6. And, most importantly, ask OP whether he has tried with WinUSB instead of libusb0. Again, you're supposed to have been on this list long enough to know that the first thing we ask, when someone mentions that they are using libusb0.sys (given that there are known instabilities when using this driver with libusb) is to try a different driver.

Oh, and you could also have tried to be helpful by asking the finer details, which I would also expect you to know, such as whether libusb0.sys was installed as a filter driver (another source of issues), in which case you may advise OP to try with the usbdk layer of libusb if they prefer, instead of WinUSB, try to accomplish the same with a different OS, and so on.

But of course, by performing the above, one runs the risk of finding out that this may have little to do with a "a bug in the libusb Windows code", and it's of course hard to see why anyone would pass a good opportunity of throwing FUD around (which, personally, when enacted by the same person on a reoccurring basis, is something that I would tend to qualify as "trolling behaviour"... but what do I know)?

I'll just conclude with some more free advice, which I think may be
needed: Pointing out someone's repeated shortcomings, when they are clearly preventing users of a project from receiving the appropriate level of help, is neither ad hominem nor trolling.

Regards,

/Pete

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________
libusb-devel mailing list
libusb-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
libusb-devel mailing list
libusb-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Pete Batard
2017-07-17 01:33:50 UTC
Permalink
Hi Christopher,

A debug log would have been nice. Since you have control over the app,
you can produce debug logging, which can be invaluable in identifying
issues.

But anyway, here's what I'd like to point out (without even taking a
look at your code, as I don't think I'll ever have time to properly look
at it).

1. 0525:A4A4 - According to http://www.linux-usb.org/usb.ids your device
is a Netchip Technology 'Linux-USB user-mode bulk source/sink'... and
from what you indicate, this appears to be a custom device. Can you tell
us more about its purpose and the kind of features its firmware
provides? What is this ultimately meant to be used for?

2. I think we may have to clarify your statement that "(you) are using
VFAT to mount the USB", because if your device provides a mass-storage
layer, and you are therefore replacing the default mass-storage driver
from Windows when you're installing libusb0.sys, you may be asking for
trouble... But then again, I have very little idea what your device does
or how it is meant to behave, so I may be off mark on that.

3. As I tried to indicate in my previous e-mail (albeit in a manner that
attempted to serve two purposes), please indicate what happens if you
use WinUSB as a driver instead of libusb0/libusb-win32. When used
against libusb, the libusb0 driver should be considered *unstable* and
its use with libusb has actually been discouraged for some time. So if
you are using the libusb0.sys/libusb-win32 driver, on account that it
has "libusb" in its name, don't. The recommended driver to use with
libusb is the WinUSB driver from Microsoft, which is the default choice
of Zadig (for this very precise reason). So, once again, I will ask you
to report what happens if you use WinUSB instead of libusb0.sys. Or you
can also try with an USBDk enabled version of the library. Currently
there are quite a few ways you can access devices with libusb, so if you
encounter an issue, you should attempt to use a different access mode to
better identify where the issue may be located. Oh, and for the record,
LibUsbDotNet also supports WinUSB as its driver, so your other
applications should not be impacted by this switch.

4. Also, as I tried to point out, can you please test with the xusb
sample application and report what you get? Something like 'xusb -d
0525:A4A4' (which produces debug output) may help tell us more...

Regards,

/Pete
Christopher Flordeliza
2017-07-17 06:25:25 UTC
Permalink
Dear Pete,

1. 0525:A4A4 - According to http://www.linux-usb.org/usb.ids your device is a Netchip Technology 'Linux-USB user-mode bulk source/sink'... and from what you indicate, this appears to be a custom device. Can you tell us more about its purpose and the kind of features its firmware provides? What is this ultimately meant to be used for?

The device is an auto-recloser (basically a circuit braker that is capable of automatically closing a breaker openned by a fault condition). We are devolping an application that sends commands to this device via the USB.

2. I think we may have to clarify your statement that "(you) are using VFAT to mount the USB", because if your device provides a mass-storage layer, and you are therefore replacing the default mass-storage driver from Windows when you're installing libusb0.sys, you may be asking for trouble... But then again, I have very little idea what your device does or how it is meant to behave, so I may be off mark on that.

My mistake on this one, the device's firmware is using GadgetFs to read and write on the device endpoints. Device is running embedded linux (uCLinux/ColdFire). We send commands to the device via the USB.

3. As I tried to indicate in my previous e-mail (albeit in a manner that attempted to serve two purposes), please indicate what happens if you use WinUSB as a driver instead of libusb0/libusb-win32. When used against libusb, the libusb0 driver should be considered *unstable* and its use with libusb has actually been discouraged for some time. So if you are using the libusb0.sys/libusb-win32 driver, on account that it has "libusb" in its name, don't. The recommended driver to use with libusb is the WinUSB driver from Microsoft, which is the default choice of Zadig (for this very precise reason). So, once again, I will ask you to report what happens if you use WinUSB instead of libusb0.sys. Or you can also try with an USBDk enabled version of the library. Currently there are quite a few ways you can access devices with libusb, so if you encounter an issue, you should attempt to use a different access mode to better identify where the issue may be located. Oh, and for the record, LibUsbDotNet also supports WinUSB as its driver, so your other applications should not be impacted by this switch.

Yes you are right libusb0 is not recommended for libusb as stated in libusb wiki, unfortunately the original developer of the application we are now developing used libusb0 (no one knows what is the reason). I will talk to my superior to consider changing the driver to WinUsb. I tried using the WinUSB as you recommended and the stalled issue is not occurring (tested the other applications using WinUSB as driver, it seems they are functioning as expected). Based from this and what you said in this email and what is stated in the LibUsb wiki I think I have enough reason to ask my superiors to change the driver.

As requested, here is the log when using libusb0.sys.
[Program Output]
--------------- 000001 ---------------
2017.07.17 15:22:01 >> USB device ready for use!
Serial No: 0311213090240
Bus No: 2
Port No: 7
[WARNING] Endpoint (2) halted!
[WARNING] Endpoint (2) halted!
[WARNING] Endpoint (2) halted!
[WARNING] Endpoint (2) halted!
[WARNING] Endpoint (2) halted!
2017.07.17 15:22:01 >> [ERROR] Endpoint(2) is still halted after trying 5x to clear it

[LIBUSBDEBUG LOG]
[ 0.000000] [000000ec] libusb: debug [libusb_init] created default context
[ 0.000000] [000000ec] libusb: debug [libusb_init] libusb v1.0.21.11156
[ 0.000000] [000000ec] libusb: debug [windows_init] Windows 8 64-bit
[ 0.000000] [000000ec] libusb: debug [setup_cancel_io] Will use CancelIoEx for I/O cancellation
'listdevs.exe': Loaded 'C:\Windows\System32\cfgmgr32.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\ucrtbase.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\advapi32.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\sechost.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\ole32.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\combase.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\bcryptprimitives.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\gdi32.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\gdi32full.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\msvcp_win.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\user32.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\win32u.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\imm32.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\setupapi.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\libusbK.dll', Exports loaded.
[ 0.610809] [000000ec] libusb: debug [winusbx_init] using libusbK DLL for universal access
[ 0.610809] [000000ec] libusb: debug [winusbx_init] libusbK version: 3.0.7.0
'listdevs.exe': Loaded 'C:\Windows\System32\wintrust.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\msasn1.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\crypt32.dll', Exports loaded.

AllK required contiguous memory = 534200 (64bit)
8 HotK Handles: HandleSize 2112 PoolSize 16912 (bytes)
64 LstK Handles: HandleSize 64 PoolSize 4112 (bytes)
1024 LstInfoK Handles: HandleSize 64 PoolSize 65552 (bytes)
64 UsbK Handles: HandleSize 96 PoolSize 6160 (bytes)
32 DevK Handles: HandleSize 112 PoolSize 3600 (bytes)
4096 OvlK Handles: HandleSize 104 PoolSize 426000 (bytes)
64 OvlPoolK Handles: HandleSize 96 PoolSize 6160 (bytes)
32 StmK Handles: HandleSize 176 PoolSize 5648 (bytes)

Dynamically allocated as needed:
KLST_DEVINFO = 2596 bytes each
[ 0.673319] [000000ec] libusb: debug [winusbx_init] initalized sub API libusbK
[ 0.673319] [000000ec] libusb: debug [winusbx_init] initalized sub API libusb0
'listdevs.exe': Loaded 'C:\Windows\System32\winusb.dll', Exports loaded.
[ 0.688947] [000000ec] libusb: debug [winusbx_init] initalized sub API WinUSB
'listdevs.exe': Loaded 'C:\Windows\System32\hid.dll', Exports loaded.
[ 0.704575] [000000ec] libusb: debug [windows_init_clock] hires timer available (Frequency: 3312647 Hz)
[ 0.704575] [000000ec] libusb: debug [windows_init_clock] timer thread will run on core #0
[ 0.704575] [000000ec] libusb: debug [htab_create] using 1021 entries hash table
[ 0.704575] [000000ec] libusb: debug [usbi_add_pollfd] add fd 0 events 1
[ 0.704575] [000000ec] libusb: debug [libusb_get_device_list]
'listdevs.exe': Loaded 'C:\Windows\System32\devobj.dll', Exports loaded.
[ 0.720203] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [3DF]
[ 0.720203] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [1EA]
[ 0.720203] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [19D]
[ 0.720203] [000000ec] libusb: debug [get_api_type] driver(s): usbhub
[ 0.720203] [000000ec] libusb: debug [get_api_type] matched driver name against HUB API
[ 0.720203] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [36E]
[ 0.720203] [000000ec] libusb: debug [get_api_type] driver(s): USBHUB3
[ 0.720203] [000000ec] libusb: debug [get_api_type] matched driver name against HUB API
[ 0.720203] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [174]
[ 0.720203] [000000ec] libusb: debug [get_api_type] driver(s): usbhub
[ 0.720203] [000000ec] libusb: debug [get_api_type] matched driver name against HUB API
[ 0.720203] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [90]
[ 0.720203] [000000ec] libusb: debug [get_api_type] driver(s): usbhub
[ 0.720203] [000000ec] libusb: debug [get_api_type] matched driver name against HUB API
[ 0.720203] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [358]
[ 0.720203] [000000ec] libusb: debug [get_api_type] driver(s): usbhub
[ 0.720203] [000000ec] libusb: debug [get_api_type] matched driver name against HUB API
[ 0.720203] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [64]
[ 0.720203] [000000ec] libusb: debug [windows_get_device_list] found existing device for session [90] (0.0)
[ 0.735831] [000000ec] libusb: debug [init_device] (bus: 1, addr: 1, depth: 0, port: 0): '\\.\USB#ROOT_HUB20#4&13D5D5E&0'
[ 0.735831] [000000ec] libusb: debug [windows_get_device_list] found existing device for session [174] (0.0)
[ 0.735831] [000000ec] libusb: debug [init_device] (bus: 2, addr: 1, depth: 0, port: 0): '\\.\USB#ROOT_HUB30#4&2109F25B&0&0'
[ 0.735831] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [276]
[ 0.735831] [000000ec] libusb: debug [init_device] found 1 configurations (active conf: 1)
[ 0.735831] [000000ec] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 34 bytes)
[ 0.735831] [000000ec] libusb: debug [init_device] (bus: 2, addr: 3, depth: 1, port: 4): '\\.\USB#VID_03F0&PID_034A&MI_01#6&31180F1&0&0001'
[ 0.735831] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [1D6]
[ 0.735831] [000000ec] libusb: debug [init_device] found 1 configurations (active conf: 1)
[ 0.735831] [000000ec] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 59 bytes)
[ 0.735831] [000000ec] libusb: debug [init_device] (bus: 2, addr: 2, depth: 1, port: 3): '\\.\USB#VID_03F0&PID_034A&MI_00#6&31180F1&0&0000'
[ 0.735831] [000000ec] libusb: debug [windows_get_device_list] found existing device for session [36E] (0.0)
[ 0.800736] [000000ec] libusb: debug [init_device] found 1 configurations (active conf: 1)
[ 0.800736] [000000ec] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 25 bytes)
[ 0.800736] [000000ec] libusb: debug [init_device] (bus: 1, addr: 2, depth: 1, port: 1): '\\.\USB#VID_8087&PID_8008#5&323647F0&4&1'
[ 0.800736] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [29B]
[ 0.800736] [000000ec] libusb: debug [init_device] found 1 configurations (active conf: 1)
[ 0.800736] [000000ec] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 34 bytes)
[ 0.800736] [000000ec] libusb: debug [init_device] (bus: 2, addr: 3, depth: 1, port: 4): '\\.\USB#VID_03F0&PID_094A#5&11249855&0&4'
[ 0.800736] [000000ec] libusb: debug [windows_get_device_list] found existing device for session [64] (0.0)
[ 0.800736] [000000ec] libusb: debug [init_device] (bus: 3, addr: 1, depth: 0, port: 0): '\\.\USB#ROOT_HUB20#4&3CF1FE8&0'
[ 0.800736] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [271]
[ 0.800736] [000000ec] libusb: debug [init_device] found 1 configurations (active conf: 1)
[ 0.800736] [000000ec] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 59 bytes)
[ 0.800736] [000000ec] libusb: debug [init_device] (bus: 2, addr: 2, depth: 1, port: 3): '\\.\USB#VID_03F0&PID_034A#5&11249855&0&3'
[ 0.800736] [000000ec] libusb: debug [windows_get_device_list] found existing device for session [358] (0.0)
[ 0.867266] [000000ec] libusb: debug [init_device] found 1 configurations (active conf: 1)
[ 0.867266] [000000ec] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 25 bytes)
[ 0.867266] [000000ec] libusb: debug [init_device] (bus: 3, addr: 2, depth: 1, port: 1): '\\.\USB#VID_8087&PID_8000#5&37AE6513&4&1'
[ 0.867266] [000000ec] libusb: debug [discovered_devs_append] need to increase capacity
[ 0.867266] [000000ec] libusb: debug [windows_get_device_list] extra GUID: {4B384764-BE4F-246C-A848-4F338F96A2C8}
[ 0.867266] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [A7]
[ 0.867266] [000000ec] libusb: debug [init_device] found 1 configurations (active conf: 3)
[ 0.867266] [000000ec] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=3, 39 bytes)
[ 0.867266] [000000ec] libusb: debug [init_device] (bus: 2, addr: 24, depth: 1, port: 7): '\\.\USB#VID_0525&PID_A4A4#5&11249855&0&7'
[ 0.867266] [000000ec] libusb: debug [get_api_type] driver(s): HidUsb
[ 0.867266] [000000ec] libusb: debug [get_api_type] matched driver name against HID API
[ 0.867266] [000000ec] libusb: debug [windows_get_device_list] found existing device for session [29B] (2.3)
[ 0.867266] [000000ec] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.867266] [000000ec] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.867266] [000000ec] libusb: debug [windows_get_device_list] found existing device for session [271] (2.2)
[ 0.867266] [000000ec] libusb: debug [get_api_type] driver(s): libusb0
[ 0.867266] [000000ec] libusb: debug [get_api_type] matched driver name against libusb0
[ 0.867266] [000000ec] libusb: debug [windows_get_device_list] found existing device for session [A7] (2.24)
[ 0.867266] [000000ec] libusb: debug [windows_get_device_list] setting HID interface for [29B]:
[ 0.867266] [000000ec] libusb: debug [set_hid_interface] interface[0] = \\.\HID#VID_03F0&PID_094A#6&292C14BD&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.867266] [000000ec] libusb: debug [get_api_type] driver(s): libusb0
[ 0.867266] [000000ec] libusb: debug [get_api_type] matched driver name against libusb0
[ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor]
[ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor]
[ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor]
[ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor]
[ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor]
[ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor]
[ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor]
[ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor]
[ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor]
[ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor]
[ 0.867266] [000000ec] libusb: debug [libusb_open] open 2.24
[ 0.867266] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C84309CF58
[ 0.867266] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C84309CF58
[ 0.867266] [000000ec] libusb: debug [libusb_claim_interface] interface 0
[ 0.867266] [000000ec] libusb: debug [winusbx_claim_interface] claimed interface 0
[ 0.867266] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 81 to interface 0
[ 0.867266] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 02 to interface 0
[ 0.867266] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 83 to interface 0
[ 0.867266] [000000ec] libusb: debug [auto_claim] auto-claimed interface 0 for control request
[ 0.867266] [000000ec] libusb: debug [winusbx_submit_control_transfer] will use interface 0
[ 1.101426] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 1
[ 1.101426] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.773595s
[ 1.101426] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.101426] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.101426] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 774ms
[ 1.101426] [000000ec] libusb: debug [handle_events] poll() returned 1
[ 1.101426] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0001
[ 1.101426] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.101426] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 0, size 255
[ 1.101426] [000000ec] libusb: debug [libusb_release_interface] interface 0
[ 1.101426] [000000ec] libusb: debug [auto_release] auto-released interface 0
[ 1.101426] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C84309CF58 has callback 00007FF68A7B7A50
[ 1.101426] [000000ec] libusb: debug [sync_transfer_cb] actual_length=255
[ 1.101426] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C84309CF58
[ 1.101426] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C84309CF58
[ 1.101426] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C84309CF58
[ 1.101426] [000000ec] libusb: debug [libusb_claim_interface] interface 0
[ 1.101426] [000000ec] libusb: debug [winusbx_claim_interface] claimed interface 0
[ 1.101426] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 81 to interface 0
[ 1.101426] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 02 to interface 0
[ 1.101426] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 83 to interface 0
[ 1.101426] [000000ec] libusb: debug [auto_claim] auto-claimed interface 0 for control request
[ 1.101426] [000000ec] libusb: debug [winusbx_submit_control_transfer] will use interface 0
[ 1.303961] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 1
[ 1.303961] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.801171s
[ 1.303961] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.303961] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.303961] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 802ms
[ 1.303961] [000000ec] libusb: debug [handle_events] poll() returned 1
[ 1.303961] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0001
[ 1.303961] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.303961] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 0, size 255
[ 1.303961] [000000ec] libusb: debug [libusb_release_interface] interface 0
[ 1.303961] [000000ec] libusb: debug [auto_release] auto-released interface 0
[ 1.303961] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C84309CF58 has callback 00007FF68A7B7A50
[ 1.303961] [000000ec] libusb: debug [sync_transfer_cb] actual_length=255
[ 1.303961] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C84309CF58
[ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 2.3
[ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 2.2
[ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 1.2
[ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 1.1
[ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 1.0
[ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 2.3
[ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 2.2
[ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 3.2
[ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 3.1
[ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 3.0
[ 1.303961] [000000ec] libusb: debug [libusb_set_configuration] configuration 3
[ 1.303961] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C84309D7B8
[ 1.303961] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C84309D7B8
[ 1.303961] [000000ec] libusb: debug [libusb_claim_interface] interface 0
[ 1.303961] [000000ec] libusb: debug [winusbx_claim_interface] claimed interface 0
[ 1.303961] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 81 to interface 0
[ 1.303961] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 02 to interface 0
[ 1.303961] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 83 to interface 0
[ 1.303961] [000000ec] libusb: debug [auto_claim] auto-claimed interface 0 for control request
[ 1.303961] [000000ec] libusb: debug [winusbx_submit_control_transfer] will use interface 0
[ 1.303961] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 1
[ 1.303961] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.998490s
[ 1.303961] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.303961] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.303961] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 999ms
[ 1.303961] [000000ec] libusb: debug [handle_events] poll() returned 1
[ 1.303961] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0001
[ 1.303961] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.303961] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 0, size 0
[ 1.303961] [000000ec] libusb: debug [libusb_release_interface] interface 0
[ 1.303961] [000000ec] libusb: debug [auto_release] auto-released interface 0
[ 1.303961] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C84309D7B8 has callback 00007FF68A7B7A50
[ 1.303961] [000000ec] libusb: debug [sync_transfer_cb] actual_length=0
[ 1.303961] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C84309D7B8
[ 1.303961] [000000ec] libusb: debug [libusb_claim_interface] interface 0
[ 1.303961] [000000ec] libusb: debug [winusbx_claim_interface] claimed interface 0
[ 1.303961] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 81 to interface 0
[ 1.303961] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 02 to interface 0
[ 1.303961] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 83 to interface 0
[ 1.303961] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C843095478
[ 1.303961] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C843095478
[ 1.303961] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 81 with interface 0
[ 1.303961] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] reading 64 bytes
[ 1.303961] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 1
[ 1.303961] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.999094s
[ 1.303961] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.303961] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.303961] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms
[ 1.303961] [000000ec] libusb: debug [handle_events] poll() returned 1
[ 1.319589] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0001
[ 1.319589] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.319589] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0
[ 1.319589] [000000ec] libusb: debug [windows_transfer_callback] detected endpoint stall
[ 1.319589] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C843095478 has callback 00007FF68A7B7A50
[ 1.319589] [000000ec] libusb: debug [sync_transfer_cb] actual_length=0
[ 1.319589] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C843095478
[ 1.319589] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C843095478
[ 1.319589] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C843095478
[ 1.319589] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0
[ 1.319589] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes
[ 1.319589] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 4
[ 1.319589] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.999094s
[ 1.319589] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.319589] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.319589] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms
[ 1.319589] [000000ec] libusb: debug [handle_events] poll() returned 1
[ 1.319589] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004
[ 1.319589] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.319589] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0
[ 1.319589] [000000ec] libusb: debug [windows_transfer_callback] detected endpoint stall
[ 1.319589] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C843095478 has callback 00007FF68A7B7A50
[ 1.319589] [000000ec] libusb: debug [sync_transfer_cb] actual_length=0
[ 1.319589] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C843095478
[ 1.319589] [000000ec] libusb: debug [libusb_clear_halt] endpoint 2
[ 1.319589] [000000ec] libusb: debug [winusbx_clear_halt] matched endpoint 02 with interface 0
[ 1.319589] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C843095478
[ 1.319589] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C843095478
[ 1.319589] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0
[ 1.319589] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes
[ 1.319589] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 4
[ 1.319589] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.999094s
[ 1.319589] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.319589] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.319589] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms
[ 1.319589] [000000ec] libusb: debug [handle_events] poll() returned 1
[ 1.319589] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004
[ 1.319589] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.319589] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0
[ 1.319589] [000000ec] libusb: debug [windows_transfer_callback] detected endpoint stall
[ 1.319589] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C843095478 has callback 00007FF68A7B7A50
[ 1.319589] [000000ec] libusb: debug [sync_transfer_cb] actual_length=0
[ 1.319589] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C843095478
[ 1.319589] [000000ec] libusb: debug [libusb_clear_halt] endpoint 2
[ 1.319589] [000000ec] libusb: debug [winusbx_clear_halt] matched endpoint 02 with interface 0
[ 1.335218] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C843095478
[ 1.335218] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C843095478
[ 1.335218] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0
[ 1.335218] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes
[ 1.335218] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 4
[ 1.335218] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.998490s
[ 1.335218] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.335218] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.335218] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 999ms
[ 1.335218] [000000ec] libusb: debug [handle_events] poll() returned 1
[ 1.335218] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004
[ 1.335218] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.335218] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0
[ 1.335218] [000000ec] libusb: debug [windows_transfer_callback] detected endpoint stall
[ 1.335218] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C843095478 has callback 00007FF68A7B7A50
[ 1.335218] [000000ec] libusb: debug [sync_transfer_cb] actual_length=0
[ 1.335218] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C843095478
[ 1.335218] [000000ec] libusb: debug [libusb_clear_halt] endpoint 2
[ 1.335218] [000000ec] libusb: debug [winusbx_clear_halt] matched endpoint 02 with interface 0
[ 1.335218] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C843095478
[ 1.335218] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C843095478
[ 1.335218] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0
[ 1.335218] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes
[ 1.335218] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 4
[ 1.335218] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.999396s
[ 1.335218] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.335218] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.335218] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms
[ 1.335218] [000000ec] libusb: debug [handle_events] poll() returned 1
[ 1.335218] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004
[ 1.335218] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.335218] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0
[ 1.335218] [000000ec] libusb: debug [windows_transfer_callback] detected endpoint stall
[ 1.335218] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C843095478 has callback 00007FF68A7B7A50
[ 1.335218] [000000ec] libusb: debug [sync_transfer_cb] actual_length=0
[ 1.335218] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C843095478
[ 1.335218] [000000ec] libusb: debug [libusb_clear_halt] endpoint 2
[ 1.335218] [000000ec] libusb: debug [winusbx_clear_halt] matched endpoint 02 with interface 0
[ 1.335218] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C843095478
[ 1.335218] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C843095478
[ 1.335218] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0
[ 1.335218] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes
[ 1.335218] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 4
[ 1.335218] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.999397s
[ 1.335218] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.335218] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.335218] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms
[ 1.335218] [000000ec] libusb: debug [handle_events] poll() returned 1
[ 1.335218] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004
[ 1.335218] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.335218] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0
[ 1.335218] [000000ec] libusb: debug [windows_transfer_callback] detected endpoint stall
[ 1.335218] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C843095478 has callback 00007FF68A7B7A50
[ 1.335218] [000000ec] libusb: debug [sync_transfer_cb] actual_length=0
[ 1.335218] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C843095478
[ 1.335218] [000000ec] libusb: debug [libusb_clear_halt] endpoint 2
[ 1.335218] [000000ec] libusb: debug [winusbx_clear_halt] matched endpoint 02 with interface 0
[ 1.350845] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C843095478
[ 1.350845] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C843095478
[ 1.350845] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0
[ 1.350845] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes
[ 1.350845] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 4
[ 1.350845] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.999396s
[ 1.350845] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.350845] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.350845] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms
[ 1.350845] [000000ec] libusb: debug [handle_events] poll() returned 1
[ 1.350845] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004
[ 1.350845] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.350845] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0
[ 1.350845] [000000ec] libusb: debug [windows_transfer_callback] detected endpoint stall
[ 1.350845] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C843095478 has callback 00007FF68A7B7A50
[ 1.350845] [000000ec] libusb: debug [sync_transfer_cb] actual_length=0
[ 1.350845] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C843095478

Thank you very much for your and the communities support and time, we appreciated it very much.

Kindest Regards,

Christopher

-----Original Message-----
From: Pete Batard [mailto:***@akeo.ie]
Sent: Monday, 17 July 2017 11:34 AM
To: libusb-***@lists.sourceforge.net
Subject: Re: [libusb] Unable to clear LIBUSB_ERROR_PIPE on first run after installing the device driver

Hi Christopher,

A debug log would have been nice. Since you have control over the app, you can produce debug logging, which can be invaluable in identifying issues.

But anyway, here's what I'd like to point out (without even taking a look at your code, as I don't think I'll ever have time to properly look at it).

1. 0525:A4A4 - According to http://www.linux-usb.org/usb.ids your device is a Netchip Technology 'Linux-USB user-mode bulk source/sink'... and from what you indicate, this appears to be a custom device. Can you tell us more about its purpose and the kind of features its firmware provides? What is this ultimately meant to be used for?

2. I think we may have to clarify your statement that "(you) are using VFAT to mount the USB", because if your device provides a mass-storage layer, and you are therefore replacing the default mass-storage driver from Windows when you're installing libusb0.sys, you may be asking for trouble... But then again, I have very little idea what your device does or how it is meant to behave, so I may be off mark on that.

3. As I tried to indicate in my previous e-mail (albeit in a manner that attempted to serve two purposes), please indicate what happens if you use WinUSB as a driver instead of libusb0/libusb-win32. When used against libusb, the libusb0 driver should be considered *unstable* and its use with libusb has actually been discouraged for some time. So if you are using the libusb0.sys/libusb-win32 driver, on account that it has "libusb" in its name, don't. The recommended driver to use with libusb is the WinUSB driver from Microsoft, which is the default choice of Zadig (for this very precise reason). So, once again, I will ask you to report what happens if you use WinUSB instead of libusb0.sys. Or you can also try with an USBDk enabled version of the library. Currently there are quite a few ways you can access devices with libusb, so if you encounter an issue, you should attempt to use a different access mode to better identify where the issue may be located. Oh, and for the record, LibUsbDotNet also supports WinUSB as its driver, so your other applications should not be impacted by this switch.

4. Also, as I tried to point out, can you please test with the xusb sample application and report what you get? Something like 'xusb -d 0525:A4A4' (which produces debug output) may help tell us more...

Regards,

/Pete


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________
libusb-devel mailing list
libusb-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Christopher Flordeliza
2017-07-17 06:32:35 UTC
Permalink
Sorry about the format of the log on my earlier message, here is a better formatted one:

--------------------------------------------------------------------------------
[ 1.203064] [00001464] libusb: debug [libusb_get_device_list]
'listdevs.exe': Loaded 'C:\Windows\System32\devobj.dll', Exports loaded.
[ 1.218075] [00001464] libusb: debug [windows_get_device_list] allocating new device for session [3DF]
[ 1.219075] [00001464] libusb: debug [windows_get_device_list] allocating new device for session [1EA]
[ 1.219075] [00001464] libusb: debug [windows_get_device_list] allocating new device for session [19D]
[ 1.220075] [00001464] libusb: debug [get_api_type] driver(s): usbhub
[ 1.220075] [00001464] libusb: debug [get_api_type] matched driver name against HUB API
[ 1.220075] [00001464] libusb: debug [windows_get_device_list] allocating new device for session [36E]
[ 1.221076] [00001464] libusb: debug [get_api_type] driver(s): USBHUB3
[ 1.221076] [00001464] libusb: debug [get_api_type] matched driver name against HUB API
[ 1.221076] [00001464] libusb: debug [windows_get_device_list] allocating new device for session [174]
[ 1.221076] [00001464] libusb: debug [get_api_type] driver(s): usbhub
[ 1.222077] [00001464] libusb: debug [get_api_type] matched driver name against HUB API
[ 1.222077] [00001464] libusb: debug [windows_get_device_list] allocating new device for session [90]
[ 1.222077] [00001464] libusb: debug [get_api_type] driver(s): usbhub
[ 1.222077] [00001464] libusb: debug [get_api_type] matched driver name against HUB API
[ 1.222077] [00001464] libusb: debug [windows_get_device_list] allocating new device for session [358]
[ 1.223078] [00001464] libusb: debug [get_api_type] driver(s): usbhub
[ 1.223078] [00001464] libusb: debug [get_api_type] matched driver name against HUB API
[ 1.223078] [00001464] libusb: debug [windows_get_device_list] allocating new device for session [64]
[ 1.224078] [00001464] libusb: debug [windows_get_device_list] found existing device for session [90] (0.0)
[ 1.224078] [00001464] libusb: debug [init_device] (bus: 1, addr: 1, depth: 0, port: 0): '\\.\USB#ROOT_HUB20#4&13D5D5E&0'
[ 1.224078] [00001464] libusb: debug [windows_get_device_list] found existing device for session [174] (0.0)
[ 1.224078] [00001464] libusb: debug [init_device] (bus: 2, addr: 1, depth: 0, port: 0): '\\.\USB#ROOT_HUB30#4&2109F25B&0&0'
[ 1.225080] [00001464] libusb: debug [windows_get_device_list] allocating new device for session [276]
[ 1.225080] [00001464] libusb: debug [init_device] found 1 configurations (active conf: 1)
[ 1.225080] [00001464] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 34 bytes)
[ 1.225080] [00001464] libusb: debug [init_device] (bus: 2, addr: 3, depth: 1, port: 4): '\\.\USB#VID_03F0&PID_034A&MI_01#6&31180F1&0&0001'
[ 1.226080] [00001464] libusb: debug [windows_get_device_list] allocating new device for session [1D6]
[ 1.226080] [00001464] libusb: debug [init_device] found 1 configurations (active conf: 1)
[ 1.226080] [00001464] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 59 bytes)
[ 1.226080] [00001464] libusb: debug [init_device] (bus: 2, addr: 2, depth: 1, port: 3): '\\.\USB#VID_03F0&PID_034A&MI_00#6&31180F1&0&0000'
[ 1.226080] [00001464] libusb: debug [windows_get_device_list] found existing device for session [36E] (0.0)
[ 1.287595] [00001464] libusb: debug [init_device] found 1 configurations (active conf: 1)
[ 1.288851] [00001464] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 25 bytes)
[ 1.288851] [00001464] libusb: debug [init_device] (bus: 1, addr: 2, depth: 1, port: 1): '\\.\USB#VID_8087&PID_8008#5&323647F0&4&1'
[ 1.289851] [00001464] libusb: debug [windows_get_device_list] allocating new device for session [29B]
[ 1.289851] [00001464] libusb: debug [init_device] found 1 configurations (active conf: 1)
[ 1.289851] [00001464] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 34 bytes)
[ 1.289851] [00001464] libusb: debug [init_device] (bus: 2, addr: 3, depth: 1, port: 4): '\\.\USB#VID_03F0&PID_094A#5&11249855&0&4'
[ 1.290852] [00001464] libusb: debug [windows_get_device_list] found existing device for session [64] (0.0)
[ 1.290852] [00001464] libusb: debug [init_device] (bus: 3, addr: 1, depth: 0, port: 0): '\\.\USB#ROOT_HUB20#4&3CF1FE8&0'
[ 1.290852] [00001464] libusb: debug [windows_get_device_list] allocating new device for session [271]
[ 1.291853] [00001464] libusb: debug [init_device] found 1 configurations (active conf: 1)
[ 1.291853] [00001464] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 59 bytes)
[ 1.291853] [00001464] libusb: debug [init_device] (bus: 2, addr: 2, depth: 1, port: 3): '\\.\USB#VID_03F0&PID_034A#5&11249855&0&3'
[ 1.291853] [00001464] libusb: debug [windows_get_device_list] found existing device for session [358] (0.0)
[ 1.354289] [00001464] libusb: debug [init_device] found 1 configurations (active conf: 1)
[ 1.354289] [00001464] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 25 bytes)
[ 1.355292] [00001464] libusb: debug [init_device] (bus: 3, addr: 2, depth: 1, port: 1): '\\.\USB#VID_8087&PID_8000#5&37AE6513&4&1'
[ 1.355292] [00001464] libusb: debug [discovered_devs_append] need to increase capacity
[ 1.355292] [00001464] libusb: debug [windows_get_device_list] extra GUID: {4B384764-BE4F-246C-A848-4F338F96A2C8}
[ 1.355292] [00001464] libusb: debug [windows_get_device_list] allocating new device for session [A7]
[ 1.356292] [00001464] libusb: debug [init_device] found 1 configurations (active conf: 3)
[ 1.356292] [00001464] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=3, 39 bytes)
[ 1.356292] [00001464] libusb: debug [init_device] (bus: 2, addr: 30, depth: 1, port: 7): '\\.\USB#VID_0525&PID_A4A4#5&11249855&0&7'
[ 1.357293] [00001464] libusb: debug [get_api_type] driver(s): HidUsb
[ 1.357293] [00001464] libusb: debug [get_api_type] matched driver name against HID API
[ 1.358294] [00001464] libusb: debug [windows_get_device_list] found existing device for session [29B] (2.3)
[ 1.358294] [00001464] libusb: debug [get_api_type] driver(s): usbccgp
[ 1.358294] [00001464] libusb: debug [get_api_type] matched driver name against Composite API
[ 1.358294] [00001464] libusb: debug [windows_get_device_list] found existing device for session [271] (2.2)
[ 1.358294] [00001464] libusb: debug [get_api_type] driver(s): libusb0
[ 1.359294] [00001464] libusb: debug [get_api_type] matched driver name against libusb0
[ 1.359294] [00001464] libusb: debug [windows_get_device_list] found existing device for session [A7] (2.30)
[ 1.359294] [00001464] libusb: debug [windows_get_device_list] setting HID interface for [29B]:
[ 1.359294] [00001464] libusb: debug [set_hid_interface] interface[0] = \\.\HID#VID_03F0&PID_094A#6&292C14BD&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 1.360295] [00001464] libusb: debug [get_api_type] driver(s): libusb0
[ 1.360295] [00001464] libusb: debug [get_api_type] matched driver name against libusb0
[ 1.360295] [00001464] libusb: debug [libusb_get_device_descriptor]
[ 1.360295] [00001464] libusb: debug [libusb_get_device_descriptor]
[ 1.361295] [00001464] libusb: debug [libusb_get_device_descriptor]
[ 1.361295] [00001464] libusb: debug [libusb_get_device_descriptor]
[ 1.361295] [00001464] libusb: debug [libusb_get_device_descriptor]
[ 1.361295] [00001464] libusb: debug [libusb_get_device_descriptor]
[ 1.361295] [00001464] libusb: debug [libusb_get_device_descriptor]
[ 1.361295] [00001464] libusb: debug [libusb_get_device_descriptor]
[ 1.362296] [00001464] libusb: debug [libusb_get_device_descriptor]
[ 1.362296] [00001464] libusb: debug [libusb_get_device_descriptor]
[ 1.362296] [00001464] libusb: debug [libusb_open] open 2.30
[ 1.362296] [00001464] libusb: debug [libusb_alloc_transfer] transfer 000002431533CF58
[ 1.362296] [00001464] libusb: debug [libusb_submit_transfer] transfer 000002431533CF58
[ 1.363297] [00001464] libusb: debug [libusb_claim_interface] interface 0
[ 1.363297] [00001464] libusb: debug [winusbx_claim_interface] claimed interface 0
[ 1.363297] [00001464] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 81 to interface 0
[ 1.363297] [00001464] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 02 to interface 0
[ 1.363297] [00001464] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 83 to interface 0
[ 1.364298] [00001464] libusb: debug [auto_claim] auto-claimed interface 0 for control request
[ 1.364298] [00001464] libusb: debug [winusbx_submit_control_transfer] will use interface 0
[ 1.662796] [00001464] libusb: debug [usbi_add_pollfd] add fd 1 events 1
[ 1.662796] [00001464] libusb: debug [libusb_get_next_timeout] next timeout in 0.699938s
[ 1.662796] [00001464] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.663796] [00001464] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.663796] [00001464] libusb: debug [handle_events] poll() 2 fds with timeout in 700ms
[ 1.663796] [00001464] libusb: debug [handle_events] poll() returned 1
[ 1.664797] [00001464] libusb: debug [windows_handle_events] checking fd 1 with revents = 0001
[ 1.664797] [00001464] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.664797] [00001464] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 0, size 255
[ 1.664797] [00001464] libusb: debug [libusb_release_interface] interface 0
[ 1.665802] [00001464] libusb: debug [auto_release] auto-released interface 0
[ 1.665802] [00001464] libusb: debug [usbi_handle_transfer_completion] transfer 000002431533CF58 has callback 00007FF695BA7B20
[ 1.665802] [00001464] libusb: debug [sync_transfer_cb] actual_length=255
[ 1.665802] [00001464] libusb: debug [libusb_free_transfer] transfer 000002431533CF58
[ 1.666797] [00001464] libusb: debug [libusb_alloc_transfer] transfer 000002431533CF58
[ 1.666797] [00001464] libusb: debug [libusb_submit_transfer] transfer 000002431533CF58
[ 1.666797] [00001464] libusb: debug [libusb_claim_interface] interface 0
[ 1.666797] [00001464] libusb: debug [winusbx_claim_interface] claimed interface 0
[ 1.666797] [00001464] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 81 to interface 0
[ 1.667798] [00001464] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 02 to interface 0
[ 1.667798] [00001464] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 83 to interface 0
[ 1.667798] [00001464] libusb: debug [auto_claim] auto-claimed interface 0 for control request
[ 1.667798] [00001464] libusb: debug [winusbx_submit_control_transfer] will use interface 0
[ 1.862685] [00001464] libusb: debug [usbi_add_pollfd] add fd 1 events 1
[ 1.863684] [00001464] libusb: debug [libusb_get_next_timeout] next timeout in 0.803178s
[ 1.863684] [00001464] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.863684] [00001464] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.864685] [00001464] libusb: debug [handle_events] poll() 2 fds with timeout in 804ms
[ 1.864685] [00001464] libusb: debug [handle_events] poll() returned 1
[ 1.864685] [00001464] libusb: debug [windows_handle_events] checking fd 1 with revents = 0001
[ 1.864685] [00001464] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.864685] [00001464] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 0, size 255
[ 1.865686] [00001464] libusb: debug [libusb_release_interface] interface 0
[ 1.865686] [00001464] libusb: debug [auto_release] auto-released interface 0
[ 1.865686] [00001464] libusb: debug [usbi_handle_transfer_completion] transfer 000002431533CF58 has callback 00007FF695BA7B20
[ 1.865686] [00001464] libusb: debug [sync_transfer_cb] actual_length=255
[ 1.865686] [00001464] libusb: debug [libusb_free_transfer] transfer 000002431533CF58
[ 1.865686] [00001464] libusb: debug [libusb_unref_device] destroy device 2.3
[ 1.866688] [00001464] libusb: debug [libusb_unref_device] destroy device 2.2
[ 1.866688] [00001464] libusb: debug [libusb_unref_device] destroy device 1.2
[ 1.866688] [00001464] libusb: debug [libusb_unref_device] destroy device 1.1
[ 1.866688] [00001464] libusb: debug [libusb_unref_device] destroy device 1.0
[ 1.866688] [00001464] libusb: debug [libusb_unref_device] destroy device 2.3
[ 1.867687] [00001464] libusb: debug [libusb_unref_device] destroy device 2.2
[ 1.867687] [00001464] libusb: debug [libusb_unref_device] destroy device 3.2
[ 1.867687] [00001464] libusb: debug [libusb_unref_device] destroy device 3.1
[ 1.867687] [00001464] libusb: debug [libusb_unref_device] destroy device 3.0
[ 1.867687] [00001464] libusb: debug [libusb_set_configuration] configuration 3
[ 1.868687] [00001464] libusb: debug [libusb_alloc_transfer] transfer 000002431533D7B8
[ 1.868687] [00001464] libusb: debug [libusb_submit_transfer] transfer 000002431533D7B8
[ 1.868687] [00001464] libusb: debug [libusb_claim_interface] interface 0
[ 1.868687] [00001464] libusb: debug [winusbx_claim_interface] claimed interface 0
[ 1.868687] [00001464] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 81 to interface 0
[ 1.868687] [00001464] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 02 to interface 0
[ 1.869688] [00001464] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 83 to interface 0
[ 1.869688] [00001464] libusb: debug [auto_claim] auto-claimed interface 0 for control request
[ 1.869688] [00001464] libusb: debug [winusbx_submit_control_transfer] will use interface 0
[ 1.869688] [00001464] libusb: debug [usbi_add_pollfd] add fd 1 events 1
[ 1.869688] [00001464] libusb: debug [libusb_get_next_timeout] next timeout in 0.998792s
[ 1.869688] [00001464] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.870688] [00001464] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.870688] [00001464] libusb: debug [handle_events] poll() 2 fds with timeout in 999ms
[ 1.870688] [00001464] libusb: debug [handle_events] poll() returned 1
[ 1.870688] [00001464] libusb: debug [windows_handle_events] checking fd 1 with revents = 0001
[ 1.870688] [00001464] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.871691] [00001464] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 0, size 0
[ 1.871691] [00001464] libusb: debug [libusb_release_interface] interface 0
[ 1.871691] [00001464] libusb: debug [auto_release] auto-released interface 0
[ 1.871691] [00001464] libusb: debug [usbi_handle_transfer_completion] transfer 000002431533D7B8 has callback 00007FF695BA7B20
[ 1.871691] [00001464] libusb: debug [sync_transfer_cb] actual_length=0
[ 1.871691] [00001464] libusb: debug [libusb_free_transfer] transfer 000002431533D7B8
[ 1.872690] [00001464] libusb: debug [libusb_claim_interface] interface 0
[ 1.872690] [00001464] libusb: debug [winusbx_claim_interface] claimed interface 0
[ 1.872690] [00001464] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 81 to interface 0
[ 1.872690] [00001464] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 02 to interface 0
[ 1.872690] [00001464] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 83 to interface 0
[ 1.873692] [00001464] libusb: debug [libusb_alloc_transfer] transfer 0000024315335478
[ 1.873692] [00001464] libusb: debug [libusb_submit_transfer] transfer 0000024315335478
[ 1.873692] [00001464] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 81 with interface 0
[ 1.873692] [00001464] libusb: debug [winusbx_submit_bulk_transfer] reading 64 bytes
[ 1.873692] [00001464] libusb: debug [usbi_add_pollfd] add fd 1 events 1
[ 1.873692] [00001464] libusb: debug [libusb_get_next_timeout] next timeout in 0.999396s
[ 1.874692] [00001464] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.874692] [00001464] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.874692] [00001464] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms
[ 1.874692] [00001464] libusb: debug [handle_events] poll() returned 1
[ 1.874692] [00001464] libusb: debug [windows_handle_events] checking fd 1 with revents = 0001
[ 1.875693] [00001464] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.875693] [00001464] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0
[ 1.875693] [00001464] libusb: debug [windows_transfer_callback] detected endpoint stall
[ 1.875693] [00001464] libusb: debug [usbi_handle_transfer_completion] transfer 0000024315335478 has callback 00007FF695BA7B20
[ 1.875693] [00001464] libusb: debug [sync_transfer_cb] actual_length=0
[ 1.875693] [00001464] libusb: debug [libusb_free_transfer] transfer 0000024315335478
[ 1.878695] [00001464] libusb: debug [libusb_alloc_transfer] transfer 0000024315335478
[ 1.878695] [00001464] libusb: debug [libusb_submit_transfer] transfer 0000024315335478
[ 1.878695] [00001464] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0
[ 1.878695] [00001464] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes
[ 1.879696] [00001464] libusb: debug [usbi_add_pollfd] add fd 1 events 4
[ 1.879696] [00001464] libusb: debug [libusb_get_next_timeout] next timeout in 0.999396s
[ 1.879696] [00001464] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.879696] [00001464] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.879696] [00001464] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms
[ 1.880696] [00001464] libusb: debug [handle_events] poll() returned 1
[ 1.880696] [00001464] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004
[ 1.880696] [00001464] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.880696] [00001464] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0
[ 1.880696] [00001464] libusb: debug [windows_transfer_callback] detected endpoint stall
[ 1.881697] [00001464] libusb: debug [usbi_handle_transfer_completion] transfer 0000024315335478 has callback 00007FF695BA7B20
[ 1.881697] [00001464] libusb: debug [sync_transfer_cb] actual_length=0
[ 1.881697] [00001464] libusb: debug [libusb_free_transfer] transfer 0000024315335478
[ 1.881697] [00001464] libusb: debug [libusb_clear_halt] endpoint 2
[ 1.881697] [00001464] libusb: debug [winusbx_clear_halt] matched endpoint 02 with interface 0
[ 1.882697] [00001464] libusb: debug [libusb_alloc_transfer] transfer 0000024315335478
[ 1.882697] [00001464] libusb: debug [libusb_submit_transfer] transfer 0000024315335478
[ 1.882697] [00001464] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0
[ 1.882697] [00001464] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes
[ 1.882697] [00001464] libusb: debug [usbi_add_pollfd] add fd 1 events 4
[ 1.883698] [00001464] libusb: debug [libusb_get_next_timeout] next timeout in 0.999396s
[ 1.883698] [00001464] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.883698] [00001464] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.883698] [00001464] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms
[ 1.883698] [00001464] libusb: debug [handle_events] poll() returned 1
[ 1.884699] [00001464] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004
[ 1.884699] [00001464] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.884699] [00001464] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0
[ 1.884699] [00001464] libusb: debug [windows_transfer_callback] detected endpoint stall
[ 1.884699] [00001464] libusb: debug [usbi_handle_transfer_completion] transfer 0000024315335478 has callback 00007FF695BA7B20
[ 1.884699] [00001464] libusb: debug [sync_transfer_cb] actual_length=0
[ 1.885700] [00001464] libusb: debug [libusb_free_transfer] transfer 0000024315335478
[ 1.885700] [00001464] libusb: debug [libusb_clear_halt] endpoint 2
[ 1.885700] [00001464] libusb: debug [winusbx_clear_halt] matched endpoint 02 with interface 0
[ 1.887701] [00001464] libusb: debug [libusb_alloc_transfer] transfer 0000024315335478
[ 1.887701] [00001464] libusb: debug [libusb_submit_transfer] transfer 0000024315335478
[ 1.887701] [00001464] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0
[ 1.887701] [00001464] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes
[ 1.888703] [00001464] libusb: debug [usbi_add_pollfd] add fd 1 events 4
[ 1.888703] [00001464] libusb: debug [libusb_get_next_timeout] next timeout in 0.999396s
[ 1.888703] [00001464] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.888703] [00001464] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.888703] [00001464] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms
[ 1.888703] [00001464] libusb: debug [handle_events] poll() returned 1
[ 1.889703] [00001464] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004
[ 1.889703] [00001464] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.889703] [00001464] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0
[ 1.889703] [00001464] libusb: debug [windows_transfer_callback] detected endpoint stall
[ 1.889703] [00001464] libusb: debug [usbi_handle_transfer_completion] transfer 0000024315335478 has callback 00007FF695BA7B20
[ 1.890703] [00001464] libusb: debug [sync_transfer_cb] actual_length=0
[ 1.890703] [00001464] libusb: debug [libusb_free_transfer] transfer 0000024315335478
[ 1.890703] [00001464] libusb: debug [libusb_clear_halt] endpoint 2
[ 1.890703] [00001464] libusb: debug [winusbx_clear_halt] matched endpoint 02 with interface 0
[ 1.892705] [00001464] libusb: debug [libusb_alloc_transfer] transfer 0000024315335478
[ 1.892705] [00001464] libusb: debug [libusb_submit_transfer] transfer 0000024315335478
[ 1.892705] [00001464] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0
[ 1.892705] [00001464] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes
[ 1.892705] [00001464] libusb: debug [usbi_add_pollfd] add fd 1 events 4
[ 1.893705] [00001464] libusb: debug [libusb_get_next_timeout] next timeout in 0.999396s
[ 1.893705] [00001464] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.893705] [00001464] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.893705] [00001464] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms
[ 1.893705] [00001464] libusb: debug [handle_events] poll() returned 1
[ 1.894706] [00001464] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004
[ 1.894706] [00001464] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.894706] [00001464] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0
[ 1.894706] [00001464] libusb: debug [windows_transfer_callback] detected endpoint stall
[ 1.894706] [00001464] libusb: debug [usbi_handle_transfer_completion] transfer 0000024315335478 has callback 00007FF695BA7B20
[ 1.894706] [00001464] libusb: debug [sync_transfer_cb] actual_length=0
[ 1.895707] [00001464] libusb: debug [libusb_free_transfer] transfer 0000024315335478
[ 1.895707] [00001464] libusb: debug [libusb_clear_halt] endpoint 2
[ 1.895707] [00001464] libusb: debug [winusbx_clear_halt] matched endpoint 02 with interface 0
[ 1.897708] [00001464] libusb: debug [libusb_alloc_transfer] transfer 0000024315335478
[ 1.897708] [00001464] libusb: debug [libusb_submit_transfer] transfer 0000024315335478
[ 1.897708] [00001464] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0
[ 1.898710] [00001464] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes
[ 1.898710] [00001464] libusb: debug [usbi_add_pollfd] add fd 1 events 4
[ 1.898710] [00001464] libusb: debug [libusb_get_next_timeout] next timeout in 0.999094s
[ 1.898710] [00001464] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.898710] [00001464] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.899710] [00001464] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms
[ 1.899710] [00001464] libusb: debug [handle_events] poll() returned 1
[ 1.899710] [00001464] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004
[ 1.900710] [00001464] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.900710] [00001464] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0
[ 1.900710] [00001464] libusb: debug [windows_transfer_callback] detected endpoint stall
[ 1.900710] [00001464] libusb: debug [usbi_handle_transfer_completion] transfer 0000024315335478 has callback 00007FF695BA7B20
[ 1.900710] [00001464] libusb: debug [sync_transfer_cb] actual_length=0
[ 1.901712] [00001464] libusb: debug [libusb_free_transfer] transfer 0000024315335478
[ 1.901712] [00001464] libusb: debug [libusb_clear_halt] endpoint 2
[ 1.901712] [00001464] libusb: debug [winusbx_clear_halt] matched endpoint 02 with interface 0
[ 1.902713] [00001464] libusb: debug [libusb_alloc_transfer] transfer 0000024315335478
[ 1.902713] [00001464] libusb: debug [libusb_submit_transfer] transfer 0000024315335478
[ 1.902713] [00001464] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0
[ 1.902713] [00001464] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes
[ 1.902713] [00001464] libusb: debug [usbi_add_pollfd] add fd 1 events 4
[ 1.903713] [00001464] libusb: debug [libusb_get_next_timeout] next timeout in 0.999396s
[ 1.903713] [00001464] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 1.903713] [00001464] libusb: debug [handle_events] poll fds modified, reallocating
[ 1.903713] [00001464] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms
[ 1.903713] [00001464] libusb: debug [handle_events] poll() returned 1
[ 1.904713] [00001464] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004
[ 1.904713] [00001464] libusb: debug [usbi_remove_pollfd] remove fd 1
[ 1.904713] [00001464] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0
[ 1.904713] [00001464] libusb: debug [windows_transfer_callback] detected endpoint stall
[ 1.904713] [00001464] libusb: debug [usbi_handle_transfer_completion] transfer 0000024315335478 has callback 00007FF695BA7B20
[ 1.904713] [00001464] libusb: debug [sync_transfer_cb] actual_length=0
[ 1.905714] [00001464] libusb: debug [libusb_free_transfer] transfer 0000024315335478

Kind Regards,
Christopher Flordeliza

-----Original Message-----
From: Christopher Flordeliza [mailto:***@nojapower.com.au]
Sent: Monday, 17 July 2017 4:25 PM
To: Pete Batard <***@akeo.ie>; libusb-***@lists.sourceforge.net
Subject: Re: [libusb] Unable to clear LIBUSB_ERROR_PIPE on first run after installing the device driver

Dear Pete,

1. 0525:A4A4 - According to http://www.linux-usb.org/usb.ids your device is a Netchip Technology 'Linux-USB user-mode bulk source/sink'... and from what you indicate, this appears to be a custom device. Can you tell us more about its purpose and the kind of features its firmware provides? What is this ultimately meant to be used for?

The device is an auto-recloser (basically a circuit braker that is capable of automatically closing a breaker openned by a fault condition). We are devolping an application that sends commands to this device via the USB.

2. I think we may have to clarify your statement that "(you) are using VFAT to mount the USB", because if your device provides a mass-storage layer, and you are therefore replacing the default mass-storage driver from Windows when you're installing libusb0.sys, you may be asking for trouble... But then again, I have very little idea what your device does or how it is meant to behave, so I may be off mark on that.

My mistake on this one, the device's firmware is using GadgetFs to read and write on the device endpoints. Device is running embedded linux (uCLinux/ColdFire). We send commands to the device via the USB.

3. As I tried to indicate in my previous e-mail (albeit in a manner that attempted to serve two purposes), please indicate what happens if you use WinUSB as a driver instead of libusb0/libusb-win32. When used against libusb, the libusb0 driver should be considered *unstable* and its use with libusb has actually been discouraged for some time. So if you are using the libusb0.sys/libusb-win32 driver, on account that it has "libusb" in its name, don't. The recommended driver to use with libusb is the WinUSB driver from Microsoft, which is the default choice of Zadig (for this very precise reason). So, once again, I will ask you to report what happens if you use WinUSB instead of libusb0.sys. Or you can also try with an USBDk enabled version of the library. Currently there are quite a few ways you can access devices with libusb, so if you encounter an issue, you should attempt to use a different access mode to better identify where the issue may be located. Oh, and for the record, LibUsbDotNet also supports WinUSB as its driver, so your other applications should not be impacted by this switch.

Yes you are right libusb0 is not recommended for libusb as stated in libusb wiki, unfortunately the original developer of the application we are now developing used libusb0 (no one knows what is the reason). I will talk to my superior to consider changing the driver to WinUsb. I tried using the WinUSB as you recommended and the stalled issue is not occurring (tested the other applications using WinUSB as driver, it seems they are functioning as expected). Based from this and what you said in this email and what is stated in the LibUsb wiki I think I have enough reason to ask my superiors to change the driver.

As requested, here is the log when using libusb0.sys.
[Program Output]
--------------- 000001 ---------------
2017.07.17 15:22:01 >> USB device ready for use!
Serial No: 0311213090240
Bus No: 2
Port No: 7
[WARNING] Endpoint (2) halted!
[WARNING] Endpoint (2) halted!
[WARNING] Endpoint (2) halted!
[WARNING] Endpoint (2) halted!
[WARNING] Endpoint (2) halted!
2017.07.17 15:22:01 >> [ERROR] Endpoint(2) is still halted after trying 5x to clear it

[LIBUSBDEBUG LOG]
[ 0.000000] [000000ec] libusb: debug [libusb_init] created default context [ 0.000000] [000000ec] libusb: debug [libusb_init] libusb v1.0.21.11156 [ 0.000000] [000000ec] libusb: debug [windows_init] Windows 8 64-bit [ 0.000000] [000000ec] libusb: debug [setup_cancel_io] Will use CancelIoEx for I/O cancellation
'listdevs.exe': Loaded 'C:\Windows\System32\cfgmgr32.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\ucrtbase.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\advapi32.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\sechost.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\ole32.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\combase.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\bcryptprimitives.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\gdi32.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\gdi32full.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\msvcp_win.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\user32.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\win32u.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\imm32.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\setupapi.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\libusbK.dll', Exports loaded.
[ 0.610809] [000000ec] libusb: debug [winusbx_init] using libusbK DLL for universal access [ 0.610809] [000000ec] libusb: debug [winusbx_init] libusbK version: 3.0.7.0
'listdevs.exe': Loaded 'C:\Windows\System32\wintrust.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\msasn1.dll', Exports loaded.
'listdevs.exe': Loaded 'C:\Windows\System32\crypt32.dll', Exports loaded.

AllK required contiguous memory = 534200 (64bit)
8 HotK Handles: HandleSize 2112 PoolSize 16912 (bytes)
64 LstK Handles: HandleSize 64 PoolSize 4112 (bytes)
1024 LstInfoK Handles: HandleSize 64 PoolSize 65552 (bytes)
64 UsbK Handles: HandleSize 96 PoolSize 6160 (bytes)
32 DevK Handles: HandleSize 112 PoolSize 3600 (bytes)
4096 OvlK Handles: HandleSize 104 PoolSize 426000 (bytes)
64 OvlPoolK Handles: HandleSize 96 PoolSize 6160 (bytes)
32 StmK Handles: HandleSize 176 PoolSize 5648 (bytes)

Dynamically allocated as needed:
KLST_DEVINFO = 2596 bytes each
[ 0.673319] [000000ec] libusb: debug [winusbx_init] initalized sub API libusbK [ 0.673319] [000000ec] libusb: debug [winusbx_init] initalized sub API libusb0
'listdevs.exe': Loaded 'C:\Windows\System32\winusb.dll', Exports loaded.
[ 0.688947] [000000ec] libusb: debug [winusbx_init] initalized sub API WinUSB
'listdevs.exe': Loaded 'C:\Windows\System32\hid.dll', Exports loaded.
[ 0.704575] [000000ec] libusb: debug [windows_init_clock] hires timer available (Frequency: 3312647 Hz) [ 0.704575] [000000ec] libusb: debug [windows_init_clock] timer thread will run on core #0 [ 0.704575] [000000ec] libusb: debug [htab_create] using 1021 entries hash table [ 0.704575] [000000ec] libusb: debug [usbi_add_pollfd] add fd 0 events 1 [ 0.704575] [000000ec] libusb: debug [libusb_get_device_list]
'listdevs.exe': Loaded 'C:\Windows\System32\devobj.dll', Exports loaded.
[ 0.720203] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [3DF] [ 0.720203] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [1EA] [ 0.720203] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [19D] [ 0.720203] [000000ec] libusb: debug [get_api_type] driver(s): usbhub [ 0.720203] [000000ec] libusb: debug [get_api_type] matched driver name against HUB API [ 0.720203] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [36E] [ 0.720203] [000000ec] libusb: debug [get_api_type] driver(s): USBHUB3 [ 0.720203] [000000ec] libusb: debug [get_api_type] matched driver name against HUB API [ 0.720203] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [174] [ 0.720203] [000000ec] libusb: debug [get_api_type] driver(s): usbhub [ 0.720203] [000000ec] libusb: debug [get_api_type] matched driver name against HUB API [ 0.720203] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [90] [ 0.720203] [000000ec] libusb: debug [get_api_type] driver(s): usbhub [ 0.720203] [000000ec] libusb: debug [get_api_type] matched driver name against HUB API [ 0.720203] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [358] [ 0.720203] [000000ec] libusb: debug [get_api_type] driver(s): usbhub [ 0.720203] [000000ec] libusb: debug [get_api_type] matched driver name against HUB API [ 0.720203] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [64] [ 0.720203] [000000ec] libusb: debug [windows_get_device_list] found existing device for session [90] (0.0) [ 0.735831] [000000ec] libusb: debug [init_device] (bus: 1, addr: 1, depth: 0, port: 0): '\\.\USB#ROOT_HUB20#4&13D5D5E&0'
[ 0.735831] [000000ec] libusb: debug [windows_get_device_list] found existing device for session [174] (0.0) [ 0.735831] [000000ec] libusb: debug [init_device] (bus: 2, addr: 1, depth: 0, port: 0): '\\.\USB#ROOT_HUB30#4&2109F25B&0&0'
[ 0.735831] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [276] [ 0.735831] [000000ec] libusb: debug [init_device] found 1 configurations (active conf: 1) [ 0.735831] [000000ec] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 34 bytes) [ 0.735831] [000000ec] libusb: debug [init_device] (bus: 2, addr: 3, depth: 1, port: 4): '\\.\USB#VID_03F0&PID_034A&MI_01#6&31180F1&0&0001'
[ 0.735831] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [1D6] [ 0.735831] [000000ec] libusb: debug [init_device] found 1 configurations (active conf: 1) [ 0.735831] [000000ec] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 59 bytes) [ 0.735831] [000000ec] libusb: debug [init_device] (bus: 2, addr: 2, depth: 1, port: 3): '\\.\USB#VID_03F0&PID_034A&MI_00#6&31180F1&0&0000'
[ 0.735831] [000000ec] libusb: debug [windows_get_device_list] found existing device for session [36E] (0.0) [ 0.800736] [000000ec] libusb: debug [init_device] found 1 configurations (active conf: 1) [ 0.800736] [000000ec] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 25 bytes) [ 0.800736] [000000ec] libusb: debug [init_device] (bus: 1, addr: 2, depth: 1, port: 1): '\\.\USB#VID_8087&PID_8008#5&323647F0&4&1'
[ 0.800736] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [29B] [ 0.800736] [000000ec] libusb: debug [init_device] found 1 configurations (active conf: 1) [ 0.800736] [000000ec] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 34 bytes) [ 0.800736] [000000ec] libusb: debug [init_device] (bus: 2, addr: 3, depth: 1, port: 4): '\\.\USB#VID_03F0&PID_094A#5&11249855&0&4'
[ 0.800736] [000000ec] libusb: debug [windows_get_device_list] found existing device for session [64] (0.0) [ 0.800736] [000000ec] libusb: debug [init_device] (bus: 3, addr: 1, depth: 0, port: 0): '\\.\USB#ROOT_HUB20#4&3CF1FE8&0'
[ 0.800736] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [271] [ 0.800736] [000000ec] libusb: debug [init_device] found 1 configurations (active conf: 1) [ 0.800736] [000000ec] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 59 bytes) [ 0.800736] [000000ec] libusb: debug [init_device] (bus: 2, addr: 2, depth: 1, port: 3): '\\.\USB#VID_03F0&PID_034A#5&11249855&0&3'
[ 0.800736] [000000ec] libusb: debug [windows_get_device_list] found existing device for session [358] (0.0) [ 0.867266] [000000ec] libusb: debug [init_device] found 1 configurations (active conf: 1) [ 0.867266] [000000ec] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 25 bytes) [ 0.867266] [000000ec] libusb: debug [init_device] (bus: 3, addr: 2, depth: 1, port: 1): '\\.\USB#VID_8087&PID_8000#5&37AE6513&4&1'
[ 0.867266] [000000ec] libusb: debug [discovered_devs_append] need to increase capacity [ 0.867266] [000000ec] libusb: debug [windows_get_device_list] extra GUID: {4B384764-BE4F-246C-A848-4F338F96A2C8}
[ 0.867266] [000000ec] libusb: debug [windows_get_device_list] allocating new device for session [A7] [ 0.867266] [000000ec] libusb: debug [init_device] found 1 configurations (active conf: 3) [ 0.867266] [000000ec] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=3, 39 bytes) [ 0.867266] [000000ec] libusb: debug [init_device] (bus: 2, addr: 24, depth: 1, port: 7): '\\.\USB#VID_0525&PID_A4A4#5&11249855&0&7'
[ 0.867266] [000000ec] libusb: debug [get_api_type] driver(s): HidUsb [ 0.867266] [000000ec] libusb: debug [get_api_type] matched driver name against HID API [ 0.867266] [000000ec] libusb: debug [windows_get_device_list] found existing device for session [29B] (2.3) [ 0.867266] [000000ec] libusb: debug [get_api_type] driver(s): usbccgp [ 0.867266] [000000ec] libusb: debug [get_api_type] matched driver name against Composite API [ 0.867266] [000000ec] libusb: debug [windows_get_device_list] found existing device for session [271] (2.2) [ 0.867266] [000000ec] libusb: debug [get_api_type] driver(s): libusb0 [ 0.867266] [000000ec] libusb: debug [get_api_type] matched driver name against libusb0 [ 0.867266] [000000ec] libusb: debug [windows_get_device_list] found existing device for session [A7] (2.24) [ 0.867266] [000000ec] libusb: debug [windows_get_device_list] setting HID interface for [29B]:
[ 0.867266] [000000ec] libusb: debug [set_hid_interface] interface[0] = \\.\HID#VID_03F0&PID_094A#6&292C14BD&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.867266] [000000ec] libusb: debug [get_api_type] driver(s): libusb0 [ 0.867266] [000000ec] libusb: debug [get_api_type] matched driver name against libusb0 [ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor] [ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor] [ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor] [ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor] [ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor] [ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor] [ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor] [ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor] [ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor] [ 0.867266] [000000ec] libusb: debug [libusb_get_device_descriptor] [ 0.867266] [000000ec] libusb: debug [libusb_open] open 2.24 [ 0.867266] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C84309CF58 [ 0.867266] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C84309CF58 [ 0.867266] [000000ec] libusb: debug [libusb_claim_interface] interface 0 [ 0.867266] [000000ec] libusb: debug [winusbx_claim_interface] claimed interface 0 [ 0.867266] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 81 to interface 0 [ 0.867266] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 02 to interface 0 [ 0.867266] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 83 to interface 0 [ 0.867266] [000000ec] libusb: debug [auto_claim] auto-claimed interface 0 for control request [ 0.867266] [000000ec] libusb: debug [winusbx_submit_control_transfer] will use interface 0 [ 1.101426] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 1 [ 1.101426] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.773595s [ 1.101426] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling [ 1.101426] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating [ 1.101426] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 774ms [ 1.101426] [000000ec] libusb: debug [handle_events] poll() returned 1 [ 1.101426] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0001 [ 1.101426] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1 [ 1.101426] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 0, size 255 [ 1.101426] [000000ec] libusb: debug [libusb_release_interface] interface 0 [ 1.101426] [000000ec] libusb: debug [auto_release] auto-released interface 0 [ 1.101426] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C84309CF58 has callback 00007FF68A7B7A50 [ 1.101426] [000000ec] libusb: debug [sync_transfer_cb] actual_length=255 [ 1.101426] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C84309CF58 [ 1.101426] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C84309CF58 [ 1.101426] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C84309CF58 [ 1.101426] [000000ec] libusb: debug [libusb_claim_interface] interface 0 [ 1.101426] [000000ec] libusb: debug [winusbx_claim_interface] claimed interface 0 [ 1.101426] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 81 to interface 0 [ 1.101426] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 02 to interface 0 [ 1.101426] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 83 to interface 0 [ 1.101426] [000000ec] libusb: debug [auto_claim] auto-claimed interface 0 for control request [ 1.101426] [000000ec] libusb: debug [winusbx_submit_control_transfer] will use interface 0 [ 1.303961] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 1 [ 1.303961] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.801171s [ 1.303961] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling [ 1.303961] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating [ 1.303961] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 802ms [ 1.303961] [000000ec] libusb: debug [handle_events] poll() returned 1 [ 1.303961] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0001 [ 1.303961] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1 [ 1.303961] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 0, size 255 [ 1.303961] [000000ec] libusb: debug [libusb_release_interface] interface 0 [ 1.303961] [000000ec] libusb: debug [auto_release] auto-released interface 0 [ 1.303961] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C84309CF58 has callback 00007FF68A7B7A50 [ 1.303961] [000000ec] libusb: debug [sync_transfer_cb] actual_length=255 [ 1.303961] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C84309CF58 [ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 2.3 [ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 2.2 [ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 1.2 [ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 1.1 [ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 1.0 [ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 2.3 [ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 2.2 [ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 3.2 [ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 3.1 [ 1.303961] [000000ec] libusb: debug [libusb_unref_device] destroy device 3.0 [ 1.303961] [000000ec] libusb: debug [libusb_set_configuration] configuration 3 [ 1.303961] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C84309D7B8 [ 1.303961] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C84309D7B8 [ 1.303961] [000000ec] libusb: debug [libusb_claim_interface] interface 0 [ 1.303961] [000000ec] libusb: debug [winusbx_claim_interface] claimed interface 0 [ 1.303961] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 81 to interface 0 [ 1.303961] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 02 to interface 0 [ 1.303961] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 83 to interface 0 [ 1.303961] [000000ec] libusb: debug [auto_claim] auto-claimed interface 0 for control request [ 1.303961] [000000ec] libusb: debug [winusbx_submit_control_transfer] will use interface 0 [ 1.303961] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 1 [ 1.303961] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.998490s [ 1.303961] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling [ 1.303961] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating [ 1.303961] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 999ms [ 1.303961] [000000ec] libusb: debug [handle_events] poll() returned 1 [ 1.303961] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0001 [ 1.303961] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1 [ 1.303961] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 0, size 0 [ 1.303961] [000000ec] libusb: debug [libusb_release_interface] interface 0 [ 1.303961] [000000ec] libusb: debug [auto_release] auto-released interface 0 [ 1.303961] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C84309D7B8 has callback 00007FF68A7B7A50 [ 1.303961] [000000ec] libusb: debug [sync_transfer_cb] actual_length=0 [ 1.303961] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C84309D7B8 [ 1.303961] [000000ec] libusb: debug [libusb_claim_interface] interface 0 [ 1.303961] [000000ec] libusb: debug [winusbx_claim_interface] claimed interface 0 [ 1.303961] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 81 to interface 0 [ 1.303961] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 02 to interface 0 [ 1.303961] [000000ec] libusb: debug [windows_assign_endpoints] (re)assigned endpoint 83 to interface 0 [ 1.303961] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C843095478 [ 1.303961] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C843095478 [ 1.303961] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 81 with interface 0 [ 1.303961] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] reading 64 bytes [ 1.303961] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 1 [ 1.303961] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.999094s [ 1.303961] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling [ 1.303961] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating [ 1.303961] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms [ 1.303961] [000000ec] libusb: debug [handle_events] poll() returned 1 [ 1.319589] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0001 [ 1.319589] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1 [ 1.319589] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0 [ 1.319589] [000000ec] libusb: debug [windows_transfer_callback] detected endpoint stall [ 1.319589] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C843095478 has callback 00007FF68A7B7A50 [ 1.319589] [000000ec] libusb: debug [sync_transfer_cb] actual_length=0 [ 1.319589] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C843095478 [ 1.319589] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C843095478 [ 1.319589] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C843095478 [ 1.319589] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0 [ 1.319589] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes [ 1.319589] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 4 [ 1.319589] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.999094s [ 1.319589] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling [ 1.319589] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating [ 1.319589] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms [ 1.319589] [000000ec] libusb: debug [handle_events] poll() returned 1 [ 1.319589] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004 [ 1.319589] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1 [ 1.319589] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0 [ 1.319589] [000000ec] libusb: debug [windows_transfer_callback] detected endpoint stall [ 1.319589] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C843095478 has callback 00007FF68A7B7A50 [ 1.319589] [000000ec] libusb: debug [sync_transfer_cb] actual_length=0 [ 1.319589] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C843095478 [ 1.319589] [000000ec] libusb: debug [libusb_clear_halt] endpoint 2 [ 1.319589] [000000ec] libusb: debug [winusbx_clear_halt] matched endpoint 02 with interface 0 [ 1.319589] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C843095478 [ 1.319589] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C843095478 [ 1.319589] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0 [ 1.319589] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes [ 1.319589] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 4 [ 1.319589] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.999094s [ 1.319589] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling [ 1.319589] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating [ 1.319589] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms [ 1.319589] [000000ec] libusb: debug [handle_events] poll() returned 1 [ 1.319589] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004 [ 1.319589] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1 [ 1.319589] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0 [ 1.319589] [000000ec] libusb: debug [windows_transfer_callback] detected endpoint stall [ 1.319589] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C843095478 has callback 00007FF68A7B7A50 [ 1.319589] [000000ec] libusb: debug [sync_transfer_cb] actual_length=0 [ 1.319589] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C843095478 [ 1.319589] [000000ec] libusb: debug [libusb_clear_halt] endpoint 2 [ 1.319589] [000000ec] libusb: debug [winusbx_clear_halt] matched endpoint 02 with interface 0 [ 1.335218] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C843095478 [ 1.335218] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C843095478 [ 1.335218] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0 [ 1.335218] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes [ 1.335218] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 4 [ 1.335218] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.998490s [ 1.335218] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling [ 1.335218] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating [ 1.335218] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 999ms [ 1.335218] [000000ec] libusb: debug [handle_events] poll() returned 1 [ 1.335218] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004 [ 1.335218] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1 [ 1.335218] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0 [ 1.335218] [000000ec] libusb: debug [windows_transfer_callback] detected endpoint stall [ 1.335218] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C843095478 has callback 00007FF68A7B7A50 [ 1.335218] [000000ec] libusb: debug [sync_transfer_cb] actual_length=0 [ 1.335218] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C843095478 [ 1.335218] [000000ec] libusb: debug [libusb_clear_halt] endpoint 2 [ 1.335218] [000000ec] libusb: debug [winusbx_clear_halt] matched endpoint 02 with interface 0 [ 1.335218] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C843095478 [ 1.335218] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C843095478 [ 1.335218] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0 [ 1.335218] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes [ 1.335218] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 4 [ 1.335218] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.999396s [ 1.335218] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling [ 1.335218] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating [ 1.335218] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms [ 1.335218] [000000ec] libusb: debug [handle_events] poll() returned 1 [ 1.335218] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004 [ 1.335218] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1 [ 1.335218] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0 [ 1.335218] [000000ec] libusb: debug [windows_transfer_callback] detected endpoint stall [ 1.335218] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C843095478 has callback 00007FF68A7B7A50 [ 1.335218] [000000ec] libusb: debug [sync_transfer_cb] actual_length=0 [ 1.335218] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C843095478 [ 1.335218] [000000ec] libusb: debug [libusb_clear_halt] endpoint 2 [ 1.335218] [000000ec] libusb: debug [winusbx_clear_halt] matched endpoint 02 with interface 0 [ 1.335218] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C843095478 [ 1.335218] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C843095478 [ 1.335218] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0 [ 1.335218] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes [ 1.335218] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 4 [ 1.335218] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.999397s [ 1.335218] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling [ 1.335218] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating [ 1.335218] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms [ 1.335218] [000000ec] libusb: debug [handle_events] poll() returned 1 [ 1.335218] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004 [ 1.335218] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1 [ 1.335218] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0 [ 1.335218] [000000ec] libusb: debug [windows_transfer_callback] detected endpoint stall [ 1.335218] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C843095478 has callback 00007FF68A7B7A50 [ 1.335218] [000000ec] libusb: debug [sync_transfer_cb] actual_length=0 [ 1.335218] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C843095478 [ 1.335218] [000000ec] libusb: debug [libusb_clear_halt] endpoint 2 [ 1.335218] [000000ec] libusb: debug [winusbx_clear_halt] matched endpoint 02 with interface 0 [ 1.350845] [000000ec] libusb: debug [libusb_alloc_transfer] transfer 000002C843095478 [ 1.350845] [000000ec] libusb: debug [libusb_submit_transfer] transfer 000002C843095478 [ 1.350845] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 02 with interface 0 [ 1.350845] [000000ec] libusb: debug [winusbx_submit_bulk_transfer] writing 24 bytes [ 1.350845] [000000ec] libusb: debug [usbi_add_pollfd] add fd 1 events 4 [ 1.350845] [000000ec] libusb: debug [libusb_get_next_timeout] next timeout in 0.999396s [ 1.350845] [000000ec] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling [ 1.350845] [000000ec] libusb: debug [handle_events] poll fds modified, reallocating [ 1.350845] [000000ec] libusb: debug [handle_events] poll() 2 fds with timeout in 1000ms [ 1.350845] [000000ec] libusb: debug [handle_events] poll() returned 1 [ 1.350845] [000000ec] libusb: debug [windows_handle_events] checking fd 1 with revents = 0004 [ 1.350845] [000000ec] libusb: debug [usbi_remove_pollfd] remove fd 1 [ 1.350845] [000000ec] libusb: debug [windows_transfer_callback] handling I/O completion with errcode 31, size 0 [ 1.350845] [000000ec] libusb: debug [windows_transfer_callback] detected endpoint stall [ 1.350845] [000000ec] libusb: debug [usbi_handle_transfer_completion] transfer 000002C843095478 has callback 00007FF68A7B7A50 [ 1.350845] [000000ec] libusb: debug [sync_transfer_cb] actual_length=0 [ 1.350845] [000000ec] libusb: debug [libusb_free_transfer] transfer 000002C843095478

Thank you very much for your and the communities support and time, we appreciated it very much.

Kindest Regards,

Christopher

-----Original Message-----
From: Pete Batard [mailto:***@akeo.ie]
Sent: Monday, 17 July 2017 11:34 AM
To: libusb-***@lists.sourceforge.net
Subject: Re: [libusb] Unable to clear LIBUSB_ERROR_PIPE on first run after installing the device driver

Hi Christopher,

A debug log would have been nice. Since you have control over the app, you can produce debug logging, which can be invaluable in identifying issues.

But anyway, here's what I'd like to point out (without even taking a look at your code, as I don't think I'll ever have time to properly look at it).

1. 0525:A4A4 - According to http://www.linux-usb.org/usb.ids your device is a Netchip Technology 'Linux-USB user-mode bulk source/sink'... and from what you indicate, this appears to be a custom device. Can you tell us more about its purpose and the kind of features its firmware provides? What is this ultimately meant to be used for?

2. I think we may have to clarify your statement that "(you) are using VFAT to mount the USB", because if your device provides a mass-storage layer, and you are therefore replacing the default mass-storage driver from Windows when you're installing libusb0.sys, you may be asking for trouble... But then again, I have very little idea what your device does or how it is meant to behave, so I may be off mark on that.

3. As I tried to indicate in my previous e-mail (albeit in a manner that attempted to serve two purposes), please indicate what happens if you use WinUSB as a driver instead of libusb0/libusb-win32. When used against libusb, the libusb0 driver should be considered *unstable* and its use with libusb has actually been discouraged for some time. So if you are using the libusb0.sys/libusb-win32 driver, on account that it has "libusb" in its name, don't. The recommended driver to use with libusb is the WinUSB driver from Microsoft, which is the default choice of Zadig (for this very precise reason). So, once again, I will ask you to report what happens if you use WinUSB instead of libusb0.sys. Or you can also try with an USBDk enabled version of the library. Currently there are quite a few ways you can access devices with libusb, so if you encounter an issue, you should attempt to use a different access mode to better identify where the issue may be located. Oh, and for the record, LibUsbDotNet also supports WinUSB as its driver, so your other applications should not be impacted by this switch.

4. Also, as I tried to point out, can you please test with the xusb sample application and report what you get? Something like 'xusb -d 0525:A4A4' (which produces debug output) may help tell us more...

Regards,

/Pete


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________
libusb-devel mailing list
libusb-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________
libusb-devel mailing list
libusb-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Pete Batard
2017-07-17 11:05:39 UTC
Permalink
Post by Christopher Flordeliza
I tried using the WinUSB as you recommended and the stalled issue is not occurring
Okay.
Post by Christopher Flordeliza
(tested the other applications using WinUSB as driver, it seems they are functioning as expected).
Before switching to WinUSB, you may want to have a look at the WinUSB
limitations as per
https://github.com/libusb/libusb/wiki/Windows#Known_Restrictions.

If you think they could impact your needs, you may also try to use Usbdk
as the access layer (which also has the advantage of not requiring a
driver installation). Or you can also try to use LibusbK, which is the
driver that was developed alongside LibUsbDotNet as it may also be a
better fit for you.

At this stage, because the libusb0.sys driver is being obsoleted, I'm
not planning to investigate the cause of the stall you observed with it.
But if someone else on this list wants to do so, they're very welcome to
go ahead.

Regards,

/Pete
Xiaofan Chen
2017-07-17 11:55:52 UTC
Permalink
On Mon, Jul 17, 2017 at 2:25 PM, Christopher Flordeliza
Post by Christopher Flordeliza
Yes you are right libusb0 is not recommended for libusb as
stated in libusb wiki, unfortunately the original developer of the
application we are now developing used libusb0 (no one knows
what is the reason). I will talk to my superior to consider changing
the driver to WinUsb. I tried using the WinUSB as you recommended
and the stalled issue is not occurring (tested the other applications
using WinUSB as driver, it seems they are functioning as expected).
Based from this and what you said in this email and what is stated
in the LibUsb wiki I think I have enough reason to ask my
superiors to change the driver.
For others: here are the relevant info.
1) libusb Windows backend Wiki page
https://github.com/libusb/libusb/wiki/Windows#How_to_use_libusb_on_Windows

2) FAQ page
https://github.com/libusb/libusb/wiki/FAQ#libusbwin32_libusbK_and_libusb_project

3) Ticket for libusb0.sys
https://github.com/libusb/libusb/issues/94

Moreover, even though I would not say libusb-win32 project is
dead -- people are still using it and I still provide very limited support
in the mailing list when I can, but it is really not going to be
enhanced any more and I do not see much reasons to use
it for new projects. Even for libusbK, it has not been updated
for quite a while. So WinUSB or usbdk should be the preferred
driver to use for libusb Windows.

In the OP's case, since the other application is using libusbdotnet,
then WinUSB is the way to go.


Regards,
Xiaofan

Loading...