sway icon indicating copy to clipboard operation
sway copied to clipboard

Input identifiers are not unique

Open CaptainBloodz opened this issue 6 years ago • 20 comments

swaymsg -t get_version sway version 1.0-rc1-31-gee56428b (Feb 7 2019, branch 'HEAD')

xwayland enabled

swaymsg -t get_inputs

Input device: USB OPTICAL MOUSE
  Type: Mouse
  Identifier: 10077:2982:USB_OPTICAL_MOUSE
  Product ID: 2982
  Vendor ID: 10077
  Libinput Send Events: enabled

Input device: USB HCT Keyboard
  Type: Mouse
  Identifier: 49395:673:USB_HCT_Keyboard
  Product ID: 673
  Vendor ID: 49395
  Libinput Send Events: enabled

Input device: USB HCT Keyboard
  Type: Keyboard
  Identifier: 49395:673:USB_HCT_Keyboard
  Product ID: 673
  Vendor ID: 49395
  Active Keyboard Layout: French
  Libinput Send Events: enabled

Input device: USB HCT Keyboard
  Type: Keyboard
  Identifier: 49395:673:USB_HCT_Keyboard
  Product ID: 673
  Vendor ID: 49395
  Active Keyboard Layout: French
  Libinput Send Events: enabled

Input device: Sleep Button
  Type: Keyboard
  Identifier: 0:3:Sleep_Button
  Product ID: 3
  Vendor ID: 0
  Active Keyboard Layout: English (US)
  Libinput Send Events: enabled
...

Is this replication:

  1. Caused by some out of sway configuration?
  2. Originated in sway behavior, whether expected or not?
  3. Something else?

Plz note this isn't causing any issue he know of.

Thanks for your attention.

CaptainBloodz avatar Feb 07 '19 10:02 CaptainBloodz

Related https://github.com/swaywm/wlroots/issues/403

RedSoxFan avatar Feb 07 '19 17:02 RedSoxFan

I think those are in the same group.

Related: https://github.com/swaywm/wlroots/issues/1217

emersion avatar Feb 12 '19 22:02 emersion

This causes me a problem. I can't configure my two RAPOO keyboard/mouse combos independently

Kimapr avatar Mar 23 '20 17:03 Kimapr

same here, I have a Thinkpad Tablet with a trackpoint and a touch pad. With libinput list-devices and libinput debug-events --device /dev/input/eventXX it was possible to distinguish them. However, sway cannot distinguish them

Zocker1999NET avatar Jun 05 '22 20:06 Zocker1999NET

This seems to be the code in question which generates the "unique" identifiers for each device: https://github.com/swaywm/sway/blob/956b689d6ab18ad78f53f15cdeb7606af98e9e5e/sway/input/input-manager.c#L65-L90

I thought about two ideas which could might solve this issue:

  1. This code could be changed to fix this issue, however, without any workarounds, this would break current user configurations. And also, the new identifier needs to be stable so it keeps the same across multiple boots while trying to be unique. But I did not find any value, which could be added.
  2. But, at least to distinguish between some devices, it could be added that we can describe, what capabilities the devices have (because they differ in my case) like in CSS, e.g. input:pointer[gesture], input:pointer[!gesture], and, if sway knows, maybe this could also be used to describe the port, where the device is connected (solving the issue with two identical keyboards connected). This change should be backward compatible to current configurations and could be expanded in the future, if required.

Zocker1999NET avatar Jun 05 '22 21:06 Zocker1999NET

counting the number of "unique" appearances of vendor:product:devicename combinations should provide a way to address a single device not breaking any configs

  • Identifier: 6127:24709:PRIMAX_ThinkPad_X1_Tablet_Thin_Keyboard_Consumer_Control
  • Identifier: 6127:24709:PRIMAX_ThinkPad_X1_Tablet_Thin_Keyboard_Consumer_Control_1

I realize of course that the order these are discoverd might not be the same each time, but I lived with that under X and it would be a dramatic improvement compared to not being able to adress a single device at all.

Liriel avatar Jun 07 '22 09:06 Liriel

Here's a VERY quick and dirty patch to set the USB physical connector name as the input identifier : https://gist.github.com/tdaniel22/166301c48a2e50502ba34877f509dcfb. I needed this to map two touch panels of the same brand to their respective outputs.

tdaniel22 avatar Jun 13 '23 06:06 tdaniel22