Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / hid / hid-nti.c
blob1952e9ca5f45b57101275d7aaaceac3f3f2ef18d
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * USB HID quirks support for Network Technologies, Inc. "USB-SUN" USB
4 * adapter for pre-USB Sun keyboards
6 * Copyright (c) 2011 Google, Inc.
8 * Based on HID apple driver by
9 * Copyright (c) 1999 Andreas Gal
10 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
11 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
12 * Copyright (c) 2006-2007 Jiri Kosina
13 * Copyright (c) 2008 Jiri Slaby <jirislaby@gmail.com>
19 #include <linux/device.h>
20 #include <linux/input.h>
21 #include <linux/hid.h>
22 #include <linux/module.h>
24 #include "hid-ids.h"
26 MODULE_AUTHOR("Jonathan Klabunde Tomer <jktomer@google.com>");
27 MODULE_DESCRIPTION("HID driver for Network Technologies USB-SUN keyboard adapter");
30 * NTI Sun keyboard adapter has wrong logical maximum in report descriptor
32 static __u8 *nti_usbsun_report_fixup(struct hid_device *hdev, __u8 *rdesc,
33 unsigned int *rsize)
35 if (*rsize >= 60 && rdesc[53] == 0x65 && rdesc[59] == 0x65) {
36 hid_info(hdev, "fixing up NTI USB-SUN keyboard adapter report descriptor\n");
37 rdesc[53] = rdesc[59] = 0xe7;
39 return rdesc;
42 static const struct hid_device_id nti_devices[] = {
43 { HID_USB_DEVICE(USB_VENDOR_ID_NTI, USB_DEVICE_ID_USB_SUN) },
44 { }
46 MODULE_DEVICE_TABLE(hid, nti_devices);
48 static struct hid_driver nti_driver = {
49 .name = "nti",
50 .id_table = nti_devices,
51 .report_fixup = nti_usbsun_report_fixup
54 module_hid_driver(nti_driver);
56 MODULE_LICENSE("GPL");