I'm attemping to use a VEIKK graphics tablet in Kubuntu 19.10. I've got a satisfactory setup so far, but the only thing remaining is remapping the stylus buttons. I feel like I have all the ingredients to do so, but can't figure out how to put it all together.
evtest identifies the input in question:
/dev/input/event3: VEIKK S640 Pen
Running evtest on this input reports:
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x2feb product 0x1 version 0x100
Input device name: "VEIKK S640 Pen"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 330 (BTN_TOUCH)
Event code 331 (BTN_STYLUS)
Event code 332 (BTN_STYLUS2)
Event type 3 (EV_ABS)
Event code 0 (ABS_X)
Value 15580
Min 0
Max 98304
Resolution 1
Event code 1 (ABS_Y)
Value 13040
Min 0
Max 32768
Resolution 1
Event code 24 (ABS_PRESSURE)
Value 1670
Min 0
Max 8192
And indeed, when pressing the stylus button, I see
Event: time 1586123903.365325, type 1 (EV_KEY), code 331 (BTN_STYLUS), value 1
followed later by
Event: time 1586123903.499328, type 1 (EV_KEY), code 331 (BTN_STYLUS), value 0
What I would like to do is simply replace these generated events with different events, say
type 1 (EV_KEY), code 30 (KEY_A), value 1
for the first and similarly for the second, so that pressing the stylus button is the same as pressing the a key down (and up) on the keyboard.
There are several closely related questions on this site, this being probably the closest, but the proposed solutions and final solution are quite kludgy. I've also prototyped writing a python-evdev script to "filter" these events into something, but that comes with its own problems.
So, is there any standard way to accomplish this using udev?