cezanne / usbip-win

USB/IP for Windows
GNU General Public License v3.0
1.95k stars 351 forks source link

attach_ude multiple clients? #191

Closed k9bbzJavftZaqAqSW3dY closed 3 years ago

k9bbzJavftZaqAqSW3dY commented 4 years ago

Hi, absolutely wonderful program, since long I have tried to get this working with Windows, and Cezanne cracked the case! :) :1st_place_medal:

I have tried to attach multiple devices, hosted on a raspberry pi, to a windows client. From another thread in this issue list, I've seen that the attach_ude command is blocking, but when I open another terminal to attach another device, I get error messages. Is there a way to use multiple devices with a Windows client? Maybe the device driver can be written with a different serial number and launched from another copy of usbip.exe in a separate folder, so that I can fully parallelize it? I'd be willing to tinker, but have no experience with device drivers... Let me know if I can make it work some way.

Kind regards

cezanne commented 4 years ago

@k9bbzJavftZaqAqSW3dY : Multiple clients via each attach command should be supported. But I had not checked that multiple attach_ude commands are working. I'll try. Can you share your error message?

cezanne commented 4 years ago

@k9bbzJavftZaqAqSW3dY : I have checked that attach_ude is not working with multiple clients. The log below shows the case.

C:\work>usbip --debug attach_ude -r 192.168.12.172 -b 1-1
usbip: debug: C:\work\usbip-win\userspace\src\usbip\usbip.c:171:[run_command] running command: `attach_ude'

usbip: debug: C:\work\usbip-win\userspace\src\usbip\usbip_vhci.c:60:[usbip_vhci_driver_open] device path: \\?\root#usb#0000#{d35f7840-6a0c-11d2-b841-00c04fad5171}
usbip: debug: C:\work\usbip-win\userspace\src\usbip\usbip_attach_ude.c:58:[import_device] got free port 1
usbip: error: usbip_vhci_attach_device: DeviceIoControl failed: err: 0xb7
usbip: error: import device
usbip: error: read_devbuf: failed to read: err: 0x6

This is due to the bug that vhci(ude) does not track attached devices. :cry:

k9bbzJavftZaqAqSW3dY commented 4 years ago

Thanks for checking. I'm having other computer problems at the moment, which is why I couldn't constructively follow up on this issue!

cezanne commented 4 years ago

This is due to the bug that vhci(ude) does not track attached devices

This comment is not correct. Please check 97964cb0e79690cc5243d3769e46b6174b0dc357, which can resolve this issue.

koudis commented 4 years ago

I can confirm that UDE version works wirth more then one USB Storage device at once.

But once for one minute I got restart - soo all devices are stopped and initialized again. It happens if I attach USb Serial and USB drives. USB drives has no problem, but USB serial cause restart once a minute.

cezanne commented 4 years ago

@koudis : I tried several tests similar to your environment. Two devices(USB stick and USB mouse) were working without disconnection or restart during 5 minutes. Can you explain more about your test?

koudis commented 3 years ago

@cezanne sorry for late answer. I was ill and we had lot of work so i had no time for myself.

I will try. I will try it again with newest UDE driver and if problem persist I will provide more detailed description.

sq2jul commented 3 years ago

@cezanne I'm currently testing this great piece of software and fall into the same problem - attaching multiple remote devices in the same time. I'm not familiar with Microsoft build stack. Would you be so nice to provide binary version with this patch included for testing purposes?

cezanne commented 3 years ago

@sq2jul :

Would you be so nice to provide binary version with this patch included for testing purposes?

Here it is; binaries for 97964cb commit. (x64 debug build)

sq2jul commented 3 years ago

I did some tests. For simple devices like usb serial port or keyboard I was able to attach multiple devices in the same time. Works like a charm! Thanks. I tried with USB sound card too but it works partially. Sound card device attached in windows system, but i was not able to force windows to play any sound through it.

I have two questions:

Thank you for doing great job! Juliusz

cezanne commented 3 years ago

@sq2jul :

  • Is it normal behavior that 'usbip attach_ude ...' occupies terminal all the time and the only way to 'detach' and return to the prompt is by pressing ctrl+c?

Yes. usbip.exe should run while a device is attached. Its limitation is different from linux version.

  • Is there any chance for 'multiple devices attached in the same time' feature in main release any time soon?

I hope so. But a UDE vhci still has problems for other than a simple USB device.

sq2jul commented 3 years ago

I don't have experience in development under MS os, but I'm eager to test. I'm in possession of few devices:

If you need any test in regards of those devices do not hesitate to ping me. I'm able to test Windows as a client and raspberry pi at Raspbian as a server for usb devices.