Re: USB Driver for USB Sniffer

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

 



On Thu, 14 May 2009, Steve Hardy wrote:

> Hi all,
> 
> I am considering writing a gadget device driver which would act as
> both a USB host and device, for use as a USB sniffer.

If I understand you correctly, you want to hook the device's peripheral
interface to some host and your device's host controller to another
device, and then make your device act as a sort of relay, transferring
packets from the other host to the other device and vice versa.  Is
that right?

> My intention is to use a simple, low cost ARM development board like
> the Olimex SAM9-L9260, which has both usb host and device
> capabilities.
> 
> I have seen this idea proposed as a Beagleboard SoC project
> (http://elinux.org/BeagleBoard/Ideas-2009#USB_sniffer), but otherwise
> have not found any evidence that someone else is actively working on
> such a capability.

That's because it can't be done.  The timing requirements are too 
tight, for one thing.  Your device would have to send a response back 
to the host before it got the real response back from the other device.

Maybe you could make it work if you restricted yourself to control and 
bulk transfers.

> I have driver and some USB experience, so am happy to just get hacking
> and see how it goes, but I am keen to avoid duplicating effort if
> something similar has been attempted already.
> 
> Can anyone provide any thoughts, links or ideas related to this before I start?

Some years ago, Steve Calfee made something similar.  It doesn't act as
a relay; instead it just monitors the signals on the USB cable and
stores the data.  I can't find his announcement in the email archives, 
though.

> I'm guessing I will need to start with skeleton USB host and gadget
> drivers, and the host driver will have to talk to the gadget driver
> such that the gadget mimics the vendor/product IDs and EP topology of
> the device under test.  Then URBs in each direction will require
> forwarding in an efficient manner such that the USB data is fairly
> transparently "passed through" the driver/drivers.

Acting as a relay, right?

> For the actual sniffing, I just expect to use the usbmon module.
> 
> Any thoughts appreciated!

My advice is not to spend too much time on it.  Think through the 
possible limitations and pitfalls first.

Alan Stern

--
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