You know, I'm not really a fan of Linux. Usually, shit is completely fucked when you plug something new in. On the flipside, once everything is setup & configured in the most cryptic way possible, things generally keep working.
Not this time though.
I programmed a simple blackboard application to be used with my tablet. The idea is not to do anything serious in it, but to have a virtual (dark) whiteboard where I can quickly visualize something for myself, without having to wait for GIMP / Krita to boot up and being required to setup canvas sizes, colors, etc. I'm pretty happy with the application (despite my utter hate for Wayland), and all of the buttons of the tablet are usable: There's the buttons on tablet itself, but there's also two buttons on the tablet pen, which I use for a quick switch between erasing/drawing, as well as to move around on the canvas.
Last time I used the application, I noticed that I couldn't use the tablet buttons at all. Very annoying because the undo & redo buttons are mapped on there, as well as the Zoom In/Out.
As I mentioned before, I hate programming for Wayland. I did finally pull out some common code for window creation & input handling into some helper utilities, such that I can hopefully keep my interaction with the awful Wayland-way of doing to a minimum. I have also updated my blackboard application to make use of that utility, and I couldn't remember whether I actually tested the tablet buttons back then, so I thought this was my own fault.
I have updated the weird Wayland libraries / xml files, re-generated the headers - no dice. Stepping through my code it seems like the tablet (and tablet tools) are properly registered. I can get pen-events and pen-button-events just fine, but no tablet-button-events. I tried to register more callback functions in case I was relying on some undefined behavior of the compositor - nothing.
I checked through the github issues of the Wayland Compositor I use (sway). Again, nothing in regards to "hey we fucked up tablets oopsie" came up. Quick look at the code: There's really not much code for tablet inputs. So I started a second instance of the compositor with logs and went through them: Couldn't find anything suspicious there either.
Next stop: libinput
. I saw libinput
references in the code,
and when googling tablet wayland input issues, some people suggest
checking out the following command in order to see, whether the input events
are generated properly:
> libinput debug-events --verbose
Aha! I don't get any button events when pressing the tablet buttons. In contrast, I lots of events whenever I move the tablet-pen (apparently even with angles, I didn't know the tablet could do that), and the tablet-pen-buttons also generate events. Plugging in the tablet generates events looking like this:
event9 - Hanvon Ugee Technology Co.,Ltd Deco L: is tagged by udev as: Mouse Tablet
event9 - Hanvon Ugee Technology Co.,Ltd Deco L: libinput bug: missing tablet capabilities: xy pen btn-stylus resolution. Ignoring this device.
event9 - Hanvon Ugee Technology Co.,Ltd Deco L: device is a tablet
event9 - failed to create input device '/dev/input/event9'
event11 - Hanvon Ugee Technology Co.,Ltd Deco L: is tagged by udev as: Tablet
event11 - Hanvon Ugee Technology Co.,Ltd Deco L: libinput bug: missing tablet capabilities: xy pen btn-stylus resolution. Ignoring this device.
event11 - Hanvon Ugee Technology Co.,Ltd Deco L: device is a tablet
event11 - failed to create input device '/dev/input/event11'
event10 - Hanvon Ugee Technology Co.,Ltd Deco L: is tagged by udev as: Tablet
event10 - Hanvon Ugee Technology Co.,Ltd Deco L: device is a tablet
-event10 DEVICE_ADDED Hanvon Ugee Technology Co.,Ltd Deco L seat0 default group2 cap:T size 254x152mm left
"bug" doesn't sound too good, but "tablet capabilites [...] pen" makes it sound like it's looking for
the tablet pen. The tablet, in linux, apparently consists of several devices, so I wouldn't be
too surprised if only one of the devices is responsible for cursor input.
So onto libinput
, someone fucked up my shit >:(
Well, there are closed issues on libinput
referencing broken tablet buttons, but no
new or open stuff. The most relevant stuff I could find is
this issue, which
is several years old already.
But turns out, I'm having the same problem:
Looking at this response, and through another similar issue, I get mixed feelings:
ID_INPUT_TABLET_PAD
is not set in udev
. No idea what that means.libinput
is not responsible for that, it's relying on libwacom
. So that's the next stop.
There's similar stuff described in
this blogpost
for (or from?) libinput.
My tablet device is missing a tag. It's supposed to get it from libwacom
, but
Too Bad!
In the repository, I found the file for my tablet.
Class=
keyword - no idea what that means.
So I decided to pivot. I supposedly just need this one ID_INPUT_TABLET_PAD
tag on
my tablet, can't be that fucking difficult, right?
Googling. Lots of googling. Trying lots of different commands. Without any more side-tracks,
here are the keypoints from my udev
shenanigans:
/etc/udev/rules.d/[anyName].rules
.udevadm monitor -p
So, let's look the output of that udev-command. There's a lot in there, but some of the entries look like this on my end:
[... lots of stuff here ...]
UDEV [1003.360012] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-6/1-6.1/1-6.1:1.0/0003:28BD:0935.001D/input/input49/event9 (input)
ACTION=add
DEVLINKS=/dev/input/by-id/usb-Hanvon_Ugee_Technology_Co._Ltd_Deco_L_0000000000-event-mouse /dev/input/by-path/pci-0000:02:00.0-usb-0:6.1:1.0-event-mouse
DEVNAME=/dev/input/event9
DEVPATH=/devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-6/1-6.1/1-6.1:1.0/0003:28BD:0935.001D/input/input49/event9
ID_BUS=usb
ID_INPUT=1
ID_INPUT_MOUSE=1
ID_MODEL=Deco_L
ID_MODEL_ENC=Deco\x20L
ID_MODEL_ID=0935
ID_PATH=pci-0000:02:00.0-usb-0:6.1:1.0
ID_PATH_TAG=pci-0000_02_00_0-usb-0_6_1_1_0
ID_REVISION=0000
ID_SERIAL=Hanvon_Ugee_Technology_Co._Ltd_Deco_L_0000000000
ID_SERIAL_SHORT=0000000000
ID_TYPE=hid
ID_USB_DRIVER=usbhid
ID_USB_INTERFACES=:030002:030000:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=Hanvon_Ugee_Technology_Co._Ltd
ID_VENDOR_ENC=Hanvon\x20Ugee\x20Technology\x20Co.\x2cLtd
ID_VENDOR_ID=28bd
LIBINPUT_DEVICE_GROUP=3/28bd/935:usb-0000:02:00.0-6
MAJOR=13
MINOR=73
SEQNUM=5784
SUBSYSTEM=input
USEC_INITIALIZED=3359948
UDEV [1003.360348] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-6/1-6.1/1-6.1:1.2/0003:28BD:0935.001F/input/input50/event10 (input)
ACTION=add
DEVLINKS=/dev/input/by-id/usb-Hanvon_Ugee_Technology_Co._Ltd_Deco_L_0000000000-if02-event-mouse /dev/input/by-path/pci-0000:02:00.0-usb-0:6.1:1.2-event-mouse
DEVNAME=/dev/input/event10
DEVPATH=/devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-6/1-6.1/1-6.1:1.2/0003:28BD:0935.001F/input/input50/event10
ID_BUS=usb
ID_INPUT=1
ID_INPUT_HEIGHT_MM=152
ID_INPUT_WIDTH_MM=254
ID_MODEL=Deco_L
ID_MODEL_ENC=Deco\x20L
ID_MODEL_ID=0935
ID_PATH=pci-0000:02:00.0-usb-0:6.1:1.2
ID_PATH_TAG=pci-0000_02_00_0-usb-0_6_1_1_2
ID_REVISION=0000
ID_SERIAL=Hanvon_Ugee_Technology_Co._Ltd_Deco_L_0000000000
ID_SERIAL_SHORT=0000000000
ID_TYPE=hid
ID_USB_DRIVER=usbhid
ID_USB_INTERFACES=:030002:030000:
ID_USB_INTERFACE_NUM=02
ID_VENDOR=Hanvon_Ugee_Technology_Co._Ltd
ID_VENDOR_ENC=Hanvon\x20Ugee\x20Technology\x20Co.\x2cLtd
ID_VENDOR_ID=28bd
LIBINPUT_DEVICE_GROUP=3/28bd/935:usb-0000:02:00.0-6
MAJOR=13
MINOR=74
SEQNUM=5795
SUBSYSTEM=input
USEC_INITIALIZED=3360267
[... some more stuff ...]
UDEV [1003.367906] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-6/1-6.1/1-6.1:1.2/0003:28BD:0935.001F/input/input51/event11 (input)
ACTION=add
DEVLINKS=/dev/input/by-id/usb-Hanvon_Ugee_Technology_Co._Ltd_Deco_L_0000000000-event-if02 /dev/input/by-path/pci-0000:02:00.0-usb-0:6.1:1.2-event
DEVNAME=/dev/input/event11
DEVPATH=/devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-6/1-6.1/1-6.1:1.2/0003:28BD:0935.001F/input/input51/event11
ID_BUS=usb
ID_INPUT=1
ID_MODEL=Deco_L
ID_MODEL_ENC=Deco\x20L
ID_MODEL_ID=0935
ID_PATH=pci-0000:02:00.0-usb-0:6.1:1.2
ID_PATH_TAG=pci-0000_02_00_0-usb-0_6_1_1_2
ID_REVISION=0000
ID_SERIAL=Hanvon_Ugee_Technology_Co._Ltd_Deco_L_0000000000
ID_SERIAL_SHORT=0000000000
ID_TYPE=hid
ID_USB_DRIVER=usbhid
ID_USB_INTERFACES=:030002:030000:
ID_USB_INTERFACE_NUM=02
ID_VENDOR=Hanvon_Ugee_Technology_Co._Ltd
ID_VENDOR_ENC=Hanvon\x20Ugee\x20Technology\x20Co.\x2cLtd
ID_VENDOR_ID=28bd
LIBINPUT_DEVICE_GROUP=3/28bd/935:usb-0000:02:00.0-6
MAJOR=13
MINOR=75
SEQNUM=5797
SUBSYSTEM=input
USEC_INITIALIZED=3367843
[... lots more stuff ...]
Important stuff:
ID_INPUT
as pointed out in the gitlab issue, but ID_INPUT_TABLET_PAD
is indeed missing.
I found
this post
to create custom udev rules.
After a bit of trial and error, I deduced
that the things listed in the udev-command, like ID_INPUT_TABLET
,
correspond to ENV{ID_INPUT_TABLET}
for udev rules.
The tutorial uses idVendor
and idProduct
to target a device.
This looks like ID_VENDOR_ID
and ID_MODEL_ID
in the udev-command-output,
but I doubled checked just in case:
doas dmesg
[ 7411.920304] usb 1-6.1: new full-speed USB device number 27 using xhci_hcd
[ 7412.335132] usb 1-6.1: New USB device found, idVendor=28bd, idProduct=0935, bcdDevice= 0.00
[ 7412.335137] usb 1-6.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 7412.335140] usb 1-6.1: Product: Deco L
[ 7412.335142] usb 1-6.1: Manufacturer: Hanvon Ugee Technology Co.,Ltd
[ 7412.335144] usb 1-6.1: SerialNumber: 0000000000
I'll post the solution (to my problem) at the bottom. But first, a small headsup:
I initially tried to create a custom rule to just add ID_INPUT_TABLET_PAD
to any input device
which matched the vendor- & model-id. While it did add the tag, it rendered my tablet unusable.
Apparently the tag needs to be present at the correct linux device, not simply all three.
So I started comparing the different outputs of the udevadm monitor -p
once more.
I didn't want to pick something like DEVNAME
, DEVPATH
or USEC_INITIALIZED
, because
these things seem prone to change (on replug / reboot / different USB slot, etc).
Lots of properties look the same, but the one differentiator that I have found which
(hopefully) works is:
// input49
MAJOR=13
MINOR=73
// input50
MAJOR=13
MINOR=74
// input51
MAJOR=13
MINOR=75
I know that one of these is for the pen input, which leaves two other MINOR
. I just
tried one, and it seems to work (for now)!
Now as promised:
For future me, these are the specific steps I used to fix the issue:
1.) Create the file /etc/udev/rules.d/99-xppen.rules
with the following content:
ACTION=="add|change", SUBSYSTEM=="input", ATTRS{idProduct}=="0935", ATTRS{idVendor}=="28bd", ENV{MINOR}=="75", ENV{ID_INPUT_TABLET_PAD}="1"
2.) Either reboot, or run:
> doas udevadm control --reload-rules && udevadm trigger