Merge tag 'iwlwifi-next-for-kalle-2014-12-30' of https://git.kernel.org/pub/scm/linux...
[cascardo/linux.git] / drivers / hid / hid-plantronics.c
1 /*
2  *  Plantronics USB HID Driver
3  *
4  *  Copyright (c) 2014 JD Cole <jd.cole@plantronics.com>
5  *  Copyright (c) 2014 Terry Junge <terry.junge@plantronics.com>
6  */
7
8 /*
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU General Public License as published by the Free
11  * Software Foundation; either version 2 of the License, or (at your option)
12  * any later version.
13  */
14
15 #include "hid-ids.h"
16
17 #include <linux/hid.h>
18 #include <linux/module.h>
19
20 static int plantronics_input_mapping(struct hid_device *hdev,
21                                      struct hid_input *hi,
22                                      struct hid_field *field,
23                                      struct hid_usage *usage,
24                                      unsigned long **bit, int *max)
25 {
26         if (field->application == HID_CP_CONSUMERCONTROL
27             && (usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER) {
28                 hid_dbg(hdev, "usage: %08x (appl: %08x) - defaulted\n",
29                          usage->hid, field->application);
30                 return 0;
31         }
32
33         hid_dbg(hdev, "usage: %08x (appl: %08x) - ignored\n",
34                 usage->hid, field->application);
35
36         return -1;
37 }
38
39 static const struct hid_device_id plantronics_devices[] = {
40         { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
41         { }
42 };
43 MODULE_DEVICE_TABLE(hid, plantronics_devices);
44
45 static struct hid_driver plantronics_driver = {
46         .name = "plantronics",
47         .id_table = plantronics_devices,
48         .input_mapping = plantronics_input_mapping,
49 };
50 module_hid_driver(plantronics_driver);
51
52 MODULE_AUTHOR("JD Cole <jd.cole@plantronics.com>");
53 MODULE_AUTHOR("Terry Junge <terry.junge@plantronics.com>");
54 MODULE_DESCRIPTION("Plantronics USB HID Driver");
55 MODULE_LICENSE("GPL");