我思故我在我有我精彩--liangqihui

爱欲追而情已逝,子欲孝而亲不待。人生的困苦又怎能用一个难字囊尽百味
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

转-usbip 试用记

Posted on 2020-11-22 21:36  挥辉  阅读(1117)  评论(0编辑  收藏  举报

 

https://download.csdn.net/download/jinpindi/9503667?utm_medium=distribute.pc_relevant_download.none-task-download-baidujs-2.nonecase&depth_1-utm_source=distribute.pc_relevant_download.none-task-download-baidujs-2.nonecase

http://usbip.sourceforge.net/

 https://github.com/wangyouqiang/usbip-server

 

usbip 试用记

 

由于老外的瓦力要用到网络摄像头,我们如果想借用他的程序,也得要一个网络摄像头。之前我搞定都是路由,重新买一个网络摄像头,价格不菲,好像有点浪费。于是想利用路由和摄像头做类似的功能。

 

偶然在网上看到一篇文章,可以用Usb Over Network (也叫Usb Over IP)来将设备映射到windows系统,刚好可以实现我需要的功能。

http://www.openwrt.org.cn/bbs/forum.php?mod=viewthread&tid=1777

 

按照文章的步骤,安装usbip在我的RG100A (openWRT 10.03.1-rc6)上,看到类似如下的结果,就是openWRT服务端正确启动了:

 

root@OpenWrt:/# usbip_bind_driver --usbip 1-1

** (process:903): DEBUG:  1-1:1.0       -> none

** (process:903): DEBUG: write "add 1-1" to /sys/bus/usb/drivers/usbip/match_busid

** Message: bind 1-1 to usbip, complete!

root@OpenWrt:/# usbipd -D

root@OpenWrt:/#

 

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:\dev\OpenWRT\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设备了。

 

比较神秘的是,如果你的电脑安装了Daemon Tools,那是用不了usbip的,卸载了它才行。

 

安装usbip已经依赖软件,需要970k,如果要安装在WR703N上,小标原来的固件是不够空间的,不过我已经让小标帮忙编译了一个包含了usbip的固件了,测试过可用。

 

不过非常杯具的是,我的301摄像头,挂载在win7下,驱动也安装了,不过当使用的时候出现蓝屏!win xp下,不蓝屏但爆下面的错误:

 

usbip err: usbip_vbus_ui.c: 390 (write_to_dev) last error:87

usbip err: usbip_vbus_ui.c: 391 (write_to_dev) out:0 ret:0 len:56

usbip err: usbip_vbus_ui.c: 392 (write_to_dev) write dev failed

 

UVC 摄像头同样也可以挂载,不过在win7 和 win xp下,都提示无法安装驱动!

 

看来传闻没错,usbip还很不稳定,兼容性也差,看来我要放弃这个方案了。。

 

-------------------------------------

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.

Feb 21, 2011: Updated windows client driver to allow x64 operation. We have received signed versions from the ReactOS project. (This is needed to allow installation without workarounds on Win7/Vista x64.) ReactOS has the proper code signing certificate and offer its use to other open source projects React OS Driver Signing. Great initiative!

Jul 10, 2009: The preview release of usbip windows client is now available. See screenshots!

Jan 13, 2009: The latest drivers were recently included in the staging tree of Linux.

ABOUT

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. Original USB device drivers and applications can be also used for remote USB devices without any modification of them. A computer can use remote USB devices as if they were directly attached; for example, we can ...

  • USB storage devices: fdisk, mkfs, mount/umount, file operations, play a DVD movie and record a DVD-R media.
  • USB keyboards and USB mice: use with linux console and X Window System.
  • USB webcams and USB speakers: view webcam, capture image data and play some music.
  • USB printers, USB scanners, USB serial converters and USB Ethernet interfaces: ok, work fine.

It is currently implemented as Linux device drivers and available under the open source license GPL. Its I/O performance is enough practical in local area network for all types of devices, including isochronous devices, without any modification of Linux-original USB device drivers.

DOCUMENTATION

Overview

In a client host, the VHCI (Virtual Host Controller Interface) driver is implemented as a USB host controller driver. The VHCI driver emulates a real USB host controller interface for virtual attachment/detachment, enumeration and initialization of remote USB devices. It encapsulates USB request blocks and then transmits USB/IP requests to remote server hosts. In a server host, the Stub driver is implemented as a USB per-device driver. The Stub driver decapsulates USB/IP requests into USB requests and then submit them to real USB devices.

usbip-design

USB/IP Design Overview

  • USB/IP - a Peripheral Bus Extension for Device Sharing over IP Network. Takahiro Hirofuchi, Eiji Kawai, Kazutoshi Fujikawa, and Hideki Sunahara. In the Proceedings of the FREENIX Track: USENIX Annual Technical Conference, pp. 47-60, April 2005. (Awarded FREENIX Track Best Paper!)
  • USB/IP: A Transparent Device Sharing Technology over IP Network. Takahiro Hirofuchi, Eiji Kawai, Kazutoshi Fujikawa, and Hideki Sunahara. IPSJ Transactions on Advanced Computing Systems, Vol. 46, No. SIG11(ACS11), pp. 349-361, August 2005. (Also appeared in IPSJ Digital Courier.)

FAQ

  • "client" and "server" are confusing...
    A server host has physical USB devices which are exported to a client host. In the server host, load usbip_common_mod.ko and vhci-hcd.ko, and then use usbipd. The client host imports a USB device virtually; the client host may not have a real USB device. In the client host, load usbip_common_mod.ko and usbip.ko, and then use usbip.
  • USB/IP is stable?
    It basically works for most USB devices under LAN (Gb Ethernet is better). It has minimum features (e.g., attach/detach) and your contribution is welcome.
  • Is there a MS Windows client of USB/IP ?
    There is one now, it is in the early stage of development, you can try it. If it can't work for your USB devices, please report bug to us.
  • Does your USB/IP implementation have compatibility with other similar products?
    No, currently.

SCREENSHOTS

usbview

A remote USB webcam with an ov511 chip is virtually attached to a computer. We can see ov511 under USB VHCI Root Hub.

usbview screenshot

Desktop

xawtv is working for a remote USB webcam. A remote USB-HDD is also attached to the computer.

xawtv screenshot

DOWNLOAD

Linux

For Linux, the source code of usbip was merged into the staging tree, and finally has been moved to the mainline since Linux-3.17. Development is ongoing in the kernel community, not here. Linux distributions will provide binary packages of usbip. Just for historical records, the project page keeps old download files of the Linux version. Do not use them.

Windows

For Windows, the precompiled client-side program is available from the project page. You need a Linux machine for the server side.

See the git repository for the latest source code. Although, development has not been active lately. Feel free to fork the project.

Install and Usage

See README (possibly included in your binary package).

COMMUNITY

Mailing List

Public Forum

LINKS

CONTACT

Normally, please use the mailing list and forum (Recommended).

  • Takahiro Hirofuchi < hirofuchi (the character) users.sourceforge.net >