dorssel / usbipd-win

Windows software for sharing locally connected USB devices to other machines, including Hyper-V guests and WSL 2.
GNU General Public License v3.0
3.3k stars 203 forks source link

Dropped bulk transfer ZLP writes through WSL2 #924

Open kairotronix opened 2 months ago

kairotronix commented 2 months ago

I recently spent time reverse engineering the USB protocol for some test equipment so I could control it via Linux.

The protocol in question has the host send a command word through a bulk endpoint, then the host sends a zero length packet through the same endpoint so the device knows to begin processing what is in the buffer.

After emulating the protocol above in PyUSB the device would work in Windows while overwriting the libusb driver, and it would work in native Linux, but it would not work in Windows using USB passthrough to WSL2.

I used Wireshark to analyze the USB packets and noticed that the zero length packets were being dropped when the device was being forwarded to WSL2.

I am not certain it is a usbipd issue, but it seems plausible.

dorssel commented 2 months ago

Can you make a capture following https://github.com/dorssel/usbipd-win/wiki/Troubleshooting#usb-capture? And perhaps (considering you seem to know what you are doing) simultaneously a WSL-side USB capture (see https://github.com/dorssel/usbipd-win/issues/300#issuecomment-1066104831)?

kairotronix commented 2 months ago

I can do the USB capture when I get access to the hardware again on Monday. Unsure if I will have time to do the WSL-side, unfortunately.