如何拦截Linux上USB设备的消息?

时间:2021-06-01 00:01:38

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.

我有一个流行的绘图板,我用USB连接到我的电脑。连接后,平板电脑会检测手部动作并相应地操纵指针。在某个地方,平板电脑正在将这些数据传输到我的电脑。

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.

我的目标是在处理数据后拦截这些传输并操纵鼠标。我发现的流行语是:设备驱动程序和HID,但我还没有能够拼凑出更多的东西。

Assuming this is possible, I have a few questions:

假设这是可能的,我有几个问题:

  1. How is this done if the data format is known?
  2. 如果数据格式已知,如何完成?
  3. How is this done if the data format is unknown/proprietary?
  4. 如果数据格式未知/专有,如何完成?

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

我的电脑正在运行Ubuntu(但是非常感谢与任何形式的Linux操作系统相关的答案!)。


Note: This question is similar but intended for Windows.

注意:此问题类似,但适用于Windows。

1 个解决方案

#1


25  

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

其实你错过了一个流行语“USB嗅探”。 ;-)

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

这里有一些关于Linux上USB嗅探的教程,可以帮助您入门。

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.

基本上,您使用usbmon Linux内核模块捕获USB数据包,并使用Wireshark作为前端来显示和分析捕获的USB流。

#1


25  

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

其实你错过了一个流行语“USB嗅探”。 ;-)

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

这里有一些关于Linux上USB嗅探的教程,可以帮助您入门。

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.

基本上,您使用usbmon Linux内核模块捕获USB数据包,并使用Wireshark作为前端来显示和分析捕获的USB流。