-1

Basically I want to control the input of a USB HID via one or more other HIDs.

I know there are commercial options available to do this however they are closed source and expensive. I'd like to get into learning hardware so I was hoping this could be a good learning project.

One idea that came to mind was to use a USB extension cable, strip it, "clamp" both data wires and connect them to GPIO pins. Then I'd clone the signal for the different input types and map them out in software to the other usb devices that are plugged into the pi. (I've got no idea if you can even do something like this)

Here is a diagram of how that might look.

enter image description here

If the above is impossible, another idea was to use a Pi Zero, put it into device mode (to act as a HID). The problem then becomes, how do you connect the additional USB devices to the Pi. I saw USB hubs you could buy for the PI Zero such as the Zero4U. The only question then I have would be, if the PI is in HID mode, would the hub work properly still, or would it somehow put that into HID mode as well.

I already have a PI 3 and a PI Zero so I'm hoping I can use these, but if its impossible with these, I'm open to other suggestions.

  • This is wildly impracticable - for a start USB signalling DOES NOT use GPIO logic levels, but differential signalling. – Milliways Oct 23 '18 at 6:46
  • @Milliways yeah as I dig more into how USB works, I started thinking that as well. That said, would my second idea work, using a Pi Zero in HID mode with a daughter board usb hub on it? – Hex Crown Oct 23 '18 at 6:53
0

Forwarding bulk transfers from source to sink is referred to as USB loopback, and can be done with the g_zero driver (Gadget Zero, used for USB testing) and testusb:

modprobe g_zero
testusb -D /proc/bus/usb/001/002

This should set the OTG port in USB slave mode and forward all traffic from USB bus 1 device 2 to that slave port. You can use usbtree to identify the USB device those traffic you want to pass through.

  • Scratch that, only RPi Zero has OTG and it only has 1 USB controller, so there's no other port you can redirect the traffic from. – Dmitry Grigoryev Jan 22 at 12:54

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.