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
5 *
6 * Copyright (c) 2011 Google, Inc.
7 *
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>
14 */
15
16/*
17 */
18
19#include <linux/device.h>
20#include <linux/input.h>
21#include <linux/hid.h>
22#include <linux/module.h>
23
24#include "hid-ids.h"
25
26MODULE_AUTHOR("Jonathan Klabunde Tomer <jktomer@google.com>");
27MODULE_DESCRIPTION("HID driver for Network Technologies USB-SUN keyboard adapter");
28
29/*
30 * NTI Sun keyboard adapter has wrong logical maximum in report descriptor
31 */
32static __u8 *nti_usbsun_report_fixup(struct hid_device *hdev, __u8 *rdesc,
33 unsigned int *rsize)
34{
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;
38 }
39 return rdesc;
40}
41
42static const struct hid_device_id nti_devices[] = {
43 { HID_USB_DEVICE(USB_VENDOR_ID_NTI, USB_DEVICE_ID_USB_SUN) },
44 { }
45};
46MODULE_DEVICE_TABLE(hid, nti_devices);
47
48static struct hid_driver nti_driver = {
49 .name = "nti",
50 .id_table = nti_devices,
51 .report_fixup = nti_usbsun_report_fixup
52};
53
54module_hid_driver(nti_driver);
55
56MODULE_LICENSE("GPL");
57

source code of linux/drivers/hid/hid-nti.c