我有一台 Wacom Cintiq 24HD 平板电脑/屏幕,上面有几组按钮。大多数按钮工作正常 [编辑:并且可以使用 xsetwacom 配置],但屏幕顶部有一组按钮(实际上是触摸按钮)无法在 Ubuntu GUI 堆栈中完全注册。
选择最左边的三个按钮,即标有I
。如果我直接按下它,什么也不会发生。如果我使用xev
,按钮不会触发任何输出(与工作按钮相反),但和sudo showkey
确实sudo evtest
都显示按钮在内核中注册(我想)。我已将键码标识为202
:
% sudo evtest /dev/input/event4
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x56a product 0xf4 version 0x110
Input device name: "Wacom Cintiq 24HD Pad"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 148 (KEY_PROG1)
Event code 149 (KEY_PROG2)
Event code 202 (KEY_PROG3)
Event code 256 (BTN_0)
Event code 257 (BTN_1)
Event code 258 (BTN_2)
Event code 259 (BTN_3)
Event code 260 (BTN_4)
Event code 261 (BTN_5)
Event code 262 (BTN_6)
Event code 263 (BTN_7)
Event code 264 (BTN_8)
(output trimmed)
Event: time 1477672672.059563, type 1 (EV_KEY), code 202 (KEY_PROG3), value 1
Event: time 1477672672.059563, type 3 (EV_ABS), code 40 (ABS_MISC), value 15
Event: time 1477672672.059563, -------------- SYN_REPORT ------------
Event: time 1477672672.291614, type 1 (EV_KEY), code 202 (KEY_PROG3), value 0
Event: time 1477672672.291614, type 3 (EV_ABS), code 40 (ABS_MISC), value 0
Event: time 1477672672.291614, -------------- SYN_REPORT ------------
showkey
同意evtest
密钥代码为202
:
% sudo showkey -k
kb mode was ?UNKNOWN?
[ if you are trying this under X, it might not work
since the X server is also reading /dev/console ]
press any key (program terminates 10s after last keypress)...
keycode 28 release
keycode 202 press
keycode 202 release
但是,我想真正使用该按钮来做某事,因此,如果我尝试出于测试目的将该按钮临时分配给键“a”,它似乎不起作用。
xmodmap -e "keycode 202 = a"
如果我在终端仿真器中按下按钮,则不会输出“a”。
是不是我使用 xmodmap 出了什么问题,或者我可以使用其他工具来让按下此按钮时发生一些事情?我最终希望按钮能够触发脚本,但如果我可以通过将按钮重新映射到其他带有修饰键的键来间接地做到这一点,那也很好。现在我不知道下一步该尝试什么。
答案1
使用 xsetwacom:
http://linuxwacom.sourceforge.net/wiki/index.php/Tablet_Configuration
(另请参阅“man xsetwacom”)
使用以下方式查找您的设备
xsetwacom list
示例输出:
Wacom DTK2241 Pad pad id: 12 type: PAD
Wacom DTK2241 Pen stylus id: 13 type: STYLUS
Wacom DTK2241 Pen eraser id: 14 type: ERASER
我的设备是 DTK2241,因此我将使用下面这个示例:
xsetwacom -s get "Wacom DTK2241 Pad pad" all
然后对于 pad 设备列出可用的按钮:
xsetwacom -s get "Wacom DTK2241 Pad pad" all
示例输出:
xsetwacom set "Wacom DTK2241 Pad pad" "Button" "1" "button +1 "
xsetwacom set "Wacom DTK2241 Pad pad" "Button" "2" "+2 "
xsetwacom set "Wacom DTK2241 Pad pad" "Button" "3" "+3 "
xsetwacom set "Wacom DTK2241 Pad pad" "Button" "8" "+8 "
xsetwacom set "Wacom DTK2241 Pad pad" "Button" "9" "+9 "
xsetwacom set "Wacom DTK2241 Pad pad" "Button" "10" "+10 "
....
然后设置一个按钮,例如:
xsetwacom set "Wacom DTK2241 Pad pad" "Button" "1" "key a"