Skip to content

Linux: Enumerate HID devices without USB parents - #31

Open
Tsuyumi25 wants to merge 2 commits into
OpenTabletDriver:masterfrom
Tsuyumi25:linux-hid-parent-fallback
Open

Linux: Enumerate HID devices without USB parents#31
Tsuyumi25 wants to merge 2 commits into
OpenTabletDriver:masterfrom
Tsuyumi25:linux-hid-parent-fallback

Conversation

@Tsuyumi25

@Tsuyumi25 Tsuyumi25 commented Sep 9, 2026

Copy link
Copy Markdown

Linux currently drops hidraw devices without a usb / usb_device parent, including Bluetooth HID devices.

This keeps the existing USB enumeration path first and falls back to the hid parent, reading the vendor and product IDs from HID_ID and the product name from HID_NAME. The libudev property binding is included for both libudev.so.0 and libudev.so.1.

HID udev properties do not provide USB-equivalent release, manufacturer, or serial values, so the fallback uses release number 0 and retains the existing missing-value behavior. Device-node permissions remain the consuming application's responsibility.

This follows the HID-parent approach investigated by @digtail in #28.

Validated on Linux with Bluetooth Wacom CTL-4100WL and CTL-6100WL devices through OpenTabletDriver/OpenTabletDriver#4672.

Comment on lines +139 to +144
int vendorStart = hidId.IndexOf(':');
if (vendorStart < 0) { return false; }
vendorStart++;

int productStart = hidId.IndexOf(':', vendorStart);
if (productStart < 0 || productStart == hidId.Length - 1) { return false; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What's the intent here ? can't a regex do the job better ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good point. A regex would work here, but string.Split is simpler for three fixed fields. I've replaced the manual indexing with it and added a short format comment.

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