Skip to content

Commit a73a637

Browse files
jirislabyJiri Kosina
authored andcommitted
HID: add hid_type to general hid struct
Add type to the hid structure to distinguish to which device type (now only mouse) we are talking to. Needed for per device type ignore list support. Note: this patch leaves the type as unknown for bluetooth devices, there is not support for this in the hidp code. Signed-off-by: Jiri Slaby <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent ac2d989 commit a73a637

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

drivers/hid/usbhid/hid-core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,9 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
972972
hid->vendor = le16_to_cpu(dev->descriptor.idVendor);
973973
hid->product = le16_to_cpu(dev->descriptor.idProduct);
974974
hid->name[0] = 0;
975+
if (intf->cur_altsetting->desc.bInterfaceProtocol ==
976+
USB_INTERFACE_PROTOCOL_MOUSE)
977+
hid->type = HID_TYPE_USBMOUSE;
975978

976979
if (dev->manufacturer)
977980
strlcpy(hid->name, dev->manufacturer, sizeof(hid->name));

include/linux/hid.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,11 @@ struct hid_input {
417417
struct input_dev *input;
418418
};
419419

420+
enum hid_type {
421+
HID_TYPE_OTHER = 0,
422+
HID_TYPE_USBMOUSE
423+
};
424+
420425
struct hid_driver;
421426
struct hid_ll_driver;
422427

@@ -431,6 +436,7 @@ struct hid_device { /* device report descriptor */
431436
__u32 vendor; /* Vendor ID */
432437
__u32 product; /* Product ID */
433438
__u32 version; /* HID version */
439+
enum hid_type type; /* device type (mouse, kbd, ...) */
434440
unsigned country; /* HID country */
435441
struct hid_report_enum report_enum[HID_REPORT_TYPES];
436442

0 commit comments

Comments
 (0)