rnunes
rnunes

Reputation: 2835

Using computer as USB communication middleman

I want to develop a USB protocol analyser using my Windows 7 x64 PC as the communication middleman.

Using embedded systems sometimes I have two devices that "talk" through USB and I need to see what are they "saying".

My idea is too connect those two devices to my pc and tell to my application that those are the 2 ports used in the communication. Next the application will listen to both ports, log the messages and redirect it to the other port.

If there's a method to do that using raw usb data, without the need to have installed drivers for those USB devices (some of them don't have Windows drivers) that would be perfect.

I have knowledge in C# and Java but other languages are acceptable too.

Upvotes: 2

Views: 956

Answers (2)

无敌大阎王
无敌大阎王

Reputation: 1

For Ethernet data: Referring to the Netfilter architecture of Linux, iptables and simple Module can be used to modify data packets. This comes from the five hook points of Linux kernel developers on Netfilter, which can facilitate the developers to operate data packets at different stages reasonably. There seems to be no neifilter-like hook architecture for USB data. To intercept and modify, this means that you need to embed your own program in the kernel for the Device<-->Host interaction phase. Finding the right spot and putting your own kernel code into it to make it work is not a simple matter.

Upvotes: 0

Scott Chamberlain
Scott Chamberlain

Reputation: 127573

You will need to use a USB Sniffing program like SnoopyPro (freeware open source) to get the data. I do not know if it has a way to forward the capture live to your program but you can save the captures and then do post processing in your own code. This will only work if one of the endpoints is your computer.

If you have two devices that never use your computer you will likely need specialized hardware (the cheepest one is $400 and it will not do the higher speed transfer rates, you need the $1200 model to do that.)

Upvotes: 1

Related Questions