mirror of
https://github.com/RPCS3/hidapi.git
synced 2026-07-19 13:34:37 -04:00
Add the interface number to hid_device_info on Linux/libusb implementation.
The interface number is added to the hid_device_info struct. Since the Linux/libusb implementation can't put the Usage and Usage Page in the hid_device_info struct because it requires detaching the kernel driver, the interface number is added instead so that users with composite HID devices can differentiate between the interfaces on the device.
This commit is contained in:
+7
-2
@@ -62,10 +62,15 @@ extern "C" {
|
||||
wchar_t *manufacturer_string;
|
||||
/** Product string */
|
||||
wchar_t *product_string;
|
||||
/** Usage Page for this Device/Interface */
|
||||
/** Usage Page for this Device/Interface
|
||||
(Windows/Mac only). */
|
||||
unsigned short usage_page;
|
||||
/** Usage for this Device/Interface */
|
||||
/** Usage for this Device/Interface
|
||||
(Windows/Mac only).*/
|
||||
unsigned short usage;
|
||||
/** The USB interface which this logical device
|
||||
represents (Linux/libusb implementation only). */
|
||||
int interface;
|
||||
|
||||
/** Pointer to the next device */
|
||||
struct hid_device_info *next;
|
||||
|
||||
@@ -51,6 +51,7 @@ int main(int argc, char* argv[])
|
||||
printf(" Manufacturer: %ls\n", cur_dev->manufacturer_string);
|
||||
printf(" Product: %ls\n", cur_dev->product_string);
|
||||
printf(" Release: %hx\n", cur_dev->release_number);
|
||||
printf(" Interface: %d\n", cur_dev->interface);
|
||||
printf("\n");
|
||||
cur_dev = cur_dev->next;
|
||||
}
|
||||
|
||||
@@ -527,6 +527,9 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,
|
||||
|
||||
/* Release Number */
|
||||
cur_dev->release_number = desc.bcdDevice;
|
||||
|
||||
/* Interface Number */
|
||||
cur_dev->interface = interface_num;
|
||||
}
|
||||
}
|
||||
} /* altsettings */
|
||||
|
||||
@@ -299,6 +299,10 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,
|
||||
/* Release Number */
|
||||
str = udev_device_get_sysattr_value(dev, "bcdDevice");
|
||||
cur_dev->release_number = (str)? strtol(str, NULL, 16): 0x0;
|
||||
|
||||
/* Interface Number (Unsupported on Linux/hidraw) */
|
||||
cur_dev->interface = -1;
|
||||
|
||||
}
|
||||
else
|
||||
goto next;
|
||||
|
||||
@@ -364,6 +364,9 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,
|
||||
|
||||
/* Release Number */
|
||||
cur_dev->release_number = get_int_property(dev, CFSTR(kIOHIDVersionNumberKey));
|
||||
|
||||
/* Interface Number (Unsupported on Mac)*/
|
||||
cur_dev->interface = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -359,6 +359,9 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
|
||||
|
||||
/* Release Number */
|
||||
cur_dev->release_number = attrib.VersionNumber;
|
||||
|
||||
/* Interface Number (Unsupported on Windows)*/
|
||||
cur_dev->interface = -1;
|
||||
}
|
||||
|
||||
cont_close:
|
||||
|
||||
Reference in New Issue
Block a user