Skip to content
Snippets Groups Projects
Unverified Commit dbd0d90a authored by Sophie Tauchert's avatar Sophie Tauchert Committed by Luca Weiss
Browse files

razeraccessory: only match with one interface

This prevents the driver to be bound to multiple interfaces which is
both unneccessary and is not supposed to happen.
parent a095508c
No related branches found
No related tags found
No related merge requests found
......@@ -1041,6 +1041,26 @@ static int razer_input_mapping(struct hid_device *hdev, struct hid_input *hi, st
return 0;
}
/**
* Match method checks whether this driver should be used for a given HID device
*/
static bool razer_accessory_match(struct hid_device *hdev, bool ignore_special_driver)
{
struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
struct usb_device *usb_dev = interface_to_usbdev(intf);
switch (usb_dev->descriptor.idProduct) {
case USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION:
case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA:
if (intf->cur_altsetting->desc.bInterfaceNumber != 0) {
dev_info(&intf->dev, "skipping secondary interface\n");
return false;
}
}
return true;
}
/**
* Probe method is ran whenever a device is binded to the driver
*/
......@@ -1348,6 +1368,7 @@ MODULE_DEVICE_TABLE(hid, razer_devices);
static struct hid_driver razer_accessory_driver = {
.name = "razeraccessory",
.id_table = razer_devices,
.match = razer_accessory_match,
.probe = razer_accessory_probe,
.remove = razer_accessory_disconnect,
.raw_event = razer_raw_event,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment