Open zougloub opened 1 day ago
Example udev properties:
P: /devices/pci0000:00/0000:00:15.0/usb1/1-1/1-1.3
M: 1-1.3
R: 3
U: usb
T: usb_device
D: c 189:63
N: bus/usb/001/064
L: 0
V: usb
E: DEVPATH=/devices/pci0000:00/0000:00:15.0/usb1/1-1/1-1.3
E: SUBSYSTEM=usb
E: DEVNAME=/dev/bus/usb/001/064
E: DEVTYPE=usb_device
E: DRIVER=usb
E: PRODUCT=424f/9301/101
E: TYPE=239/2/1
E: BUSNUM=001
E: DEVNUM=064
E: MAJOR=189
E: MINOR=63
E: USEC_INITIALIZED=118584265597
E: ID_BUS=usb
E: ID_MODEL=SiW_HID_Touch_Controller
E: ID_MODEL_ENC=SiW\x20HID\x20Touch\x20Controller
E: ID_MODEL_ID=9301
E: ID_SERIAL=Siliconworks_SiW_HID_Touch_Controller
E: ID_VENDOR=Siliconworks
E: ID_VENDOR_ENC=Siliconworks
E: ID_VENDOR_ID=424f
E: ID_REVISION=0101
E: ID_USB_MODEL=SiW_HID_Touch_Controller
E: ID_USB_MODEL_ENC=SiW\x20HID\x20Touch\x20Controller
E: ID_USB_MODEL_ID=9301
E: ID_USB_SERIAL=Siliconworks_SiW_HID_Touch_Controller
E: ID_USB_VENDOR=Siliconworks
E: ID_USB_VENDOR_ENC=Siliconworks
E: ID_USB_VENDOR_ID=424f
E: ID_USB_REVISION=0101
E: ID_USB_INTERFACES=:030000:
E: ID_PATH_WITH_USB_REVISION=pci-0000:00:15.0-usbv2-0:1.3
E: ID_PATH=pci-0000:00:15.0-usb-0:1.3
E: ID_PATH_TAG=pci-0000_00_15_0-usb-0_1_3
This device must be matched by path because the constructor did not add a iSerialNumber on the USB descriptors.
I propose to match in the input-device:
configuration section some properties (at least ID_PATH or ID_PATH_TAG depending on the :
friendliness of config), so we can do
[input-device:pci-0000:00:15.0-usb-0:1.3]
In order to uniquely match a peripheral.
Using @soreau 's WIP, we can configure:
[input-device:pci-0000:00:15.0-usb-0:2.3:1.0]
output = HDMI-A-1
calibration = 1.0 0.0 0.0 0.0 1.0 0.0
[input-device:pci-0000:00:15.0-usb-0:1.3:1.0]
output = HDMI-A-2
calibration = 1.0 0.0 0.0 0.0 1.0 0.0
Giving:
DD 31-10-24 17:53:08.170 - [src/core/plugin.cpp:68] Checking for input-device config section: [input-device:pci-0000:00:15.0-usb-0:1.3:1.0]
II 31-10-24 17:53:08.170 - [src/core/seat/input-manager.cpp:108] Calibrated input device successfully: Siliconworks SiW HID Touch Controller
II 31-10-24 17:53:08.170 - [src/core/seat/input-manager.cpp:109] 1 0 0 0 1 0
DD 31-10-24 17:53:08.170 - [src/core/seat/input-manager.cpp:124] Mapping input Siliconworks SiW HID Touch Controller to output HDMI-A-2.
DD 31-10-24 17:53:08.171 - [src/core/plugin.cpp:68] Checking for input-device config section: [input-device:pci-0000:00:15.0-usb-0:2.3:1.0]
II 31-10-24 17:53:08.171 - [src/core/seat/input-manager.cpp:108] Calibrated input device successfully: Siliconworks SiW HID Touch Controller
II 31-10-24 17:53:08.171 - [src/core/seat/input-manager.cpp:109] 1 0 0 0 1 0
DD 31-10-24 17:53:08.171 - [src/core/seat/input-manager.cpp:124] Mapping input Siliconworks SiW HID Touch Controller to output HDMI-A-1.
This may relate to https://github.com/WayfireWM/wayfire/issues/2481
The code in get_input_device_section only matches an
input-device
section suffixed bydev->name
, which is a problem if devices have the same name.We'd need a syntax to specify a name by id or by path, maybe we can use a /dev/input/by-* path and check if the path exists, and resolve the corresponding device.