Skip to content

Commit

Permalink
hidapi: Fix bus type in HIDAPI_IGNORE_DEVICE() on Linux
Browse files Browse the repository at this point in the history
This bug prevented the Steam Controller's keyboard and mouse
interfaces from being properly ignored by the HIDAPI joystick
driver on Linux.
  • Loading branch information
cgutman committed Nov 14, 2024
1 parent 7c5a2cd commit e67ae27
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/hidapi/linux/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,28 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,
memset(&usage_iterator, 0, sizeof(usage_iterator));
get_next_hid_usage(report_desc.value, report_desc.size, &usage_iterator, &page, &usage);
}
if (HIDAPI_IGNORE_DEVICE(bus_type, dev_vid, dev_pid, page, usage)) {

/* Convert from Linux bus types to standard HIDAPI ones */
hid_bus_type hidapi_bus_type;
switch (bus_type) {
case BUS_USB:
hidapi_bus_type = HID_API_BUS_USB;
break;
case BUS_BLUETOOTH:
hidapi_bus_type = HID_API_BUS_BLUETOOTH;
break;
case BUS_I2C:
hidapi_bus_type = HID_API_BUS_I2C;
break;
case BUS_SPI:
hidapi_bus_type = HID_API_BUS_SPI;
break;
default:
hidapi_bus_type = HID_API_BUS_UNKNOWN;
break;
}

if (HIDAPI_IGNORE_DEVICE(hidapi_bus_type, dev_vid, dev_pid, page, usage)) {
continue;
}
#endif
Expand Down

0 comments on commit e67ae27

Please sign in to comment.