diff --git a/hidapi/hidapi.h b/hidapi/hidapi.h index 32943c0..a6b0d5d 100644 --- a/hidapi/hidapi.h +++ b/hidapi/hidapi.h @@ -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; diff --git a/hidtest/hidtest.cpp b/hidtest/hidtest.cpp index b48f4f3..fa776ba 100644 --- a/hidtest/hidtest.cpp +++ b/hidtest/hidtest.cpp @@ -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; } diff --git a/linux/hid-libusb.c b/linux/hid-libusb.c index 52291a8..f6aa209 100644 --- a/linux/hid-libusb.c +++ b/linux/hid-libusb.c @@ -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 */ diff --git a/linux/hid.c b/linux/hid.c index 9a716c5..d8a58d1 100644 --- a/linux/hid.c +++ b/linux/hid.c @@ -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; diff --git a/mac/hid.c b/mac/hid.c index af10d81..67db48f 100644 --- a/mac/hid.c +++ b/mac/hid.c @@ -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; } } diff --git a/windows/hid.cpp b/windows/hid.cpp index 4688215..148583c 100644 --- a/windows/hid.cpp +++ b/windows/hid.cpp @@ -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: