MCU單晶片韌體設計

2016年6月16日 星期四

USB over IP (1)



The USB/IP Project aims to develop a general USB device sharing system over IP network. To share USB devices between computers with their full functionality, USB/IP encapsulates USB I/O requests into IP packets and transmits them between computers.


技術架構


  1. Server : 伺服端為USB Host Controller,實際和USB Device連接並分享 USB , 如分享USB 隨身碟、USB Webcam。對於VHCI Driver而言,Stub driver 即如同一個 usb device的driver,Stub Driver 還必須進行IP <-->USB 的封包處理
  2. Client : 客戶端用以連接伺服端並且進行遠端掛載/卸載 (attach/detach) USB。VHCI (Virtual Host Controller Interface)  Driver 為虛擬USB Host),讓SB device 好像直接插入到Host controller 中 (但此為虛擬的HCI)。Client端將IP封包 (其payload為USB 封包),送入VHCI,使系統以為真有USB插入。 


usbip-design


Linux  kernel 3.17.x 後內建支援 USB over IP的功能

[USB/IP Support ]
This enables pushing USB packets over IP to allow remote machines direct access to USB devices. It provides the USB/IP core that is required by both drivers.  

Linux 
root@server1:~# sudo modprobe usbip-host




root@server1:~# usbipd -D

you should see that the usbip daemon is listening on TCP port 3240



root@server1:~# sudo apt-get install usbip

root@raspberrypi:~# usbip list -l

 - busid 1-1.1 (0424:ec00)
   Standard Microsystems Corp. : unknown product (0424:ec00)

 - busid 1-1.4 (0781:5567)
   SanDisk Corp. : Cruzer Blade (0781:5567)

root@raspberrypi:~# usbip bind --busid=1-1.4

usbip: info: bind device on busid 1-1.4: complete


root@raspberrypi:~# lsusb

Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0781:5567 SanDisk Corp. Cruzer Blade


資源參考
http://usbip.sourceforge.net/
http://askubuntu.com/questions/612355/share-usb-drive-over-network





沒有留言 :

張貼留言