S-A5605BT串口AT指令蓝牙音箱IC 支持U盘播放FM收音SPP\BLE数据透传

谷动谷力

 找回密码
 立即注册
查看: 68|回复: 0
打印 上一主题 下一主题
收起左侧

【开源项目】usbip-远程挂载usb设备

[复制链接]
跳转到指定楼层
楼主

网上有个神级的开源项目,usbip,可一直没人玩。其实这个挺好玩的,它是将usb通过网络映射出远程计算机。应用场景特别多,把它装在openwrt的无线路由上,可以实现无线打印啊,无线音箱,远程摄像头,甚至有人网上共享加密狗,如游戏的启动盘。之所以没有流行起来,应该是使用有些复杂,还有有些设备不支持。最近我玩了一下这个开源项目,将过程记录下来,供参考。
现在usbip项目是2.0版本了,包括openwrt官网内置的,都是2.0了。windows端版本使用的是这个:
https://github.com/cezuni/usbip-win
USB/IP 项目旨在开发一个基于 IP 网络的通用 USB 设备共享系统。为了在计算机之间共享具有全部功能的 USB 设备,USB/IP 将“USB I/O 消息”封装到 TCP/IP 负载中,并在计算机之间传输它们。
据报道这很有效,但我们还没有 HowTo!


OpenWrt 上的服务器
由于 Barrier Breaker 释放 USBIP 数据包丢失 - 安装过程存在差异
首先安装 usb 内核模块以及 usbip 服务器和客户端包:
姿态调整:
opkg install kmod-usb-ohci usbip-server usbip-client
破障者 + 混沌镇定者:
opkg install kmod-usb-ohciopkg
install http://downloads.openwrt.org/att ... .1-2_ar71xx.ipkopkg
install http://downloads.openwrt.org/att ... .1-2_ar71xx.ipkopkg install http://downloads.openwrt.org/att ... _1.1.1-2_ar71xx.ipk(软件包是从 AA 安装的,但内核模块会自动从 BB 安装以匹配内核版本)
现在用于列出可导出的可用本地 USB 设备。在以下示例中,显示了集线器、USB 打印机和光学鼠标:usbip list -l
root@OpenWrt:~# usbip list -l
Local USB devices=================
- busid 2-1 (05e3:0608)
        2-1:1.0 -> hub - busid 2-1.4 (04e8:344f)
        2-1.4:1.0 -> unknown
         2-1.4:1.1 -> unknown
- busid 2-2 (093a:2510)
         2-2:1.0 -> unknown
您要查找的信息是 2-2,这是目标设备(光电鼠标)的 BUSID。
编辑 ,然后在 之前添加以下几行:/etc/rc.localexit 0
usbipd -D &sleep 1usbip bind -b 2-2
用于查看是否一切正常:netstat
root@OpenWrt:~# netstat -alptActive Internet connections (servers and established)Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    tcp        0      0 0.0.0.0:3240            0.0.0.0:*               LISTEN      927/usbipd

客户端 (Arch-linux PC)
在您的 PC 上安装 usbip
[root@tool dani]# pacman -S usbip
为客户端加载模块
[root@tool dani]# modprobe vhci_hcd
在 OpenWrt(服务器端)列出可用的远程设备。
[root@tool dani]# usbip list -r 192.168.1.1
Exportable USB devices======================
- 192.168.1.1
       2-2: Pixart Imaging, Inc. :
Optical Mouse (093a:2510)   
        : /sys/devices/platform/bcm63xx_ohci.0/usb2/2-2
          : (Defined at Interface level) (00/00/00)
          :  0 - Human Interface Device / Boot Interface Subclass / Mouse (03/01/02)
连接远程设备
[root@tool dani]# usbip attach -r 192.168.1.1 -b 2-2
如果一切正常,现在您可以将鼠标移动到 PC 上,但使用 OpenWrt 连接到路由器。

客户端 (Windows PC (包括 W7 x64)
解决方案由 2 部分组成:
1. 安装驱动程序
2. 启动 usbip 工具
1. 安装驱动程序可能是一个挑战 - 有一个签名的驱动程序,包含在 0.200 版本的工具中。不幸的是,它们不再起作用了。至少对于 Win7 x64 来说是这样。浏览 USBIP 论坛以查找最新编译的驱动程序和工具。不幸的是,驱动程序未签名,为了安装它,您必须关闭 Windows 驱动程序签名检查。 a) 在此处下载可用的驱动程序和 usbip 工具:http://sourceforge.net/p/usbip/discussion/418507/thread/86c5e473/
b) 禁用 Windows 驱动程序检查:
    Open a command prompt as an admin and type:    bcdedit -set loadoptions DISABLE_INTEGRITY_CHECKS    bcdedit -set TESTSIGNING ON    NOTE: Turning off driver signing is a security risk.    If it doesn't work, for whatever reason, you can just remove loadoptions with bcedit and >switch testsigning off, though this is not recommended:    bcdedit /deletevalue loadoptions    bcdedit -set TESTSIGNING OFF    For Windows 8.1, use the details on this page:    [[http://www.howtogeek.com/167723/ ... l-unsigned-drivers/]]    And then restart Windows.2. 使用与工作驱动程序一起下载的工具usbip.exe。 在 BB 版本上进行了测试。至少使用 USB 驱动器和 Kvaser Leaf Lite CAN 网关。a) usbip -l <HOST IP address>                to show all USB devices binded on the HOSTb) usbip -a <HOST IP address> <BUSID>        to connect to particular Device.

笔记
+12

最近谁赞过

本帖被以下淘专辑推荐:

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|深圳市光明谷科技有限公司|光明谷商城|Sunshine Silicon Corpporation ( 粤ICP备14060730号|Sitemap

GMT+8, 2025-5-24 04:05 , Processed in 0.196481 second(s), 44 queries .

Powered by Discuz! X3.2 Licensed

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表