模拟手写笔输入
Simulate Stylus Input
我正在寻找一种将 wacom 输入注入 运行 X 服务器的方法。我有点卡在一开始就找不到关于这个主题的任何资源。
有很多关于如何注入击键和鼠标输入的信息,但这不是我要找的,而且它似乎没有模拟 wacom 的东西。
有人知道关于这个话题的信息吗?
On Linux, the various input devices generate a variety of events.
例如,
Keyboards - EV_KEY
Mice - EV_REL
Tablets - EV_ABS
任何特定输入设备的事件 supported/generated 可以通过连接到输入设备的系统上的 运行 xinput
来识别它如下:
xinput --list <name of the connected input device>
通过连接 Wacom 数位板创建的输入设备示例列表:
$ > xinput --list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=14 [slave pointer (2)]
⎜ ↳ Wacom Intuos4 6x9 eraser id=17 [slave pointer (2)]
⎜ ↳ Wacom Intuos4 6x9 cursor id=18 [slave pointer (2)]
⎜ ↳ Wacom Intuos4 6x9 pad id=19 [slave pointer (2)]
⎜ ↳ Wacom Intuos4 6x9 stylus id=20 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=13 [slave keyboard (3)]
..以及注册为来自 Wacom 数位板的输入事件的 4 个 Wacom 设备之一的输入事件列表 supported/generated:
$ > xinput --list "Wacom Intuos4 6x9 eraser"
Wacom Intuos4 6x9 eraser id=17 [slave pointer (2)]
Reporting 8 classes:
Class originated from: 17
Buttons supported: 9
Button labels: None None None None None None None None None
Button state:
Class originated from: 17
Keycodes supported: 248
Class originated from: 17
Detail for Valuator 0:
Label: Abs X
Range: 0.000000 - 44704.000000
Resolution: 200000 units/m
Mode: absolute
Current value: 0.000000
Class originated from: 17
Detail for Valuator 1:
Label: Abs Y
Range: 0.000000 - 27940.000000
Resolution: 200000 units/m
Mode: absolute
Current value: 0.000000
Class originated from: 17
Detail for Valuator 2:
Label: Abs Pressure
Range: 0.000000 - 2048.000000
Resolution: 1 units/m
Mode: absolute
Current value: 0.000000
Class originated from: 17
Detail for Valuator 3:
Label: Abs Tilt X
Range: -64.000000 - 63.000000
Resolution: 1 units/m
Mode: absolute
Current value: 0.000000
Class originated from: 17
Detail for Valuator 4:
Label: Abs Tilt Y
Range: -64.000000 - 63.000000
Resolution: 1 units/m
Mode: absolute
Current value: 0.000000
Class originated from: 17
Detail for Valuator 5:
Label: Abs Tilt Y
Range: -64.000000 - 63.000000
Resolution: 1 units/m
Mode: absolute
Current value: 0.000000
The above shows 9 buttons, and several axes with their corresponding min/max values for each type of input event(referred to by their lables).
例如,绝对 x 轴的 min/max 为 0 - 44704 个单位,有 20000 units/m。推测类型 EV_ABS
的输入事件仅在 X-axis.
的此范围内生成
Once the types of events being generated by the input device have been identified, it is easy to inject fake events into the Xinput queue using uinput
framework. A simple example is available here
当您打算模拟 Wacom 数位板时,您可能需要注入典型 Wacom 数位板在使用时生成的所有输入事件。
xinput
can be used to monitor the sequence and timing of input events generated by an actual device as shown in this answer.
我正在寻找一种将 wacom 输入注入 运行 X 服务器的方法。我有点卡在一开始就找不到关于这个主题的任何资源。
有很多关于如何注入击键和鼠标输入的信息,但这不是我要找的,而且它似乎没有模拟 wacom 的东西。
有人知道关于这个话题的信息吗?
On Linux, the various input devices generate a variety of events.
例如,
Keyboards - EV_KEY
Mice - EV_REL
Tablets - EV_ABS
任何特定输入设备的事件 supported/generated 可以通过连接到输入设备的系统上的 运行 xinput
来识别它如下:
xinput --list <name of the connected input device>
通过连接 Wacom 数位板创建的输入设备示例列表:
$ > xinput --list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=14 [slave pointer (2)]
⎜ ↳ Wacom Intuos4 6x9 eraser id=17 [slave pointer (2)]
⎜ ↳ Wacom Intuos4 6x9 cursor id=18 [slave pointer (2)]
⎜ ↳ Wacom Intuos4 6x9 pad id=19 [slave pointer (2)]
⎜ ↳ Wacom Intuos4 6x9 stylus id=20 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=13 [slave keyboard (3)]
..以及注册为来自 Wacom 数位板的输入事件的 4 个 Wacom 设备之一的输入事件列表 supported/generated:
$ > xinput --list "Wacom Intuos4 6x9 eraser"
Wacom Intuos4 6x9 eraser id=17 [slave pointer (2)]
Reporting 8 classes:
Class originated from: 17
Buttons supported: 9
Button labels: None None None None None None None None None
Button state:
Class originated from: 17
Keycodes supported: 248
Class originated from: 17
Detail for Valuator 0:
Label: Abs X
Range: 0.000000 - 44704.000000
Resolution: 200000 units/m
Mode: absolute
Current value: 0.000000
Class originated from: 17
Detail for Valuator 1:
Label: Abs Y
Range: 0.000000 - 27940.000000
Resolution: 200000 units/m
Mode: absolute
Current value: 0.000000
Class originated from: 17
Detail for Valuator 2:
Label: Abs Pressure
Range: 0.000000 - 2048.000000
Resolution: 1 units/m
Mode: absolute
Current value: 0.000000
Class originated from: 17
Detail for Valuator 3:
Label: Abs Tilt X
Range: -64.000000 - 63.000000
Resolution: 1 units/m
Mode: absolute
Current value: 0.000000
Class originated from: 17
Detail for Valuator 4:
Label: Abs Tilt Y
Range: -64.000000 - 63.000000
Resolution: 1 units/m
Mode: absolute
Current value: 0.000000
Class originated from: 17
Detail for Valuator 5:
Label: Abs Tilt Y
Range: -64.000000 - 63.000000
Resolution: 1 units/m
Mode: absolute
Current value: 0.000000
The above shows 9 buttons, and several axes with their corresponding min/max values for each type of input event(referred to by their lables).
例如,绝对 x 轴的 min/max 为 0 - 44704 个单位,有 20000 units/m。推测类型 EV_ABS
的输入事件仅在 X-axis.
Once the types of events being generated by the input device have been identified, it is easy to inject fake events into the Xinput queue using
uinput
framework. A simple example is available here
当您打算模拟 Wacom 数位板时,您可能需要注入典型 Wacom 数位板在使用时生成的所有输入事件。
xinput
can be used to monitor the sequence and timing of input events generated by an actual device as shown in this answer.