Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: Add quirk driver for NTI USB-SUN adapter

These adapters allow pre-USB Sun keyboards to be connected to USB-only
machines, but include the wrong maximum keycode in their report descriptor,
making most of the keys present on Sun keyboards but not 101-key PC
keyboards nonfunctional.

This patch implements a quirk that overrides the maximum keycode in the
report descriptor.

Signed-off-by: Jonathan Tomer <jktomer@google.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

authored by

Jonathan Tomer and committed by
Jiri Kosina
07e88a35 81bbef23

+70
+6
drivers/hid/Kconfig
··· 580 580 To compile this driver as a module, choose M here: the 581 581 module will be called hid-multitouch. 582 582 583 + config HID_NTI 584 + tristate "NTI keyboard adapters" 585 + ---help--- 586 + Support for the "extra" Sun keyboard keys on keyboards attached 587 + through Network Technologies USB-SUN keyboard adapters. 588 + 583 589 config HID_NTRIG 584 590 tristate "N-Trig touch screen" 585 591 depends on USB_HID
+1
drivers/hid/Makefile
··· 62 62 obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o 63 63 obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o 64 64 obj-$(CONFIG_HID_MULTITOUCH) += hid-multitouch.o 65 + obj-$(CONFIG_HID_NTI) += hid-nti.o 65 66 obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o 66 67 obj-$(CONFIG_HID_ORTEK) += hid-ortek.o 67 68 obj-$(CONFIG_HID_PRODIKEYS) += hid-prodikeys.o
+1
drivers/hid/hid-core.c
··· 1990 1990 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER) }, 1991 1991 { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, 1992 1992 { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) }, 1993 + { HID_USB_DEVICE(USB_VENDOR_ID_NTI, USB_DEVICE_ID_USB_SUN) }, 1993 1994 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) }, 1994 1995 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) }, 1995 1996 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2) },
+3
drivers/hid/hid-ids.h
··· 767 767 #define USB_DEVICE_ID_NOVATEK_PCT 0x0600 768 768 #define USB_DEVICE_ID_NOVATEK_MOUSE 0x1602 769 769 770 + #define USB_VENDOR_ID_NTI 0x0757 771 + #define USB_DEVICE_ID_USB_SUN 0x0a00 772 + 770 773 #define USB_VENDOR_ID_NTRIG 0x1b96 771 774 #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN 0x0001 772 775 #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1 0x0003
+59
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");