8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
14 #include <linux/hid.h>
15 #include <linux/module.h>
19 #define HID_UP_VENDOR_DEFINED_MIN 0xff000000
20 #define HID_UP_VENDOR_DEFINED_MAX 0xffff0000
22 static int jabra_input_mapping(struct hid_device *hdev,
24 struct hid_field *field,
25 struct hid_usage *usage,
26 unsigned long **bit, int *max)
28 int is_vendor_defined =
29 ((usage->hid & HID_USAGE_PAGE) >= HID_UP_VENDOR_DEFINED_MIN &&
30 (usage->hid & HID_USAGE_PAGE) <= HID_UP_VENDOR_DEFINED_MAX);
32 dbg_hid("hid=0x%08x appl=0x%08x coll_idx=0x%02x usage_idx=0x%02x: %s\n",
35 usage->collection_index,
37 is_vendor_defined ? "ignored" : "defaulted");
39 /* Ignore vendor defined usages, default map standard usages */
40 return is_vendor_defined ? -1 : 0;
43 static const struct hid_device_id jabra_devices[] = {
44 { HID_USB_DEVICE(USB_VENDOR_ID_JABRA, HID_ANY_ID) },
47 MODULE_DEVICE_TABLE(hid, jabra_devices);
49 static struct hid_driver jabra_driver = {
51 .id_table = jabra_devices,
52 .input_mapping = jabra_input_mapping,
54 module_hid_driver(jabra_driver);
57 MODULE_DESCRIPTION("Jabra USB HID Driver");
58 MODULE_LICENSE("GPL");