XP-Pen pen button 2 is interpreted as eraser

In the latest Plasma release (6.3), we got cool drawing tablet interface in the settings.
That is very cool because I regularly use my XP-Pen Deco Pro SW and customizing its behavior (pen buttons and sensitivity, input mapping, custom keys, etc) is not something that was easily doable without third-party software before.

The second button of my pen did nothing for now, so I wanted to rebind it using the neat little graphical interface.


The pen comes with two buttons . I tried binding the two of them to separate keyboard buttons, but the Pen Button 2 never actually triggers.

When testing input, using libinput debug-events /dev/input/event16, it shows the first physical button is well-recieved :

event17  TABLET_TOOL_BUTTON          +171.404s 331 (BTN_STYLUS) pressed, seat count: 1
event17  TABLET_TOOL_AXIS            +171.408s         199.86*/49.28*  tilt: 13.10*/-18.90*    pressure: 0.00
event17  TABLET_TOOL_AXIS          2 +171.414s         199.87*/49.77*  tilt: 13.98*/-13.35*    pressure: 0.00
// holding the button just makes the counter in the third column increase. I hid consecutive lines that were very similar to this one ^
event17  TABLET_TOOL_BUTTON          +172.316s 331 (BTN_STYLUS) released, seat count: 0

But a press on the second physical button is actually understood as the eraser appearing and disappearing :

event17  TABLET_TOOL_PROXIMITY       +76.152s          138.60/84.89    tilt: 25.20/0.00        pressure: 0.00  pen      (0, id 0) proximity-out
event17  TABLET_TOOL_PROXIMITY       +76.152s          138.60*/84.89*  tilt: 25.20*/0.00*      pressure: 0.00* eraser   (0, id 0) proximity-in         axes:pt btn:S
event17  TABLET_TOOL_AXIS            +76.166s          138.61*/84.87*  tilt: 25.32*/0.00       pressure: 0.00
// holding the button just makes the counter in the third column increase. I hid consecutive lines that were very similar to this one ^
event17  TABLET_TOOL_PROXIMITY       +76.256s          138.60/84.92    tilt: 24.69/0.00        pressure: 0.00  eraser   (0, id 0) proximity-out
event17  TABLET_TOOL_PROXIMITY       +76.302s          138.14*/84.79*  tilt: 24.69*/0.00*      pressure: 0.00* pen      (0, id 0) proximity-in         axes:pt btn:S

So it seems I cannot remap that.
Is anyone in a similar situation, and/or managed to remap that button with the built-in drivers ? (remapping via OpenTabletDriver works)

In the end, I don’t know if that’s a driver issue, or if the kde/plasma devs can do anything for this ?

System info :

Operating System: Garuda Linux
KDE Plasma Version: 6.3.0
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.2
Kernel Version: 6.13.2-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 12 × 12th Gen Intel® Core™ i5-12450H
Memory: 15.3 GiB of RAM
Graphics Processor: Intel® Graphics

This is a driver issue, however taking a look at the kernel mailing list there should be support for your tablet already. Can confirm at least that the hid_uclogic driver is loaded with lsmod?

It is not :

$ lsmod | grep hid_
hid_multitouch         36864  0
hid_generic            12288  0
i2c_hid_acpi           12288  0
i2c_hid                45056  1 i2c_hid_acpi

Plugging in the tablet, lshw says that driver usbhid is managing it :

lshw excerpt
*-usb:2
description: USB controller
product: Alder Lake PCH USB 3.2 xHCI Host Controller
vendor: Intel Corporation
physical id: 14
bus info: pci@0000:00:14.0
version: 01
width: 64 bits
clock: 33MHz
capabilities: pm msi xhci bus_master cap_list
configuration: driver=xhci_hcd latency=0
resources: irq:133 memory:60380000-6038ffff
  *-usbhost:0
   product: xHCI Host Controller
   vendor: Linux 6.13.2-zen1-1-zen xhci-hcd
   physical id: 0
   bus info: usb@3
   logical name: usb3
   version: 6.13
   capabilities: usb-2.00
   configuration: driver=hub slots=12 speed=480Mbit/s
     *-usb:0
      description: Mouse
      product: UGTABLET Deco Pro SW
      vendor: UGTABLET
      physical id: 4
      bus info: usb@3:4
      logical name: input26
      logical name: /dev/input/event15
      logical name: /dev/input/mouse2
      logical name: input27
      logical name: /dev/input/event16
      logical name: input28
      logical name: /dev/input/event17
      logical name: /dev/input/mouse3
      version: 0.00
      capabilities: usb-2.00 usb
      configuration: driver=usbhid maxpower=70mA speed=12Mbit/s

Modinfo finds the driver :

Summary
$ modinfo hid_uclogic

filename:       /lib/modules/6.13.2-zen1-1-zen/kernel/drivers/hid/hid-uclogic.ko.zst
description:    HID driver for UC-Logic devices not fully compliant with HID standard
license:        GPL
description:    HID driver for UC-Logic devices not fully compliant with HID standard
author:         Nikolai Kondrashov
author:         Martin Rusko
srcversion:     F1284B34FA0CAFF76F19101
alias:          hid:b0003g*v000028BDp00000078
alias:          hid:b0003g*v000028BDp00000933
alias:          hid:b0003g*v000028BDp00000909
alias:          hid:b0003g*v000028BDp00000934
alias:          hid:b0003g*v000028BDp00000935
alias:          hid:b0003g*v000028BDp00000905
alias:          hid:b0003g*v000028BDp00000042
alias:          hid:b0003g*v000028BDp00000094
alias:          hid:b0003g*v000028BDp00000075
alias:          hid:b0003g*v000028BDp00000055
alias:          hid:b0003g*v000028BDp00000071
alias:          hid:b0003g*v000028BDp00000074
alias:          hid:b0003g*v000028BDp00001903
alias:          hid:b0003g*v00002179p00000077
alias:          hid:b0003g*v00002179p00000053
alias:          hid:b0003g*v00005543p00003031
alias:          hid:b0003g*v00005543p00000047
alias:          hid:b0003g*v00005543p00000045
alias:          hid:b0003g*v00005543p00000081
alias:          hid:b0003g*v00005543p0000004D
alias:          hid:b0003g*v00005543p0000006E
alias:          hid:b0003g*v0000145Fp00000212
alias:          hid:b0003g*v0000256Cp0000006D
alias:          hid:b0003g*v0000256Cp0000006E
alias:          hid:b0003g*v00005543p00000781
alias:          hid:b0003g*v00005543p00000522
alias:          hid:b0003g*v00005543p00000064
alias:          hid:b0003g*v00005543p00000005
alias:          hid:b0003g*v00005543p00000004
alias:          hid:b0003g*v00005543p00000003
alias:          hid:b0003g*v00005543p00000042
depends:        usbhid
intree:         Y
name:           hid_uclogic
retpoline:      Y
vermagic:       6.13.2-zen1-1-zen SMP preempt mod_unload
sig_id:         PKCS#7
signer:         Build time autogenerated kernel key
sig_key:        59:09:3C:51:B0:07:5E:75:E1:D7:D3:F4:C4:B8:A1:BC:AC:78:8B:13
sig_hashalgo:   sha512
signature:      30:65:02:30:3E:F4:8F:86:CE:13:5A:95:80:B0:8D:30:0D:75:1A:5B:
C7:07:14:8D:98:9E:75:65:CE:53:2C:B5:13:90:08:E9:03:ED:D5:4B:
4B:EE:1D:07:2C:19:73:3D:A4:11:38:EE:02:31:00:E1:CB:A2:AF:3D:
79:C3:75:43:1C:1A:F4:52:06:A5:CE:E5:53:DA:52:50:47:91:DC:27:
7C:9D:18:12:CC:AF:02:FE:3E:91:5B:CD:7A:1C:34:D6:A9:F6:16:85:
B5:EA:1B

From there I tried to load the driver :

$ sudo modprobe hid_uclogic -v
insmod /usr/bin/true

Which led me to this issue on github : \https://github.com/ublue-os/config/issues/222 (can’t put in the link, sorry for the syntax). Issue name is OpenTabletDriver module blacklist file is not included · Issue #222 · ublue-os/config · GitHub
I have OpenTabletDriver installed. It is never loaded automatically, but I guess its modprobe rules are always active.
The File: /usr/lib/modprobe.d/99-opentabletdriver.conf did exist and its contents were

install wacom /usr/bin/true
install hid_uclogic /usr/bin/true

I commented them out, sudo modeprobe hid_uclogic’d in, and now every button works (the two pen, and the eight tablet) !
The scroll wheel and its touchpad are still not functional, but they are just not suported yet iirc. Ironically, the scroll wheel worked with the usbhid driver, but I guess it will come in due time.

Anyhow, thanks a lot for pointing me towards the right direction !

1 Like

No thank you, I didn’t know OpenTabletDriver blacklists those kernel drivers until now!

1 Like

By the way, connecting the tablet via bluetooth doesn’t make hid_uclogic take control of the device (so the behavior is similar to the one described in post #1), is that expected ?

Just a tip about remappiing input device, I have no experience with graphic tablet but with keyboard remapping though some useful stuff:

  • it is possible to remap input at the udev level by way of the hardware database (hwdb), look in `/usr/lib/udev/hwdb.d/
  • one usefull tool to remap input (mostly keyboard and mouse but stylus seems supported) is keyd, it is a remapper app which also work at low kernel level (not a userspace remapper), it use a config file in /etc/keyd, no GUI but it is relatively easy to use.
2 Likes