I'm running Kubuntu 15.10 on an HP Spectre x360, which has a non-Wacom active digitizer built into the display. I'm using a two-button stylus with this, but the second button doesn't work. I couldn't get xinput to show any state change when the button is pressed; it seems X can't see it at all. evtest does see an event, but it reports the button as BTN_TOOL_RUBBER instead of the appropriate BTN_STYLUS2:
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x4f3 product 0x2073 version 0x110
Input device name: "ELAN Touchscreen Pen"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 256 (BTN_0)
Event code 320 (BTN_TOOL_PEN)
Event code 321 (BTN_TOOL_RUBBER)
Event code 330 (BTN_TOUCH)
Event code 331 (BTN_STYLUS)
Event type 3 (EV_ABS)
Event code 0 (ABS_X)
Value 23080
Min 0
Max 32256
Resolution 110
Event code 1 (ABS_Y)
Value 10408
Min 0
Max 17920
Resolution 108
Event code 24 (ABS_PRESSURE)
Value 0
Min 0
Max 255
Event type 4 (EV_MSC)
Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Event: time 1453608432.242049, type 1 (EV_KEY), code 321 (BTN_TOOL_RUBBER), value 1
Event: time 1453608432.242049, -------------- SYN_REPORT ------------
The stylus has no eraser tip. input-kbd gives me the scancodes and shows the same issue:
/dev/input/event8
bustype : BUS_USB
vendor : 0x4f3
product : 0x2073
version : 272
name : "ELAN Touchscreen Pen"
phys : "usb-0000:00:14.0-4/input0"
uniq : ""
bits ev : EV_SYN EV_KEY EV_ABS EV_MSC
map: 15 keys, size: 294/320
0xd0032 = 320 # BTN_TOOL_PEN
0xd0042 = 330 # BTN_TOUCH
0xd0044 = 331 # BTN_STYLUS
0xd003c = 321 # BTN_TOOL_RUBBER
0xd0045 = 256 # BTN_0
0xd0042 = 330 # BTN_TOUCH
0xd0042 = 330 # BTN_TOUCH
0xd0042 = 330 # BTN_TOUCH
0xd0042 = 330 # BTN_TOUCH
0xd0042 = 330 # BTN_TOUCH
0xd0042 = 330 # BTN_TOUCH
0xd0042 = 330 # BTN_TOUCH
0xd0042 = 330 # BTN_TOUCH
0xd0042 = 330 # BTN_TOUCH
0xd0042 = 330 # BTN_TOUCH
Trying to use input-kbd to assign a new map gives a "scancode out of range" error. The straightforward setkeycodes d003c 332 also does not work (USB keyboard bug).
Update: I've tried fixing this through udev by adding a custom hwdb file to /etc/udev/hwdb.d, but it doesn't seem to be having any effect.
$ cat /etc/udev/hwdb.d/61-touchscreen-quirks.hwdb
evdev:input:b0003v04f3p2073e0110* # Matches ELAN Touchscreen devices
KEYBOARD_KEY_d003c=14c # Reassigns scancode from BTN_TOOL_RUBBER to BTN_STYLUS2
$ sudo udevadm --debug hwdb --update
calling: hwdb
reading file '/lib/udev/hwdb.d/20-OUI.hwdb'
reading file '/lib/udev/hwdb.d/20-acpi-vendor.hwdb'
reading file '/lib/udev/hwdb.d/20-bluetooth-vendor-product.hwdb'
reading file '/lib/udev/hwdb.d/20-libgphoto2-6.hwdb'
reading file '/lib/udev/hwdb.d/20-net-ifname.hwdb'
reading file '/lib/udev/hwdb.d/20-pci-classes.hwdb'
reading file '/lib/udev/hwdb.d/20-pci-vendor-model.hwdb'
reading file '/lib/udev/hwdb.d/20-sdio-classes.hwdb'
reading file '/lib/udev/hwdb.d/20-sdio-vendor-model.hwdb'
reading file '/lib/udev/hwdb.d/20-usb-classes.hwdb'
reading file '/lib/udev/hwdb.d/20-usb-media-players.hwdb'
reading file '/lib/udev/hwdb.d/20-usb-vendor-model.hwdb'
reading file '/lib/udev/hwdb.d/60-evdev.hwdb'
reading file '/lib/udev/hwdb.d/60-keyboard.hwdb'
reading file '/etc/udev/hwdb.d/61-touchscreen-quirks.hwdb'
reading file '/lib/udev/hwdb.d/69-libmtp.hwdb'
reading file '/lib/udev/hwdb.d/70-mouse.hwdb'
reading file '/lib/udev/hwdb.d/70-pointingstick.hwdb'
=== trie in-memory ===
nodes: 3899920 bytes ( 97498)
children arrays: 1559952 bytes ( 97497)
values arrays: 1241904 bytes ( 77619)
strings: 1721567 bytes
strings incoming: 4005992 bytes ( 240722)
strings dedup'ed: 2347672 bytes ( 177476)
=== trie on-disk ===
size: 6863455 bytes
header: 80 bytes
nodes: 2339952 bytes ( 97498)
child pointers: 1559952 bytes ( 97497)
value pointers: 1241904 bytes ( 77619)
string store: 1721567 bytes
strings start: 5141888
$ sudo udevadm -d control --reload
calling: control
$ sudo udevadm -d trigger /dev/input/event*
calling: trigger
$ sudo udevadm info -q all -p /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:04F3:2073.0004/input/input9
P: /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:04F3:2073.0004/input/input9
E: ABS=1000003
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:04F3:2073.0004/input/input9
E: EV=1b
E: ID_BUS=usb
E: ID_FOR_SEAT=input-pci-0000_00_14_0-usb-0_4_1_0
E: ID_INPUT=1
E: ID_INPUT_TABLET=1
E: ID_MODEL=Touchscreen
E: ID_MODEL_ENC=Touchscreen
E: ID_MODEL_ID=2073
E: ID_PATH=pci-0000:00:14.0-usb-0:4:1.0
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_4_1_0
E: ID_REVISION=5107
E: ID_SERIAL=ELAN_Touchscreen
E: ID_TYPE=hid
E: ID_USB_DRIVER=usbhid
E: ID_USB_INTERFACES=:030000:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=ELAN
E: ID_VENDOR_ENC=ELAN
E: ID_VENDOR_ID=04f3
E: KEY=c03 1 0 0 0 0
E: MODALIAS=input:b0003v04F3p2073e0110-e0,1,3,4,k100,140,141,14A,14B,ra0,1,18,m4,lsfw
E: MSC=10
E: NAME="ELAN Touchscreen Pen"
E: PHYS="usb-0000:00:14.0-4/input0"
E: PRODUCT=3/4f3/2073/110
E: PROP=0
E: SUBSYSTEM=input
E: TAGS=:seat:
E: UNIQ=""
E: USEC_INITIALIZED=4595650
What did I do wrong here, or alternatively, what is a better way of doing this?