I'm using Kubuntu 16.04 (xenial) on a laptop with an ELAN Touchscreen together with a DELL 750-AAHC active stylus. One of the buttons on the stylus behaves as a mouse middle-button, and I want it to be a right button instead.
I can achieve this by doing
$ xinput set-button-map "ELAN Touchscreen Pen" 1 3 2
(i.e., mapping the function of button 3, which must correspond to the right button, to physical button 2).
This does what I want, but the change is not permanent.
I added the command in
~/.xsessionrc (according to the answer on this post), so it's run automatically when I reboot, but the button mapping "randomly" reverts to default on its own: it's working as expected for a while, and suddenly I discover that it doesn't, so I get
$ xinput get-button-map "ELAN Touchscreen Pen" 1 2 3 4 5
and I have to remap it manually.
I tried a few "suspect" things to see what might be responsible for reverting, but I couldn't figure it out. It's not caused by
- suspending the laptop or turning off the screen
- rotating the screen (this was suspect because xinput is used on rotation to transform the input matrix.)
- toggling touchscreen, touchpad or stylus input on/off (also with xinput).
I've discovered that this problem is not specific to the stylus: I disabled the finger-touch capability of the screen ("ELAN Touchscreen") earlier for some reason by doing:
$ xinput disable "ELAN Touchscreen"
and I just discovered that it came back on its own (and the stylus right-click had again reverted). So it seems like all xinput changes revert to default for this unknown reason.
I found some suspicious entries in
/var/log/syslog when this happened again. The timestamps were during a time I had not actually been using the laptop for some time, so energy-saving features were probably activated (I have "dim screen" at 9 mins and "switch off" at 10 mins; I will experiment with energy saving and update accordingly).
The pattern bellow is actually repeated many times, with only a few seconds difference between each block.
usb 1-8: USB disconnect, device number 18 usb 1-8: new full-speed USB device number 19 using xhci_hcd usb 1-8: New USB device found, idVendor=04f3, idProduct=2073 usb 1-8: New USB device strings: Mfr=4, Product=14, SerialNumber=0 usb 1-8: Product: Touchscreen usb 1-8: Manufacturer: ELAN input: ELAN Touchscreen Pen as /devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8:1.0/0003:04F3:2073.04EE/input/input7548 input: ELAN Touchscreen as /devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8:1.0/0003:04F3:2073.04EE/input/input7549 input: ELAN Touchscreen Keyboard as /devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8:1.0/0003:04F3:2073.04EE/input/input7552 hid-multitouch 0003:04F3:2073.04EE: input,hiddev0,hidraw0: USB HID v1.10 Keyboard [ELAN Touchscreen] on usb-0000:00:14.0-8/input0
In each block, almost everything is the same except a few numbers that increase. Here's the next block for comparison:
usb 1-8: USB disconnect, device number 19 usb 1-8: new full-speed USB device number 20 using xhci_hcd usb 1-8: New USB device found, idVendor=04f3, idProduct=2073 usb 1-8: New USB device strings: Mfr=4, Product=14, SerialNumber=0 usb 1-8: Product: Touchscreen usb 1-8: Manufacturer: ELAN input: ELAN Touchscreen Pen as /devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8:1.0/0003:04F3:2073.04EF/input/input7554 input: ELAN Touchscreen as /devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8:1.0/0003:04F3:2073.04EF/input/input7555 input: ELAN Touchscreen Keyboard as /devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8:1.0/0003:04F3:2073.04EF/input/input7558 hid-mul itouch 0003:04F3:2073.04EF: input,hiddev0,hidraw0: USB HID v1.10 Keyboard [ELAN Touchscreen] on usb-0000:00:14.0-8/input0
The device numbers wrap around at 128.
- KDE Plasma 5.5.5
- Qt 5.5.1
- Kernel 4.13.0-32-generic #35~16.04.1-Ubuntu 64-bit
xinput version 1.6.2
XI version on server: 2.3
X.Org X Server 1.19.5
Release Date: 2017-10-12
X Protocol Version 11, Revision 0