USBに学研のJapaninoを接続して、WindowsのデバイスマネージャーでCOM3に接続されているのを確認後
wsl側のディストリビューションで「lsusb -t」を使用
lsusbがインストールされてなかったので「sudo apt install usbutils」
再度「$ lsusb -t」を実行
/sys/bus/usb/devices: No such file or directory
接続されてないみたい
Windows側で、PowerShellを管理者モードで開き、「usbipd list」を実行
> 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 10c4:ea60 Silicon Labs CP210x USB to UART Bridge (COM3) Not 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 デバイス
e6148653-c61c-4101-92e8-81c149fd1d4b ADB Interface, Unisoc Phone
usbipd: warning: USB filter 'USBPcap' is known to be incompatible with this software; 'bind --force' will be required.
「3-1 10c4:ea60 Silicon Labs CP210x USB to UART Bridge (COM3) Not shared」がJapanino
USB デバイスを接続する前に、コマンド usbipd bind を使用してデバイスを共有し、WSL に接続できるようにする必要があるとのこ
これには管理者特権が必要
WSL で使用するデバイスのバス ID を選択し、次のコマンドを実行
> usbipd bind --busid 3-1
usbipd: warning: USB filter 'USBPcap' is known to be incompatible with this software; 'bind --force' will be required.
USB デバイスを接続するには、次のコマンドを実行
> usbipd attach --wsl --busid 3-1
usbipd: info: Using WSL distribution 'Gadget' to attach; the device will be available in all WSL 2 distributions.
usbipd: info: Loading vhci_hcd module.
usbipd: info: Detected networking mode 'nat'.
usbipd: info: Using IP address 172.19.80.1 to reach the host.
wsl側で再度「$ lsusb」または「$ lsusb -t」を実行
$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
$ lsusb -t
/: Bus 001.Port 001: Dev 001, Class=root_hub, Driver=vhci_hcd/8p, 480M
|__ Port 001: Dev 002, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
/: Bus 002.Port 001: Dev 001, Class=root_hub, Driver=vhci_hcd/8p, 10000M
接続されていることを確認完了
USB デバイスが WSL に接続されている限り、Windows では使用できないことに注意
WSL でデバイスの使用が完了したら、USB デバイスを物理的に切断するか、PowerShell から次のコマンドを実行
> usbipd detach --busid 3-1
WSL側で確認すると切断されてた
$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
alfaalfa@DESKTOP-GBLESOQ:~$ lsusb -t
/: Bus 001.Port 001: Dev 001, Class=root_hub, Driver=vhci_hcd/8p, 480M
/: Bus 002.Port 001: Dev 001, Class=root_hub, Driver=vhci_hcd/8p, 10000M
ちなみに、参考にしたのは、マイクロソフトの下記ページ
【USBデバイスを接続する】
https://learn.microsoft.com/ja-jp/windows/wsl/connect-usb#attach-a-usb-device
0 件のコメント:
コメントを投稿