sdasdadas sdasdadas - 2 months ago 12
Linux Question

How do I intercept messages from a USB device on Linux?

I have a popular drawing tablet that I connect to my PC with USB. Once connected, the tablet detects hand movements and manipulates the pointer accordingly. Somewhere, the tablet is transmitting this data to my computer.

My goal is to intercept these transmissions and manipulate the mouse after I process the data. The buzzwords I have found are: device drivers and HID, but I haven't been able to piece together much more than that.

Assuming this is possible, I have a few questions:


  1. How is this done if the data format is known?

  2. How is this done if the data format is unknown/proprietary?



My computer is running Ubuntu (but answers related to any form of a Linux OS are greatly appreciated!).




Note: This question is similar but intended for Windows.

Answer

Actually you missed a buzzword "USB sniffing". ;-)

Here are a few tutorials on USB sniffing on Linux, to get you started.

Essentially you use the usbmon Linux kernel module to capture the USB-packets and Wireshark as a front-end to display and analyse the captured USB stream.