usbipd detach doesn't exit properly #11366
Replies: 1 comment
-
At the suggestion of @dorssel, I tried installing linux-tools-virtual. The result is below. I've been down this road and I have noticed that I'm not alone.
Those packages don't exist, which is why I requested that the WSL team build whatever package provides usbip. |
Beta Was this translation helpful? Give feedback.
-
Hi All,
I'm using github.com/dorssel/usbipd-win with WSL2 and Ubuntu 22.04 on a desktop computer running Windows 10 22H2. Everything is up-to-date.
My usecase for usbipd-win requires the USB device to be attached before a service in default.target starts. I'm trying to write a systemd service to attach the device. I've never done this before, but it seems simple enough. I need the service to support start, stop and restart.
"sudo systemctl start usbipd-win.service" will attach the device
"sudo systemctl stop usbipd-win.service" will detach the device
"sudo systemctl restart usbipd-win.service" will detach and attach the device
Here are the commands I'm using for attaching and detaching the USB device:
systemctl start usbipd-win.service works properly
systemctl stop usbipd-win.service works properly
systemctl restart usbipd-win.service works results in this error:
In order to find out what the problem is, I executed the commands in a batch file on windows. What I found is that usbipd detach doesn't exit properly if a device was attached. When the usbipd attach command executes after the usbipd detach command it doesn't work properly.
It generates the following error:
usbipd: error: There is no device with busid '4-4'.
(busid 4-4 is the actual busid of the particular device I'm testing with.)
The behaviour is exactly the same if I execute usbipd detach on Windows or usbipd.exe detach in bash on Linux.
If I run a stand-alone usbipd detach command, it displays a windows command prompt, but the command prompt isn't working properly. For example, I can't up or down arrow to rerun a command, even if I enter CTRL-C to force an exit. I found that by clicking the mouse in the window, it seems to exit, after which I can up or down arrow the command line and then I can enter another command.
I tried using both wait and sleep in the bash script and neither worked. The command prompt was always hung until I did a mouse click in the window.
I also made a windows batch file and tried putting a timeout after the usbipd detach and it didn't reliably make any difference.
This points to usbipd detach not exiting properly. However, I posted in github.com/dorssel/usbipd-win/discussions and he says nothing is wrong.
Does anyone know of a work-around that I can use in bash?
I was wondering about trying native usbipd in linux, but I can't locate a version of the linux-tools package that is built for WSL2.
Any suggestions will be appreciated.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions