Re: Binding USB devices on LAN hosts to a peripheral controller using usbip

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 24 January 2013, 01:06 Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:

> On Thu, Jan 24, 2013 at 12:59:00AM +0100, Carsten Neumann wrote:
> > Hi,
> > 
> > I am planning to build a USB device based on an embedded controller
> > board having a (High-Speed) USB peripheral port and an (Gbit) Ethernet
> > port.  My goal is to "connect" arbitrary USB devices (e.g. physical
> > mass storage / serial devices or gadgets like g_mass_storage,
> > g_serial) attached to a host somewhere on the LAN to my device's USB
> > peripheral port, so that I can use them on a physical device (e.g.
> > mediaplayer) w/ USB port.
> 
> I don't understand, care to draw a block diagram of exactly what you are
> trying to do here?  Use a USB device attached to a "normal" computer
> somewhere on the network, as a "virtual" device on your embedded
> controller?  What type of USB device are you wanting to do this for?

Well, I thought of better drawing a diagram. ;-)

--------------------
| USB-Mass Storage |
| or Serial Device |
--------------------
         |
         |USB cable
         |
------------------------------------------------------                   -------------------------------------------------------------
| |  USB HCI  |                                      |                   |                                                           |
| \-----------/                                      |                   |                                                           |
|        |             /--------\  /----------|------|   Ethernet Cable  |------|----------\ /--------\   /--------------------\     |
|        \-------------| USB/IP |--| IP-Stack | eth0 |-------------------| eth0 | IP-Stack |-| USB/IP |---| my_gadget_wo_usbip |--\  |
|         /------------|        |  \----------|------|                   |------|----------/ \--------/   \--------------------/  |  |
|         |            \--------/                    |                   |           |                    /--------------------\  |  |
|/----------------\                                  |                   |           \--------------------| my_gadget_w_usbip  |  |  |
||   dummy_hcd    |                                  |                   |                                \--------------------/  |  |
|-----------------------------\  USB/IP Server Host  |                   |     Embedded USB Proxy              |<-multiple devs?->|  |            ----------------
|| g_mass_storage or g_serial |                      |                   |                              /----------------------------| USB Cable  | Media Player |
|\----------------------------/                      |                   |                              | USB Peripheral Controller  |------------| w/ USB Port  |
------------------------------------------------------                   -------------------------------------------------------------            ----------------

Remarks:
"multiple devs?" is just to make clear that I want to "emulate" multiple devices simultanously if possible, this refers to my later question regarding HUB Controllers.
Mass storage and serial devices are just examples for devices which seem to me appropriate to be attached via USP/IP.

To your questions:
Yes, the "real" devices are connected to a "normal" computer.
The "virtual" devices seen on the embedded controller should be "routed" to a physical USB, so that they can be plugged into somewhat USB host ("normal" computer or e.g. MediaPlayer).
My first thought was of any device class for which IP transfer is appropriate.
I don't think isochronous transfers will work very well.

> 
> > I am new to the linux USB stack, so before I waste days or weeks until
> > I find out it's not possible this way, I decided to ask the
> > specialists. ;-)
> > 
> > Here are my questions:
> > 
> > Is there a simple way to bind a USB device connected to a host port to
> > a peripheral port (e.g. via an existing gadget)? (Couldn't find one so
> > far.)
> 
> I don't understand, what do you want to bind to what?

I want to bind a real and/or "virtual" USB device to a "real" device driver (udc) like a gadget driver is bound to a device driver or a real or "virtual" device is bound to USB/IP.

> 
> > Does the current usbip protocol provide enough information to make this also work for usbip'd devices? (No clue.)
> > If not, would it be (relatively easily) possible to extend the usbip protocol to accomplish this?
> > If I have to write my own gadget:
> > It would be more general to bind the usbip-vhci (or whatever HCI) device to a peripheral port.
> > On the other hand this means more overhead.
> > The data will go through two drivers (vhci-hcd and my gadget) and both have to run on an embedded controller where I only have limited CPU power.
> > Therefore it would be better to build one gadget that has the usbip protocol built-in. (The usbip protocol implementation could then possibly be placed into a separate kernel module.)
> > 
> > Another question is: are there device controllers which can act as
> > multiple (NOT multifunction composite) devices so that the attached
> > host will see a hub?
> 
> Hub controllers are done in hardware, so you will need to buy a chip
> that does that if you want to do it.

I need to buy chips anyway. ;-)
But this shouldn't be the problem: I want to plug the device port of my "Embedded USB Proxy" into some host port and it should appear as a USB hub with some USB devices plugged in.

I saw some sort of hub controllers but these were intended (and - I think - only usable) for "real" hardware USB hubs.
Those with 4 A plug ports on one and 1 B plug port on the other side.

My concerns are that usual Peripheral Controllers have probably limitations so they can act only as one device at a time.
Am I correct?

If I'm wanting too much, I have to fall back to a single device emulation.

> 
> > I did read something about hub controllers, but are these what I mean
> > and are any supported by the linux USB stack?
> 
> From the host side, yes, since the beginning (1999 or so).

As I mentioned: this is not what I asked for.

How about the device side?

> 
> greg k-h

	Carsten

-- 
"Seit die Mathematiker über die Relativitätstheorie hergefallen sind, verstehe ich sie selbst nicht mehr."
(“Since the mathematicians have invaded the theory of relativity I do not understand it myself any more.”)

- Albert Einstein
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux