I'm currently in a project that involves the creation of a module that can "snif" usb data passing through with a microcontroller (an Arduino in my case), and store it. To do that, I'm gonna use a usb hub. Since the usb protocol "broadcasts" the data to all the devices in a hub, I'll simply have to connect my sniffer to another port of the hub and catch the data.
Now, the tricky part is, how to read that data without having to code the usb protocol in the Arduino. It's where I need your advices. I've seen a lot of FTDI modules that can get a USB connection and read it with UART 232 protocol. Now, what I want to know is, first, is this possible? Can I connect an FTDI USB/Serial module to the usb hub, and write an Arduino program to read the converted data using the Arduino serial input port? The big problem I see with this solution is that the FTDI chip should never try to talk to the host since it must be invisible. Since the USB protocol don't have an RX and a TX dedicated wire, I cannot simply disconnect a wire to prevent that. Next problem, the usb may go faster than the serial connection, so, I need an FTDI module that can handle a FIFO buffer. Since I cannot talk to the host, I have only one chance to read the USB data. What FTDI module can help me doing this? I need to handle USB 2.0. Low and full speed support is important, but high speed isn't.
I don't know if I'm clear enough, but I can answer your questions!
An FTDI module is not able to do what you want it to do - an FTDI module (the FT232R) acts as a COM port, connected over usb. It only outputs data specifically addressed to it by the host. It does not react to or give you any way to access data intended for other devices.
You would either need a purpose built device for listening in on USB, or a microcontroller with native USB 2.0 support (needing to do USB 2.0 pretty much means you're looking at an ARM, not an AVR) and - unless you can find code someone else did for this - considerable software effort.
Appart from the fact that the protocols between a UART and USB are totally different an Arduino is not a very sutiable platform for this project due to the lack of memory to dump data into and the lack of processing speed. The CPU is only clocked at 16MHz which is much slower than some USB data rates.
An Arduino Due could probably do it but reading and interpreting the USB traffic is a very big task. There are probably pre-built modules out there which do this for you.
You need to identify traffic like "device X wants to identify as a HID (human interface device)" "The PC has accepted the HID request and is now querying to find out the device capabilities" "The device replies with capability X"
The purpose of the MCU was to remove the need for an OS. With an ARM, I'll need a Linux like OS and I'll have to deal with shutdowns, file corruptions, boot delay, storage, etc. After a lot of time searching the net, I didn't find anything implementing a USB sniffer. It looks a bit like hacking, but my project simply needs to get a copy of transfered data to package and analyze it.
There are some software based solutions on BeagleBones and other SBC ont the net, but since it requires a software running on a Linux OS, the result can't be stable as an MCU and/or FPGA solution.