I am designing a packet interceptor that will allow pass through of a USB barcode scanner to the host unless the packet matches a certain format. Think USB keylogger but instead of copying the sent values, it acts as a gate.

I've seen the microcontroller USB hub controllers that seem to allow programming to allow/deny packet transmission but none give much details (or I'm too inexperienced on the topic to fully understand).

Is this possible and, if so, would a microcontroller USB hub allow this? If not, does anyone have another suggestion for hardware? I want the device to have the ID of a hub so PCs will register what is connected to it rather than trying to install specific drivers for the device itself.

Thanks in advance.

  • \$\begingroup\$ In theory yes, and the hub could also install rogue drivers on your system. Is it possible questions are too broad for this site and a bad way to communicate \$\endgroup\$ – Voltage Spike Apr 19 '18 at 21:40
  • \$\begingroup\$ Since you are designing the "interceptor", care to explain your approach? Which speed, to start? Where did you see "micro-controller USB hub"? \$\endgroup\$ – Ale..chenski Apr 19 '18 at 21:48
  • \$\begingroup\$ One microcontroller hub I was looking at was the Microchip USB5734 shown here microchip.com/wwwproducts/en/USB5734. I haven't gotten down to the speed requirements completely (just started with this today), but it would need to have the memory to support bulk transmission and be full speed atleast, low speed won't work. \$\endgroup\$ – Phillip McMullen Apr 19 '18 at 22:09
  • \$\begingroup\$ The microcontroller in USB5734 has nothing to do with USB data streams. It is only there to provide configuration services, to patch descriptors for user customization, and start-up. The MCU doesn't touch any hub data streams, it just can't. \$\endgroup\$ – Ale..chenski Apr 20 '18 at 20:12
  • \$\begingroup\$ If you need to intercept something at low-full speed, in real time, look up "USB man-in-the-middle" approach. \$\endgroup\$ – Ale..chenski Apr 20 '18 at 23:52

Yes. A microcontroller or SOC or FPGA that can do both host and peripheral devices could intercept packets without the computer knowing or being modified. You can code one to act like a USB hub. The skill and knowledge of how to do that is fairly high level. There is nothing special about USB hubs that can't be done in code if you really wanted to.

  • \$\begingroup\$ This is a highly misleading answer. First, no SoC can keep up with data streams of USB, even at FS rate (with an exception of some odd Parallax 8-core streaming processor). To implement the hub in FPGA it would require an effort of 5-10 engineering men-years of finest VHDL designers. Or you can buy the RTL from Synopsis for some $100k ++. You would need the highest grade and size FPGA, something like Virtex-5 and above, to make the timing. Even if the actual data can be "intercepted", there would be no time to do something with them. This answer is completely out of touch with reality. \$\endgroup\$ – Ale..chenski Apr 20 '18 at 20:08
  • 3
    \$\begingroup\$ Various SoC handle USB host and peripheral all the time, yet you think they can't intercept and act on USB low speed devices like a USB barcode reader aka USB hid? \$\endgroup\$ – Passerby Apr 20 '18 at 21:56
  • \$\begingroup\$ "handling" USB host and peripheral doesn't mean they can act as USB hubs, there is a challenging timing to meet. Maybe someone can craft a virtual USB 3.0 hub from a SoC that has both host and device controllers (due to wide-deferred ACK policy), but it would be a challenging undertaking. Apparently you brutally underestimate the complexity of the issue. \$\endgroup\$ – Ale..chenski Apr 20 '18 at 23:36
  • 1
    \$\begingroup\$ Because a USB BARCODE READER USES USB 3.0 SUPER SPEED or something right? \$\endgroup\$ – Passerby Apr 20 '18 at 23:39
  • \$\begingroup\$ You are right, barcode should go over USB2, which would need to meet impossible timing, right. I am telling you that writing RTL for a USB hub takes 5-10 men-years. The RTL is all software descriptions, and all about making right structures, and state machines. To write a C# software equivalent will take exactly the same amount of efforts. If spending 5-10 years of crafting a code is "nothing special" to you, I bow to your excellence. \$\endgroup\$ – Ale..chenski Apr 20 '18 at 23:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.