Modify

Opened 7 years ago

Closed 4 years ago

Last modified 3 years ago

#5590 closed enhancement (fixed)

USB over IP tunnelling

Reported by: anonymous Owned by: nico
Priority: low Milestone: Backfire 10.03.1
Component: packages Version: Trunk
Keywords: Cc:

Description

http://usbip.sourceforge.net/ would allow a USB device to be plugged into an OpenWRT router (the USB server), yet have the driver actually run on Windows or Linux (the USB client).

Uses:

  • Sharing a device between machines (Caveat - I havent looked at how usb/ip manages exclusive use of devices).
  • Can solve printer driver problems
  • Can plug mouse/keyboard into router, but have them control PC
  • Can plug devices that have no OpenWRT driver into router, and control device from say Ubuntu desktop.

For example - Plug USB printer (that has no Linux driver) into router:

  • USB stub driver and usbip server running on OpenWRT router (router that has a USB port).
  • install usbip virtual USB driver (virtual hub) on windows.
  • plug in USB printer into router.
  • make virtual connection from windows virtual hub to USB printer.
  • use windows printer driver (it doesn't know USB device is virtual connection!).

Attachments (1)

usbip_userspace.patch (11.3 KB) - added by devel@… 4 years ago.
Patch against trunk r30753 for packaging the usbip userspace utilities in the kernel tree.

Download all attachments as: .zip

Change History (22)

comment:1 Changed 7 years ago by anonymous

I want it!!!

comment:2 Changed 7 years ago by anonymous

me too

comment:3 Changed 6 years ago by nico

  • Owner changed from developers to nico
  • Status changed from new to assigned

comment:4 Changed 6 years ago by suneyes@…

i need it. is it supposed any release date?

comment:5 Changed 6 years ago by nico

  • Milestone changed from Kamikaze to Backfire 10.03.1
  • Priority changed from normal to low
  • Resolution set to fixed
  • Status changed from accepted to closed
  • Version set to Trunk

Added in [20978]

comment:6 follow-up: Changed 6 years ago by anonymous

Last time I tried USBIP it was broken...

comment:7 in reply to: ↑ 6 Changed 6 years ago by anonymous

Replying to anonymous:

Last time I tried USBIP it was broken...

I failed on the NSLU2 and WRT160NL with the june snapshots:
usbipd -D gave-
usbip err: stub_server.c: 433 (do_standalone_mode) open usb.ids
usbip err: stub_driver.c: 33 (open_sysfs_stub_driver) usbip_common_mod.ko
and usbip.ko must be loaded
usb.ids can just be moved but the insmod of the .ko files gave Invalid Module Format.

comment:8 Changed 6 years ago by acoul

should be fixed on r21885, thank you for reporting.

comment:9 Changed 6 years ago by nemenator@…

Deanonymising now- thanks for the update, but I am still getting:
usbip err: stub_driver.c: 33 (open_sysfs_stub_driver) usbip_common_mod.ko and usbip.ko must be loaded

So I CD to /lib/modules/2.6.32.14 and insmod usbip_common_mod.ko only to get
insmod: can't insert 'usbip_common_mod.ko': invalid module format

I hope I am just missing the obvious.

comment:10 follow-up: Changed 6 years ago by nico

Humm, it works for me:

Jan 11 19:32:17 OpenWrt user.info kernel: usbip_common_mod: usbip common driver1.0
Jan 11 19:32:27 OpenWrt user.info kernel: vhci_hcd: vhci_hcd, 1.0
Jan 11 19:32:27 OpenWrt user.info kernel: usbip: proving...
Jan 11 19:32:27 OpenWrt user.info kernel: vhci_hcd vhci_hcd: USB/IP Virtual Host Contoroller
Jan 11 19:32:27 OpenWrt user.info kernel: vhci_hcd vhci_hcd: new USB bus registered, assigned bus number 2
Jan 11 19:32:27 OpenWrt user.info kernel: usb usb2: configuration #1 chosen from 1 choice
Jan 11 19:32:27 OpenWrt user.info kernel: hub 2-0:1.0: USB hub found
Jan 11 19:32:27 OpenWrt user.info kernel: hub 2-0:1.0: 8 ports detected
Jan 11 19:32:36 OpenWrt user.info kernel: usbcore: registered new interface driver usbip
Jan 11 19:32:36 OpenWrt user.info kernel: usbip:Stub Driver for USB/IP:1.0

Are you sure the kernel modules you're trying to use are matching the kernel you're running ?

comment:11 Changed 6 years ago by anonymous

Interesting, I have been testing this and also a standard USB over IP server
Seems to work except that Im getting a stub_driver.c: 33 error

comment:12 Changed 6 years ago by acoul

you can try r23514.

comment:13 in reply to: ↑ 10 Changed 5 years ago by twinclouds <twinclouds2004@…>

Hi,
Can you provide a mini how-to to describe how the module can be used? Thanks.

Replying to nico:

Humm, it works for me:

Jan 11 19:32:17 OpenWrt user.info kernel: usbip_common_mod: usbip common driver1.0
Jan 11 19:32:27 OpenWrt user.info kernel: vhci_hcd: vhci_hcd, 1.0
Jan 11 19:32:27 OpenWrt user.info kernel: usbip: proving...
Jan 11 19:32:27 OpenWrt user.info kernel: vhci_hcd vhci_hcd: USB/IP Virtual Host Contoroller
Jan 11 19:32:27 OpenWrt user.info kernel: vhci_hcd vhci_hcd: new USB bus registered, assigned bus number 2
Jan 11 19:32:27 OpenWrt user.info kernel: usb usb2: configuration #1 chosen from 1 choice
Jan 11 19:32:27 OpenWrt user.info kernel: hub 2-0:1.0: USB hub found
Jan 11 19:32:27 OpenWrt user.info kernel: hub 2-0:1.0: 8 ports detected
Jan 11 19:32:36 OpenWrt user.info kernel: usbcore: registered new interface driver usbip
Jan 11 19:32:36 OpenWrt user.info kernel: usbip:Stub Driver for USB/IP:1.0

Are you sure the kernel modules you're trying to use are matching the kernel you're running ?

comment:14 Changed 5 years ago by lucaf3rr@…

Here is an init script I'm using personally. It assumes usbipd crashes from time to time, hence the run loop, which automatically restarts if it has crashed.

#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=80

# Change this to the device you want exported
# separate devices with comma (,)
# to see devices available do "usbip_bin_driver --list"
DEVICE="04a9:1090"

#set -u

bindUsbip() {
        local busid

        local oldifs=$IFS
        IFS=','

        for b in $1; do
                busid=$(usbip_bind_driver --list | grep $b | cut -f4 -d' ')
                usbip_bind_driver --$2 $busid 2>&1 > /dev/null
        done


        IFS=$oldifs
}

run() {
        local runFlag=$1

        killHandler () {
                runFlag=0
        }

        trap "killHandler" TERM


        while sleep 3 && [ "$runFlag" -gt 0 ]; do
                if start-stop-daemon -S -n usbipd -x usbipd -- --daemon 2>&1 > /dev/null; then
                        bindUsbip $DEVICE usbip
                fi
        done
}

start() {
        start-stop-daemon -K -n usbipd -x usbipd -t 2>&1 > /dev/null
        run $? &
}

stop() {
        # Stop run loop but do not kill this instance
        trap "" TERM
        killall -TERM usbip
        trap - TERM

        start-stop-daemon -K -n usbipd -x usbipd -s 9 2>&1 > /dev/null
        bindUsbip $DEVICE other
}

comment:15 Changed 4 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened

HOW TO would be helpful. THanks.

comment:16 Changed 4 years ago by jow

  • Resolution set to invalid
  • Status changed from reopened to closed

This is no support channel.

comment:17 follow-up: Changed 4 years ago by devel@…

I think the problems people are having could be due to the wrong version of the usbip server being packaged:

root@OpenWrt:/lib/modules/3.2.9# opkg install usbip-server
Package usbip-server (0.1.7-2) installed in root is up to date.

0.1.7-2 is ancient. The userspace code needs to be built from drivers/staging/usbip/userspace in the kernel source tree, not from the sf source.

Looking at package/feeds/packages/usbip/Makefile, the kernel modules are being built from the kernel sources. It just needs the same to be done for the userspace utilities.

Changed 4 years ago by devel@…

Patch against trunk r30753 for packaging the usbip userspace utilities in the kernel tree.

comment:18 in reply to: ↑ 17 Changed 4 years ago by devel@…

Replying to devel@…:

I think the problems people are having could be due to the wrong version of the usbip server being packaged:

root@OpenWrt:/lib/modules/3.2.9# opkg install usbip-server
Package usbip-server (0.1.7-2) installed in root is up to date.

0.1.7-2 is ancient. The userspace code needs to be built from drivers/staging/usbip/userspace in the kernel source tree, not from the sf source.

Looking at package/feeds/packages/usbip/Makefile, the kernel modules are being built from the kernel sources. It just needs the same to be done for the userspace utilities.

Looks like someone beat me to it. See https://dev.openwrt.org/ticket/10992

comment:19 Changed 4 years ago by anonymous

  • Resolution invalid deleted
  • Status changed from closed to reopened

It's somewhat ridiculous that after using linux since 2.6.39 usbip userspace is still broken and multiple fixes have been submitted - please just apply, will you?

Other solution here: https://dev.openwrt.org/ticket/10992

comment:20 Changed 4 years ago by florian

  • Resolution set to fixed
  • Status changed from reopened to closed

Fixed with r32887

comment:21 Changed 3 years ago by rpardini

Need to remove dep on LINUX_3_3 with current trunk r34432 which uses 3.6.8.
With the dep, we are unable to select usbip-server or usbip-client in menuconfig.
Removing it, it builds and works beautiful (with a 3.6.8 client as well, older versions crash/panic/freeze the client but not the server).

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.