日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

usbip--局域网内共享的USB设备

發布時間:2024/3/13 编程问答 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 usbip--局域网内共享的USB设备 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.


目錄(?)[-]

  • 1 Preliminary Note
  • 2 Installing And Using USBIP On The Server
  • 3 Installing And Using USBIP On The Client
  • 4 Detaching A Remote USB Device
  • 5?Links
  • 注意事項
  • usbip的目的是為了開發一個在局域網內共享的USB設備,也就是說你可以直接訪問局域網內其他計算機的USB設備。在網上看到一篇如何安裝usbip的文章,不過是英文,先轉載保存,有時間再翻譯下。

      有關它的詳細情況可參考其官方網站:http://usbip.sourceforge.net/

      轉載地址:http://www.howtoforge.com/how-to-set-up-a-usb-over-ip-server-and-client-with-ubuntu-10.04

    ?

      

    This tutorial shows how to set up a USB-over-IP server with Ubuntu 10.04 as well as a USB-over-IP client (also running Ubuntu 10.04). 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 messages" into TCP/IP payloads and transmits them between computers. USB-over-IP can be useful for virtual machines, for example, that don't have access to the host system's hardware - USB-over-IP allows virtual machines to use remote USB devices.

    I do not issue any guarantee that this will work for you!

    ?

    1 Preliminary Note

    This tutorial is based on AliRezaTaleghani's tutorial?How To Modify Your Gnu/Linux Box To Serve As A USB Over IP Server, but I've adjusted it for Ubuntu 10.04 (server and client). If you want to use a?Windows?client, please take a look at AliRezaTaleghani's tutorial - that part is still the same.

    In this tutorial I use the server?server1.example.com?with the IP address?192.168.0.100?and the client?client1.example.com?with the IP address192.168.0.101, both running Ubuntu 10.04. These settings might differ for you, so you have to replace them where appropriate.

    ?

    2 Installing And Using USB/IP On The Server

    server1:

    We can install?usbip?as follows:

    aptitude install usbip

    Afterwards we load the?usbip?kernel modules:

    modprobe usbip
    modprobe usbip_common_mod

    To check if they really got loaded, run:

    lsmod | grep usbip

    The output should be similar to this?one:

    root@server1:~#?lsmod?|?grep?usbip
    usbip??????????????????15124??0
    usbip_common_mod???????13605??1?usbip
    root@server1:~#

    To make sure that both modules get loaded automatically whenever you boot the system, you can add them to?/etc/modules:

    vi /etc/modules

    [...] usbip usbip_common_mod

    Now we can start the?usbip?daemon:

    usbipd -D

    root@server1:~# usbipd -D
    Bind usbip.ko to a usb device to be exportable!
    root@server1:~#

    ?

    Now attach a USB device that you want to export to the server - I'm using a SanDisk USB?flashdrive here.

    Execute the command

    lsusb

    to find the corresponding Vendor/Device ID which is in the form of:

    Bus XXX Device YYY: ID VendorID:DeviceID

    The output on my server is as follows:

    root@server1:~# lsusb
    Bus 001 Device 002: ID 0781:5151 SanDisk Corp. Cruzer Micro Flash Drive
    Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    root@server1:~#

    The Vendor/Device ID of my SanDisk USB flash drive is?0781:5151.

    Now run

    usbip_bind_driver --list

    The output on my server is as follows:

    root@server1:~#?usbip_bind_driver?--list
    List?USB?devices
    ?-?busid?1-1?(0781:5151)
    ?????????1-1:1.0?->?usb-storage

    root@server1:~#

    As you see, the Vendor/Device ID of my SanDisk USB flash drive (0781:5151) corresponds to the BUSID?1-1. We need this BUSID to attach the USB device to the server:

    usbip_bind_driver --usbip 1-1

    root@server1:~#?usbip_bind_driver?--usbip?1-1
    **?(process:765):?DEBUG:??1-1:1.0???????->?usb-storage
    **?(process:765):?DEBUG:?unbinding?interface
    **?(process:765):?DEBUG:?write?"add?1-1"?to?/sys/bus/usb/drivers/usbip/match_busid
    **?Message:?bind?1-1?to?usbip,?complete!
    root@server1:~#

    That's it, we can now use the SanDisk USB flash drive on a remote?usbip?client.

    BTW, if you run...

    netstat -tap

    ... you should see that the?usbip?daemon is listening on port 3240 so please make sure that this port isn't blocked by your firewall:

    root@server1:~#?netstat?-tap
    Active?Internet?connections?(servers?and?established)
    Proto?Recv-Q?Send-Q?Local?Address???????????Foreign?Address?????????State???????PID/Program?name
    tcp????????0??????0?*:ssh???????????????????*:*?????????????????????LISTEN??????537/sshd
    tcp????????0??????0?*:3240??????????????????*:*?????????????????????LISTEN??????762/usbipd
    tcp????????0?????52?server1.example.com:ssh?192.168.0.199:4024??????ESTABLISHED?667/0
    tcp6???????0??????0?[::]:ssh????????????????[::]:*??????????????????LISTEN??????537/sshd
    root@server1:~#

    ?

    3 Installing And Using USB/IP On The Client

    client1:

    We must install?usbip?on the client as well:

    aptitude install usbip

    Afterwards we load the?vhci-hcd?kernel module:

    modprobe vhci-hcd

    To check if it really got loaded, run:

    lsmod | grep vhci_hcd

    The output should be similar to this one:

    root@client1:~#?lsmod?|?grep?vhci_hcd
    vhci_hcd???????????????19800??0
    usbip_common_mod???????13605??1?vhci_hcd
    root@client1:~#

    To make sure that the module gets loaded automatically whenever you boot the system, you can add it to?/etc/modules:

    vi /etc/modules

    [...] vhci-hcd

    Now connect to the?usbip?server and get a list of available USB devices:

    usbip -l 192.168.0.100

    (192.168.0.100?is the IP address of the?usbip?server.)

    You should find the SanDisk USB flash drive in the output (BUSID?1-1):

    root@client1:~#?usbip?-l?192.168.0.100
    -?192.168.0.100
    ?????1-1:?SanDisk?Corp.?:?Cruzer?Micro?Flash?Drive?(0781:5151)
    ????????:?/sys/devices/pci0000:00/0000:00:07.2/usb1/1-1
    ????????:?(Defined?at?Interface?level)?(00/00/00)
    ????????:??0?-?Mass?Storage?/?SCSI?/?Bulk?(Zip)?(08/06/50)

    root@client1:~#

    To attach that device to the client, run:

    usbip -a 192.168.0.100 1-1

    root@client1:~# usbip -a 192.168.0.100 1-1
    8 ports available

    port 0 attached
    root@client1:~#

    Now run...

    lsusb

    ... and you should find the remote USB device in the output on the client:

    root@client1:~#?lsusb
    Bus?001?Device?002:?ID?0781:5151?SanDisk?Corp.?Cruzer?Micro?256/512MB?Flash?Drive
    Bus?001?Device?001:?ID?1d6b:0002?Linux?Foundation?2.0?root?hub
    root@client1:~#

    You can now use the remote USB device as if it was a local USB device (e.g. mount it, format it, write to it, read form it, etc.).

    ?

    4 Detaching A Remote USB Device

    A remote USB device can be detached as follows:

    client1:

    Run...

    usbip --port

    ... to find out the port that the remote USB device uses on the client - in this case it's port?00:

    root@client1:~#?usbip?--port
    8?ports?available

    Port?00:?<Port?in?Use>?at?High?Speed(480Mbps)
    ???????SanDisk?Corp.?:?Cruzer?Micro?256/512MB?Flash?Drive?(0781:5151)
    ???????1-1?->?usbip://192.168.0.100:3240/1-1??(remote?devid?00010002?(bus/dev?001/002))
    ???????1-1:1.0?used?by?usb-storage
    ???????????/sys/class/bsg/1:0:0:0/device
    ???????????/sys/class/scsi_device/1:0:0:0/device
    ???????????/sys/class/scsi_disk/1:0:0:0/device
    ???????????/sys/class/scsi_host/host1/device
    ???????????/sys/class/usb_endpoint/usbdev1.4_ep02/device
    ???????????/sys/class/usb_endpoint/usbdev1.4_ep81/device
    ???????????/sys/block/sdb/device
    Port?01:?<Port?Available>
    Port?02:?<Port?Available>
    Port?03:?<Port?Available>
    Port?04:?<Port?Available>
    Port?05:?<Port?Available>
    Port?06:?<Port?Available>
    Port?07:?<Port?Available>
    root@client1:~#

    We need the port number to detach the device:

    usbip -d 00

    root@client1:~# usbip -d 00
    8 ports available

    port 0 detached
    root@client1:~#

    On the server, we use the BUSID (1-1) to bind the USB device to the local system (the?--other?switch binds the device to the local system so that it is not available over the network anymore):

    server1:

    usbip_bind_driver --other 1-1

    root@server1:~# usbip_bind_driver --other 1-1
    ** (process:7333): DEBUG: write "del 1-1" to /sys/bus/usb/drivers/usbip/match_busid
    ** Message: bind 1-1 to other drivers than usbip, complete!
    root@server1:~#

    Now go back to the client and check if the remote USB device is still available:

    client1:

    lsusb

    If all goes well, it shouldn't be listed anymore:

    root@client1:~# lsusb
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    root@client1:~#

    ?

    5?Links

    • USB/IP Project:?http://usbip.sourceforge.net/
    • Ubuntu:?http://www.ubuntu.com/

    6 注意事項

    如果你的電腦安裝了Daemon Tools,那是用不了usbip的,卸載了它才行。至于原因,還沒有找到。
    windows客戶端下載usbip_windows_v0.2.0.0_signed.zip(win7)或者usbip_windows_v0.1.0.0_signed(win XP),否則可能會出現莫名其妙的錯誤。解壓了之后,這樣安裝一個虛擬USB設備(USB/IP Enumerator):

    win XP:控制面板>添加硬件>下一步>是,我已經連接了硬件>添加新的硬件設備>安裝我手動從列表選擇的硬件(高級)>系統設備>從磁盤安裝>選擇USBIPEnum.inf

    win7:設備管理器>操作>添加過時硬件>安裝我手動從列表選擇的硬件>系統設備>從磁盤安裝>選擇USBIPEnum.inf

    然后打開命令窗口,去到解壓到目錄,首先查看可用設備,看到類似下面的結果,就是有可用設備。

    ?D:\usbip_windows_v0.2.0.0_signed>usbip -l 192.168.1.155
    ?- 192.168.1.155
    ?????1-1: Z-Star Microelectronics Corp.?: ZC0301 WebCam (0ac8:301b)
    ????????: /sys/devices/platform/bcm63xx_ohci.0/usb1/1-1
    ????????: Vendor Specific Class / unknown subclass / unknown protocol (ff/00/00)
    ????????: 0 - Vendor Specific Class / Vendor Specific Subclass / Vendor Specifi
    ?c Protocol (ff/ff/ff)

    然后再運行 usbip -a 192.168.1.155 1-1,正常的話,windows就會提示找到USB設備,安裝驅動,就看到新的USB設備了。

    原文:http://blog.csdn.net/yangbingzhou/article/details/44487573

    總結

    以上是生活随笔為你收集整理的usbip--局域网内共享的USB设备的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

    主站蜘蛛池模板: 毛片网站有哪些 | 巨物撞击尤物少妇呻吟 | 一区二区三区免费在线观看 | 麻豆网站入口 | 求毛片网站 | 天堂在线免费视频 | 亚洲欧美中文日韩在线 | 国产一级免费 | 国产白浆在线 | 1级性生活片 | 成年人免费在线看 | 黄色av免费播放 | 蜜臀av88| 国产午夜在线播放 | 天天操天天操天天射 | 手机在线看永久av片免费 | 免费av观看网站 | 四虎影院在线看 | 午夜视频精品 | 看黄色大片 | 免费看的毛片 | 爱爱网站免费 | 中文字幕第80页 | 亚洲午夜天堂 | 成人免费看高清电影在线观看 | 日韩中文字幕av电影 | 久久深夜视频 | 日韩精品在线观看一区二区三区 | 99色婷婷 | 亚洲一区二区三区四区在线 | 林雅儿欧洲留学恋爱日记在线 | 91午夜在线 | 日韩在线观看视频网站 | 久久这里只精品 | 青青青视频免费 | 精品国产大片大片大片 | 亚洲欧美va天堂人熟伦 | 孕妇疯狂做爰xxxⅹ 国产精品乱码久久久久久 99久久久成人国产精品 | 免费成人蒂法网站 | 国产欧美一区二区三区在线 | 91jk制服白丝超短裙大长腿 | 首尔之春在线观看 | av色欲无码人妻中文字幕 | 国产激情无码一区二区三区 | 欧美一级片免费 | 国产精品自拍偷拍 | 精品人妻伦九区久久aaa片 | 亚洲少妇一区 | 精品亚洲乱码一区二区 | 黄色私人影院 | 日韩αv| 鲁丝av | 少妇性生活视频 | 精品乱码久久久久久中文字幕 | 亚州激情| 国产乱人乱精一区二视频国产精品 | 致命弯道8在线观看免费高清完整 | 三级特黄视频 | 国产无码精品久久久 | 日韩亚洲欧美综合 | 欧美第一页在线观看 | 欧美激情免费观看 | 黑人巨大精品人妻一区二区 | 亚洲啊v在线 | 欧美 唯美 清纯 偷拍 | 又色又爽又黄 | 国产精品久久久久久婷婷天堂 | 欧美日韩一区二区在线播放 | 欧美色视频在线观看 | 啪啪免费网| 欧美不卡网 | 极品美妇后花庭翘臀娇吟小说 | 樱花影院最新免费观看攻略 | 久久成人乱码欧美精品一区二区 | 国产三级漂亮女教师 | 久久久久国产一区二区三区 | 日韩欧美久久精品 | 办公室摸腿吻胸激情视频 | 九九五月天 | 欧美极品在线播放 | 少妇精品久久久久久久久久 | 嫩草av91| 欧美成人午夜精品免费 | 精品伊人久久 | 九九热在线免费视频 | 日韩久久成人 | 成人动漫亚洲 | jjzz黄色片 | 91精品中文字幕 | 国产乱码一区二区三区在线观看 | 国产午夜啪啪 | 天堂在线免费视频 | 国产高清一区二区 | 涩五月婷婷 | 久久影院午夜理论片无码 | 精品久久网 | 九九九免费视频 | 亚洲在线日韩 | 制服丝袜av一区二区三区下载 |