a1ien/rusb

Resending data is a problem

Closed this issue · 3 comments

Ksiw commented

good day ! I'm making an arbitrary HID device on a microcontroller, and I needed a program to test packet reception and transmission. In fact, the task is to transmit an arbitrary array of bytes in both directions. I did a cyclic sending of data from the controller to the host, and using the example read_device.rs I receive and send data on the host. Reception works fine, however, the host (win 11) sends the array only 1 time, the second time in the file usb-0.9.1\src\device_handle.rs the kernel_driver_active(&self, iface: u8) function returns error (53) LIBUSB_ERROR_NOT_SUPPORTED. The problem is fixed by restarting the controller, or disconnecting it and then connecting it to the host, which suggests that the controller is working correctly. Restarting the test program does not fix the problem. The problem looks like an active connection remains at the libusb level, and it does not allow you to connect again for sending. Please any help

a1ien commented

You need call detach_kernel_driver only once.

Ksiw commented

You need call detach_kernel_driver only once.

  • kernel driver? false

Thank you for the prompt response. It turns out that the example is somewhat incorrect, since it leaves the connection open. Please correct if possible.

a1ien commented

What you men by leaves the connection open?