Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0+
0002 /*
0003  *  HID driver for quirky Macally devices
0004  *
0005  *  Copyright (c) 2019 Alex Henrie <alexhenrie24@gmail.com>
0006  */
0007 
0008 #include <linux/hid.h>
0009 #include <linux/module.h>
0010 
0011 #include "hid-ids.h"
0012 
0013 MODULE_AUTHOR("Alex Henrie <alexhenrie24@gmail.com>");
0014 MODULE_DESCRIPTION("Macally devices");
0015 MODULE_LICENSE("GPL");
0016 
0017 /*
0018  * The Macally ikey keyboard says that its logical and usage maximums are both
0019  * 101, but the power key is 102 and the equals key is 103
0020  */
0021 static __u8 *macally_report_fixup(struct hid_device *hdev, __u8 *rdesc,
0022                  unsigned int *rsize)
0023 {
0024     if (*rsize >= 60 && rdesc[53] == 0x65 && rdesc[59] == 0x65) {
0025         hid_info(hdev,
0026             "fixing up Macally ikey keyboard report descriptor\n");
0027         rdesc[53] = rdesc[59] = 0x67;
0028     }
0029     return rdesc;
0030 }
0031 
0032 static const struct hid_device_id macally_id_table[] = {
0033     { HID_USB_DEVICE(USB_VENDOR_ID_SOLID_YEAR,
0034              USB_DEVICE_ID_MACALLY_IKEY_KEYBOARD) },
0035     { }
0036 };
0037 MODULE_DEVICE_TABLE(hid, macally_id_table);
0038 
0039 static struct hid_driver macally_driver = {
0040     .name           = "macally",
0041     .id_table       = macally_id_table,
0042     .report_fixup       = macally_report_fixup,
0043 };
0044 
0045 module_hid_driver(macally_driver);