Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HID: usbhid: Insert USB bus/device ID into HID name #6356

Draft
wants to merge 1 commit into
base: rpi-6.6.y
Choose a base branch
from

Conversation

6by9
Copy link
Contributor

@6by9 6by9 commented Sep 12, 2024

Draft as this isn't ideal - it renames all mouse and keyboard devices, as well as touch ones.

libinput/wlroots/Wayfire/labwc match input device by the device name only. If you add 2 identical USB connected touch devices, you can't select between them.

Add the usb bus&device name to the start of the name so that the names end up being unique,

https://forums.raspberrypi.com/viewtopic.php?t=376569

libinput/wlroots/Wayfire/labwc match input device by the
device name only. If you add 2 identical USB connected
touch devices, you can't select between them.

Add the usb bus&device name to the start of the name so that
the names end up being unique,

Signed-off-by: Dave Stevenson <[email protected]>

if (dev->product) {
if (dev->manufacturer)
strlcat(hid->name, " ", sizeof(hid->name));
strlcat(hid->name, dev->product, sizeof(hid->name));
}

if (!strlen(hid->name))
snprintf(hid->name, sizeof(hid->name), "HID %04x:%04x",
if (strlen(hid->name) == strlen(dev_name(&dev->dev)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the snprintf above, and the fact that other changes just append, how can this condition ever be true?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't.
Too many revisions switching from strscpy to snprintf (to add the usb- prefix), and missing updating this condition.

Ideally this issue wants to be sorted further up the stack (xinput was always happy with multiple identical devices, although you had to reference them by id number rather than name), so I'll have a word with Simon and David T later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants