Closed fpschrisiom closed 6 months ago
leaving out the "wsl" option worked for me. I.e.: PS C:> usbipd list hope this helps :)
Works indeed, but the docs on the referenced page still uses the wsl subcommand.
I also encountered this problem, may I ask how to solve, the command must be added 'wsl', for wsl to access usb devices
Hi. Found a solution: The latest usbipd-win4.0.0 version reported an error under the window shell, unable to add the 'wsl' parameter, so that wsl can access usb devices. If it is replaced with 3.10, no error is reported. https://learn.microsoft.com/windows/wsl/connect-usb#attach-a-usb-device :The document mentions that downloading the latest version of usbipd-win requires corrections
Hi, here is my complete solution on how to forward a USB port to WSL2, using the latest usbipd-win. Note that my use-case is connecting to an rplidar fromSlamtec, which uses a Silicon Labs CP210x USB-to-serial Interface board to connect to the actual Lidar device.
Purpose: make USB to Serial Bridge accessible in WSL2 to test the RPLidar SDK build on WSL Linux (Ubuntu)
Install usbipd-win on the Windows-host: https://github.com/dorssel/usbipd-win/releases
Install USBIP tools and hardware-database in Linux (WSL)
bernd@myOmen:\~$ sudo apt install linux-tools-generic hwdata
bernd@myOmen:\~$ sudo update-alternatives --install /usr/local/bin/usbip usbip /usr/lib/linux-tools/*-generic/usbip 20
Open Powershell (Administrator)
PS C:\WINDOWS\system32> usbipd list
Output:
BUSID VID:PID DEVICE STATE
2-2 10c4:ea60 Silicon Labs CP210x USB to UART Bridge (COM3) Not shared
2-6 30c9:0069 HP Wide Vision HD Camera, Camera DFU Device Not shared
2-8 0461:4f03 USB Input Device Not shared
2-10 8087:0033 Intel(R) Wireless Bluetooth(R) Not shared
3-2 046d:081b Logi C310 HD WebCam Not shared
4-1 05a7:1020 Bose USB Audio, USB Input Device Not shared
4-2 046d:c52b Logitech USB Input Device, USB Input Device Not shared
4-3 04e8:329f Samsung CLP-320 Series Not shared
We're interested in sharing the CP210x, so run
PS C:\WINDOWS\system32> usbipd bind -b 2-2
where "2-2" is the value in BUSID column from usbipd list
PS C:\WINDOWS\system32> usbipd list
Output:
BUSID VID:PID DEVICE STATE
2-2 10c4:ea60 Silicon Labs CP210x USB to UART Bridge (COM3) Shared
2-6 30c9:0069 HP Wide Vision HD Camera, Camera DFU Device Not shared
"Shared" means ready to be forwarded, but still parked
PS C:\WINDOWS\system32> usbipd attach --wsl --busid 2-2
#this will now forward the USB-device. You will hear the "unplug" chime in Windows.
Output:
usbipd: info: Using WSL distribution 'Ubuntu' to attach; the device will be available in all WSL 2 distributions.
usbipd: info: Using IP address 172.26.144.1 to reach the host.
PS C:\WINDOWS\system32> usbipd list
#check if it worked
Output:
BUSID VID:PID DEVICE STATE
2-2 10c4:ea60 Silicon Labs CP210x USB to UART Bridge (COM3) Attached
2-6 30c9:0069 HP Wide Vision HD Camera, Camera DFU Device Not shared
Open WSL
bernd@myOmen:~$ lsusb
Output:
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bingo!
bernd@myOmen:~$ ls -l /dev/ttyUSB* #check permissions
crw-rw---- 1 root dialout 188, 0 Dec 8 11:30 /dev/ttyUSB0
check if you're in the group (dialout):
bernd@myOmen:~$ groups
bernd adm dialout cdrom floppy sudo audio dip video plugdev netdev docker
change to RPLidar SDK folder where the built demos are
run one of the sdk-demos to check if the connection works: bernd@myOmen:~/rplidar/rplidar_sdk/output/Linux/Release$ ./simple_grabber --channel --serial /dev/ttyUSB0 256000
Output:
SLAMTEC LIDAR S/N: E6BAED95C4E493CDA5E69EF0776A4B69
Version: SL_LIDAR_SDK_VERSION
Firmware Ver: 1.32
Hardware Rev: 6
Lidar health status : OK. (errorcode: 0)
waiting for data...
[histogram data is shown]
Do you want to see all the data? (y/n) n -> works. Yay!
PS C:\WINDOWS\system32> usbipd detach --busid 2-2
PS C:\WINDOWS\system32> usbipd list
Connected:
BUSID VID:PID DEVICE STATE
2-2 10c4:ea60 Silicon Labs CP210x USB to UART Bridge (COM3) Shared
2-6 30c9:0069 HP Wide Vision HD Camera, Camera DFU Device Not sharedPS C:\WINDOWS\system32> usbipd unbind --busid 2-2
PS C:\WINDOWS\system32> usbipd list
Connected:
BUSID VID:PID DEVICE STATE
2-2 10c4:ea60 Silicon Labs CP210x USB to UART Bridge (COM3) Not shared
2-6 30c9:0069 HP Wide Vision HD Camera, Camera DFU Device Not sharedhttps://learn.microsoft.com/de-de/windows/wsl/connect-usb#attach-a-usb-device These instructions contain errors, which I attempt to correct with this document
https://github.com/MicrosoftDocs/WSL/issues/1868 Issue raised about above incorrect instructions `
uspipd list
it works
PR that addresses this is not yet merged; https://github.com/MicrosoftDocs/WSL/pull/1870
leaving out the "wsl" option worked for me. I.e.: PS C:> uspipd list hope this helps :)
You should fix typo uspipd
to usbipd
Hi, I followed all your instructions, but when I type the command ls -l /dev/ttyUSB the output is "ls: cannot access '/dev/ttyUSB' : no such file or directory. I already checked if I'm in the group dealout and I am. I'm trying to connect a USB camera I hope you can help me!
Thanks for filing this issue @limkokhole. This issue is being fixed in https://github.com/MicrosoftDocs/WSL/pull/1870.
Documentation Issue
Run this command as per docs: usbipd wsl list
usbipd: error: The 'wsl' subcommand has been removed. Learn about the new syntax at https://learn.microsoft.com/windows/wsl/connect-usb#attach-a-usb-device
Link to documentation page
https://learn.microsoft.com/windows/wsl/connect-usb#attach-a-usb-device
Suggested Improvements
Please update documentation to reflect changes