]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - drivers/hid/hid-nti.c
UBUNTU: Ubuntu-4.13.0-45.50
[mirror_ubuntu-artful-kernel.git] / drivers / hid / hid-nti.c
1 /*
2 * USB HID quirks support for Network Technologies, Inc. "USB-SUN" USB
3 * adapter for pre-USB Sun keyboards
4 *
5 * Copyright (c) 2011 Google, Inc.
6 *
7 * Based on HID apple driver by
8 * Copyright (c) 1999 Andreas Gal
9 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
10 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
11 * Copyright (c) 2006-2007 Jiri Kosina
12 * Copyright (c) 2008 Jiri Slaby <jirislaby@gmail.com>
13 */
14
15 /*
16 * This program is free software; you can redistribute it and/or modify it
17 * under the terms of the GNU General Public License as published by the Free
18 * Software Foundation; either version 2 of the License, or (at your option)
19 * any later version.
20 */
21
22 #include <linux/device.h>
23 #include <linux/input.h>
24 #include <linux/hid.h>
25 #include <linux/module.h>
26
27 #include "hid-ids.h"
28
29 MODULE_AUTHOR("Jonathan Klabunde Tomer <jktomer@google.com>");
30 MODULE_DESCRIPTION("HID driver for Network Technologies USB-SUN keyboard adapter");
31
32 /*
33 * NTI Sun keyboard adapter has wrong logical maximum in report descriptor
34 */
35 static __u8 *nti_usbsun_report_fixup(struct hid_device *hdev, __u8 *rdesc,
36 unsigned int *rsize)
37 {
38 if (*rsize >= 60 && rdesc[53] == 0x65 && rdesc[59] == 0x65) {
39 hid_info(hdev, "fixing up NTI USB-SUN keyboard adapter report descriptor\n");
40 rdesc[53] = rdesc[59] = 0xe7;
41 }
42 return rdesc;
43 }
44
45 static const struct hid_device_id nti_devices[] = {
46 { HID_USB_DEVICE(USB_VENDOR_ID_NTI, USB_DEVICE_ID_USB_SUN) },
47 { }
48 };
49 MODULE_DEVICE_TABLE(hid, nti_devices);
50
51 static struct hid_driver nti_driver = {
52 .name = "nti",
53 .id_table = nti_devices,
54 .report_fixup = nti_usbsun_report_fixup
55 };
56
57 module_hid_driver(nti_driver);
58
59 MODULE_LICENSE("GPL");