Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  *  HID driver for Keytouch devices not fully compliant with HID standard
0004  *
0005  *  Copyright (c) 2011 Jiri Kosina
0006  */
0007 
0008 /*
0009  */
0010 
0011 #include <linux/device.h>
0012 #include <linux/hid.h>
0013 #include <linux/module.h>
0014 
0015 #include "hid-ids.h"
0016 
0017 /* Replace the broken report descriptor of this device with rather
0018  * a default one */
0019 static __u8 keytouch_fixed_rdesc[] = {
0020 0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 0x29, 0xe7, 0x15,
0021 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08,
0022 0x81, 0x01, 0x95, 0x03, 0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91,
0023 0x02, 0x95, 0x05, 0x75, 0x01, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 0x15, 0x00,
0024 0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 0xff, 0x00, 0x81, 0x00, 0xc0
0025 };
0026 
0027 static __u8 *keytouch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
0028         unsigned int *rsize)
0029 {
0030     hid_info(hdev, "fixing up Keytouch IEC report descriptor\n");
0031 
0032     rdesc = keytouch_fixed_rdesc;
0033     *rsize = sizeof(keytouch_fixed_rdesc);
0034 
0035     return rdesc;
0036 }
0037 
0038 static const struct hid_device_id keytouch_devices[] = {
0039     { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) },
0040     { }
0041 };
0042 MODULE_DEVICE_TABLE(hid, keytouch_devices);
0043 
0044 static struct hid_driver keytouch_driver = {
0045     .name = "keytouch",
0046     .id_table = keytouch_devices,
0047     .report_fixup = keytouch_report_fixup,
0048 };
0049 module_hid_driver(keytouch_driver);
0050 
0051 MODULE_LICENSE("GPL");
0052 MODULE_AUTHOR("Jiri Kosina");