Because life is better with Linux.
Sharing a Device from Windows to WSL
usbipd can be used to share a locally connected USB device including WSL2. See also this Learn doc
c:\>usbipd
usbipd-win 2.3.0
Description:
Shares locally connected USB devices to other machines,
including Hyper-V guests and WSL 2.
Usage:
usbipd [command] [options]
Options:
--version Show version information
-?, -h, --help Show help and usage information
Commands:
bind Bind device
license Display license information
list List USB devices
server Run the server on the console
state Output state in JSON
unbind Unbind device
wsl Convenience commands for WSL
Listing USB devices:
c:\>usbipd wsl list
BUSID VID:PID DEVICE STATE
1-2 17a0:0304 Samson Q2U Microphone, USB Input Device Not attached
1-5 05ac:024f USB Input Device Not attached
1-6 046d:c092 USB Input Device Not attached
1-11 048d:5702 USB Input Device Not attached
1-20 046d:0893 Logitech StreamCam, Logitech StreamCam WinUSB, USB Input ... Not attached
3-1 0b0e:24ca Jabra Link 380, USB Input Device Not attached
Let’s attach a headset to Ubuntu (or try to).
c:\>wsl --list
Windows Subsystem for Linux Distributions:
docker-desktop (Default)
docker-desktop-data
Ubuntu-20.04
c:\>usbipd wsl attach --busid 3-1 -d Ubuntu-20.04
usbipd: error: Access denied; this operation requires administrator privileges.
usbipd: info: The first time attaching a device to WSL requires elevated privileges; subsequent attaches will succeed with standard user privileges.
Doh.
(admin) c:\>usbipd bind -b 3-1
That appears to work, but didn’t.
In WLS shell:
$ sudo apt install linux-tools-5.4.0-77-generic hwdata
$ sudo update-alternatives --install /usr/local/bin/usbip usbip `ls /usr/lib/linux-tools/*/usbip | tail -n1` 20
$ sudo usbip port
Imported USB devices
====================
Try to import from the WSL side:
$ sudo usbip attach -r $(hostname).local -b 3-1
$ sudo usbip port
Imported USB devices
====================
Port 00: <Port in Use> at Full Speed(12Mbps)
GN Netcom : unknown product (0b0e:24ca)
1-1 -> usbip://********.local:3240/3-1
-> remote bus/dev 003/001
Bingo, perhaps?
FInally, clean up and detach so that Windows can use the device again.
$ sudo usbip detach -p 0
And back in Windows, unbind the device.
(admin) c:\> usbipd unbind -b 3-1