# 服务端是插入USB设备的一端,需要的模块是usbip-core.ko和usbip-host.ko # 客户端是获取USB设备的一端,需要的模块是usbip-core.ko和vhci-hcd.ko > Device Drivers -> USB support -> <*> USB/IP support > Device Drivers -> USB support -> USB/IP support -> <*> VHCI hcd > Device Drivers -> USB support -> USB/IP support -> <*> Host driver > Device Drivers -> USB support -> USB/IP support -> <*> VUDC driver > Device Drivers -> USB support -> [*] Debug messages for USB/IP
# 首先列出所有连接到Windows的USB设备 PS C:\Users\leux> usbipd list Connected: BUSID VID:PID DEVICE STATE 1-11 0e8d:0616 RZ616 Bluetooth(R) Adapter Not shared 1-12 048d:5702 USB 输入设备 Not shared 2-2 0414:a014 Realtek USB2.0 Audio, USB 输入设备 Not shared 9-1 046d:0acb G435 Wireless Gaming Headset, USB 输入设备 Not shared 9-2 046d:c539 PRO WIRELESS, USB 输入设备, LIGHTSPEED Receiver, 虚拟 HID... Not shared 9-4 046d:c545 G913 TKL, USB 输入设备, LIGHTSPEED Receiver, 虚拟 HID 框 ... Not shared
# 查看指定IP主机共享的USB设备 leux@h88k:~$ usbip list -r 192.168.1.214 Exportable USB devices ====================== - 192.168.1.214 1-11: MediaTek Inc. : unknown product (0e8d:0616) : USB\VID_0E8D&PID_0616\000000000 : Miscellaneous Device / ? / Interface Association (ef/02/01) : 0 - Wireless / Radio Frequency / Bluetooth (e0/01/01) : 1 - Wireless / Radio Frequency / Bluetooth (e0/01/01) : 2 - Wireless / Radio Frequency / Bluetooth (e0/01/01)
# 将指定IP主机共享的USB设备【插入】到本地主机上就可以使用了 leux@h88k:~$ sudo usbip attach -r 192.168.1.214 -b 1-11 leux@h88k:~$ lsusb Bus 007 Device 006: ID 0e8d:0616 MediaTek Inc. Wireless_Device
# 要【拔出已插入的】USB设备,可先查看所有已【插入】的设备 leux@h88k:~$ sudo usbip port Imported USB devices ==================== Port 00: <Port in Use> at High Speed(480Mbps) MediaTek Inc. : unknown product (0e8d:0616) 7-1 -> usbip://192.168.1.214:3240/1-11 -> remote bus/dev 001/011
# 然后指定想要【拔出】的USB设备的端口 leux@h88k:~$ sudo usbip detach -p 00 usbip: info: Port 0 is now detached!