Udev not remapping Elecom mouse button

Also asked this over on unix.stackexchange.com but haven’t received any responses so reposting here.

After numerous attempts I’m stumped trying to remap buttons on my new Elecom Hard trackball. I’m following these instructions for remapping with udev hwdb.

I’ve found my device:

    I: Bus=0003 Vendor=056e Product=010c Version=0111
    N: Name="ELECOM TrackBall Mouse HUGE TrackBall"
    P: Phys=usb-0000:01:00.0-9.3/input0
    S: Sysfs=/devices/pci0000:00/0000:00:02.1/0000:01:00.0/usb1/1-9/1-9.3/1-9.3:1.0/0003:056E:010C.0018/input/input33
    U: Uniq=
    H: Handlers=kbd mouse1 event6 
    B: PROP=0
    B: EV=10001f
    B: KEY=306ff 0 0 483ffff17aff32d bfd4444600000000 ff0001 130c730b17c000 267bfad941dfed 9e168000004400 10000002
    B: REL=1943
    B: ABS=100000000
    B: MSC=10

and written the hwdb.d config:

    # cat /etc/udev/hwdb.d/70-elecom-remap.hwdb 
    # remap
    evdev:input:b0003v056ep010c:*
     KEYBOARD_KEY_90006=pageup
     KEYBOARD_KEY_90007=pagedown

From the timestamp I can confirm that hwdb.bin is bring recreated. And the bin file changes in size when I remove my extra config so it seems like it’s picking up the config on disk:

    [root]# ls -l /etc/udev/                             
    total 23548
    -r--r--r--. 1 root root 12053575 Dec  9 15:33 hwdb.bin
    -r--r--r--. 1 root root 12053726 Dec  9 15:33 hwdb.bin-with-remaps
    drwxr-xr-x. 1 root root        0 Dec  9 15:33 hwdb.d
    drwxr-xr-x. 1 root root        0 Nov  9 03:26 rules.d
    -rw-r--r--. 1 root root      305 Nov  8 09:00 udev.conf

But… the buttons don’t work. I’ve tried various combinations of systemd-hwdb update; udevadm trigger. I’ve even tried unplugging and replugging the USB cable.

systemd-hwdw sees the configuration:

  $ systemd-hwdb query "evdev:input:b0003v056ep010c:*"
  KEYBOARD_KEY_90006=pageup
  KEYBOARD_KEY_90007=pagedown

but udev does not:

    P: /devices/pci0000:00/0000:00:02.1/0000:01:00.0/usb1/1-9/1-9.3/1-9.3:1.0/0003:056E:010C.0018/input/input33/event6
    M: event6
    R: 6
    U: input
    D: c 13:70
    N: input/event6
    L: 0
    S: input/by-id/usb-ELECOM_TrackBall_Mouse_HUGE_TrackBall-event-mouse
    S: input/by-path/pci-0000:01:00.0-usb-0:9.3:1.0-event-mouse
    E: DEVPATH=/devices/pci0000:00/0000:00:02.1/0000:01:00.0/usb1/1-9/1-9.3/1-9.3:1.0/0003:056E:010C.0018/input/input33/event6
    E: DEVNAME=/dev/input/event6
    E: MAJOR=13
    E: MINOR=70
    E: SUBSYSTEM=input
    E: USEC_INITIALIZED=61666981523
    E: ID_INPUT=1
    E: ID_INPUT_MOUSE=1
    E: ID_INPUT_KEY=1
    E: ID_BUS=usb
    E: ID_MODEL=HUGE_TrackBall
    E: ID_MODEL_ENC=HUGE\x20TrackBall
    E: ID_MODEL_ID=010c
    E: ID_SERIAL=ELECOM_TrackBall_Mouse_HUGE_TrackBall
    E: ID_VENDOR=ELECOM_TrackBall_Mouse
    E: ID_VENDOR_ENC=ELECOM\x20TrackBall\x20Mouse
    E: ID_VENDOR_ID=056e
    E: ID_REVISION=0110
    E: ID_TYPE=hid
    E: ID_USB_MODEL=HUGE_TrackBall
    E: ID_USB_MODEL_ENC=HUGE\x20TrackBall
    E: ID_USB_MODEL_ID=010c
    E: ID_USB_SERIAL=ELECOM_TrackBall_Mouse_HUGE_TrackBall
    E: ID_USB_VENDOR=ELECOM_TrackBall_Mouse
    E: ID_USB_VENDOR_ENC=ELECOM\x20TrackBall\x20Mouse
    E: ID_USB_VENDOR_ID=056e
    E: ID_USB_REVISION=0110
    E: ID_USB_TYPE=hid
    E: ID_USB_INTERFACES=:030102:
    E: ID_USB_INTERFACE_NUM=00
    E: ID_USB_DRIVER=usbhid
    E: ID_PATH=pci-0000:01:00.0-usb-0:9.3:1.0
    E: ID_PATH_TAG=pci-0000_01_00_0-usb-0_9_3_1_0
    E: ID_INPUT_TRACKBALL=1
    E: LIBINPUT_DEVICE_GROUP=3/56e/10c:usb-0000:01:00.0-9
    E: DEVLINKS=/dev/input/by-id/usb-ELECOM_TrackBall_Mouse_HUGE_TrackBall-event-mouse /dev/input/by-path/pci-0000:01:00.0-usb-0:9.3:1.0-event-mouse
    E: TAGS=:power-switch:
    E: CURRENT_TAGS=:power-switch:

I’m not sure how to debug this further. In case it’s helpful, I’m using Fedora 37 with Gnome/Wayland.

Thx in advance!

The problem is that your match pattern uses lowercase digits but the udev rule uses uppercase digits. In addition, ‘:’ in your match pattern is misplaced, it would also prevent the pattern from being matched.

60-keyboard.hwdb says:

  #  - Generic input devices match:
  #      evdev:input:bZZZZvYYYYpXXXXeWWWW-VVVV
  #    This matches on the kernel modalias of the input-device, mainly:
  #    ZZZZ is the bus-id (see /usr/include/linux/input.h BUS_*), YYYY, XXXX and
  #    WWWW are the 4-digit hex uppercase vendor, product and version ID

Thus you need something like this:

evdev:input:b0003v056Ep010C*
 KEYBOARD_KEY_90006=pageup
 KEYBOARD_KEY_90007=pagedown

You can then verify that the match is working as expected by running:

systemd-hwdb update
udevadm test /dev/input/by-id/usb-ELECOM_TrackBall_Mouse_HUGE_TrackBall-event-mouse

HTH.

Thank you @zbyszek . I will retry based on your suggestions.