1.管理者モードで PowerShell を開き、次のコマンドを入力して、
Windows に接続されているすべての USB デバイスを一覧表示します。
デバイスが一覧表示されたら、WSL に接続するデバイスのバス ID を選択してコピーします。
PowerShell
> usbipd list
Connected:
BUSID VID:PID DEVICE STATE
1-2 0b05:19af AURA LED Controller, USB 入力デバイス Not shared
1-23 174c:55aa USB 大容量記憶装置 Not shared
2-2 8564:7000 USB 接続 SCSI (UAS) マス ストレージ デバイス Not shared
3-1 18d1:4ee8 ADB Interface, Unisoc Phone Shared
4-1 0dc6:9811 USB 入力デバイス Not shared
4-2 046d:c018 USB 入力デバイス Not shared
4-4 0a12:0001 Generic Bluetooth Radio Not shared
Persisted:
GUID DEVICE
00e43bb3-5cb6-4bb4-b771-7fd1bb3798a6 MTP USB デバイス
2a7ff796-d190-41f6-9116-247471abf8b9 Silicon Labs CP210x USB to UART Bridge (COM3)
usbipd: warning: USB filter 'USBPcap' is known to be incompatible with this software; 'bind --force' will be required.
2.USB デバイスを接続する前に、コマンド usbipd bind を使用してデバイスを共有し、
WSL に接続できるようにする必要があります。
これには管理者特権が必要です。 WSL で使用するデバイスのバス ID を選択し、次のコマンドを実行します。
コマンドを実行した後、もう一度コマンド usbipd list を使用してデバイスが共有されていることを確認します。
PowerShell
PowerShell
> usbipd bind --busid 3-1
usbipd: warning: USB filter 'USBPcap' is known to be incompatible with this software; 'bind --force' will be required.
3.USB デバイスを接続するには、次のコマンドを実行します。
(管理者特権での管理者プロンプトを使用する必要がなくなりました)。
WSL 2 軽量 VM をアクティブに保つために、WSL コマンド プロンプトが開かれていることを確認します。
USB デバイスが WSL に接続されている限り、Windows では使用できないことに注意してください。
WSL に接続すると、WSL 2 として実行されている任意のディストリビューションで USB デバイスを使用できます。
usbipd listを使用してデバイスが接続されていることを確認します。
WSL プロンプトから、 lsusb を実行して、USB デバイスが一覧表示され、Linux ツールを使用して操作できることを確認します。
PowerShell
> usbipd attach --wsl --busid 3-1
usbipd: info: Using WSL distribution 'Android' to attach; the device will be available in all WSL 2 distributions.
usbipd: info: Detected networking mode 'nat'.
usbipd: info: Using IP address 172.19.80.1 to reach the host.
4.ディストリビューション (または任意の WSL コマンド ライン) を開き、
次のコマンドを使用して接続されている USB デバイスを一覧表示します。
$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 18d1:4ee8 Google Inc. Nexus/Pixel Device (MIDI)
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
$ ./adb devices
List of devices attached
57287702528791 device
$ adb devices -l
List of devices attached
57287702528791 device usb:1-1 product:P20HD_EEA model:P20HD_EEA device:P20HD_EEA transport_id:3
5.WSL でデバイスの使用が完了したら、USB デバイスを物理的に切断するか、
PowerShell から次のコマンドを実行します。
PowerShell
usbipd detach --busid



