Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions netbsd/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
for (size_t i = 0; i < len; i++) {
char devpath[USB_MAX_DEVNAMELEN];
int bus;
struct hid_device_info *prev_end;

strlcpy(devpath, "/dev/", sizeof(devpath));
strlcat(devpath, arr[i], sizeof(devpath));
Expand All @@ -732,7 +733,17 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
if (bus == -1)
continue;

/*
* ehci/ohci/uhci/dwctwo etc. use 'addr 1' for root hubs
* but xhci uses 'addr 0' on NetBSD.
* Check addr 0 (that would be unused on other than xhci)
* and then check addr 1 if there is no device at addr 0.
*/
prev_end = hed.end;
enumerate_usb_devices(bus, 0, hid_enumerate_callback, &hed);
if (hed.end == prev_end)
enumerate_usb_devices(bus, 1,
hid_enumerate_callback, &hed);

close(bus);
}
Expand Down
Loading