Restricting USB devices on a per port basis.

Mar 26, 2008 2 Replies

Hello.



I am working on a linux based device that will have two USB ports physically placed in two different places. One of them is to allow for dumping of recorded data to an external USB storage device. The other is to facilitate service by connecting a keyboard (the device will have a touch screen for normal user interaction).



The question is: is there a way to restrict the devices I connect to each port (USB storage in one, keyboard only in the other?)



Thank you very much in advance for your inputs.



Elder.


Only way I know is to get your hands dirty by changing the host USB device driver on your linux kernel. You can even read Vendor ID, Product ID, EP type .....etc and have code that takes conditional action on them. But this approach may take a lot of time for development and testing!

If you use hotplug to detect and load drivers you can modify the udev/hotplug script(s). Hotplug gives you the info on which port the device connected, based on that you can load or not load the usb-driver for the device. I use this trick to allow a USB memory stick only in one special usb socket.

Best regards, Edwin

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required