You are not logged in.

#1 2025-09-26 10:41:07

arch1bald1
Member
Registered: 2019-06-15
Posts: 13

Wayland, two identical mice, hwdb udev rule

As wayland is pushed by gnome >49, I'm forced to migrate to wayland.

Problem I have is as follows:
I have two exact identical mice I want to configure differently, but as they have the exact same USB vendor and product ID, I don't know how to handle them differently with udev hwdb entries.

Currently only one of them is working via the following:

$ cat /etc/udev/hwdb.d/90-trackball-buttons.hwdb 
# Kensington Expert Mouse Trackball
# usb vendor 047d, product 1020
# * Rebind top-left from BTN_MIDDLE to BTN_SIDE
# * Rebind top-right from BTN_SIDE to BTN_MIDDLE
evdev:input:b*v047Dp1020*
 KEYBOARD_KEY_90003=btn_side
 KEYBOARD_KEY_90004=btn_forward

I hope you can reach out to me, on how to achieve my goal.

Offline

#2 2025-09-26 14:38:49

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,471

Re: Wayland, two identical mice, hwdb udev rule

Use idevadm info --attribute-walk --name=/dev/<device> to find all the attributes and find something to differentiate them.  Perhaps a serial number?   Then create a udev rule that exploits the difference.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#3 2025-09-26 15:41:08

arch1bald1
Member
Registered: 2019-06-15
Posts: 13

Re: Wayland, two identical mice, hwdb udev rule

ewaller wrote:

Use idevadm info --attribute-walk --name=/dev/<device> to find all the attributes and find something to differentiate them.  Perhaps a serial number?   Then create a udev rule that exploits the difference.

Thanks. I'm still new to wayland but the output for /dev/input/event3 is as follows:

  looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6.2/1-6.2:1.0/0003:047D:1020.0001/input/input3/event3':
    KERNEL=="event3"
    SUBSYSTEM=="input"
    DRIVER==""
    ATTR{power/control}=="auto"
    ATTR{power/runtime_active_time}=="0"
    ATTR{power/runtime_status}=="unsupported"
    ATTR{power/runtime_suspended_time}=="0"

  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6.2/1-6.2:1.0/0003:047D:1020.0001/input/input3':
    KERNELS=="input3"
    SUBSYSTEMS=="input"
    DRIVERS==""
    ATTRS{capabilities/abs}=="0"
    ATTRS{capabilities/ev}=="17"
    ATTRS{capabilities/ff}=="0"
    ATTRS{capabilities/key}=="3b0000 0 0 0 0"
    ATTRS{capabilities/led}=="0"
    ATTRS{capabilities/msc}=="10"
    ATTRS{capabilities/rel}=="903"
    ATTRS{capabilities/snd}=="0"
    ATTRS{capabilities/sw}=="0"
    ATTRS{id/bustype}=="0003"
    ATTRS{id/product}=="1020"
    ATTRS{id/vendor}=="047d"
    ATTRS{id/version}=="0111"
    ATTRS{inhibited}=="0"
    ATTRS{name}=="Kensington Expert Mouse"
    ATTRS{phys}=="usb-0000:00:14.0-6.2/input0"
    ATTRS{power/control}=="auto"
    ATTRS{power/runtime_active_time}=="0"
    ATTRS{power/runtime_status}=="unsupported"
    ATTRS{power/runtime_suspended_time}=="0"
    ATTRS{properties}=="0"
    ATTRS{uniq}==""

  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6.2/1-6.2:1.0/0003:047D:1020.0001':
    KERNELS=="0003:047D:1020.0001"
    SUBSYSTEMS=="hid"
    DRIVERS=="hid-generic"
    ATTRS{country}=="00"
    ATTRS{power/control}=="auto"
    ATTRS{power/runtime_active_time}=="0"
    ATTRS{power/runtime_status}=="unsupported"
    ATTRS{power/runtime_suspended_time}=="0"

  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6.2/1-6.2:1.0':
    KERNELS=="1-6.2:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="usbhid"
    ATTRS{authorized}=="1"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bInterfaceClass}=="03"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{bInterfaceProtocol}=="02"
    ATTRS{bInterfaceSubClass}=="01"
    ATTRS{bNumEndpoints}=="01"
    ATTRS{supports_autosuspend}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6.2':
    KERNELS=="1-6.2"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{authorized}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPacketSize0}=="8"
    ATTRS{bMaxPower}=="100mA"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bcdDevice}=="0114"
    ATTRS{bmAttributes}=="a0"
    ATTRS{busnum}=="1"
    ATTRS{configuration}==""
    ATTRS{devnum}=="5"
    ATTRS{devpath}=="6.2"
    ATTRS{idProduct}=="1020"
    ATTRS{idVendor}=="047d"

I searched the web up and down but can't find how to change the .hwdb file to select e.g. "KERNEL=="event3". So any nudge to the right direction is highly appreciated!

Offline

#4 2025-09-27 15:16:14

arch1bald1
Member
Registered: 2019-06-15
Posts: 13

Re: Wayland, two identical mice, hwdb udev rule

I found a workaround but no solution yet.

The workaround consists of swapping the pcb with one from an older revision. Despite they are also 99.9% identical there is a slight variation in the name string.

Offline

#5 2025-09-27 17:16:45

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 414

Re: Wayland, two identical mice, hwdb udev rule

I don't know relationship between wayland and hwdb, but with udev you can distinguish identical devices by physical USB port in the hub they are plugged to. Port number can be parsed from device path after dash in USB device subdirectory: '/devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6.2/...' or from the name where symlink 'port' in parent device directory is pointing to.

Offline

Board footer

Powered by FluxBB