Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  *  HID driver for various devices which are apparently based on the same chipset
0004  *  from certain vendor which produces chips that contain wrong LogicalMaximum
0005  *  value in their HID report descriptor. Currently supported devices are:
0006  *
0007  *    Ortek PKB-1700
0008  *    Ortek WKB-2000
0009  *    iHome IMAC-A210S
0010  *    Skycable wireless presenter
0011  *
0012  *  Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com>
0013  *  Copyright (c) 2011 Jiri Kosina
0014  */
0015 
0016 /*
0017  */
0018 
0019 #include <linux/device.h>
0020 #include <linux/hid.h>
0021 #include <linux/module.h>
0022 
0023 #include "hid-ids.h"
0024 
0025 static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
0026         unsigned int *rsize)
0027 {
0028     if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
0029         hid_info(hdev, "Fixing up logical maximum in report descriptor (Ortek)\n");
0030         rdesc[55] = 0x92;
0031     } else if (*rsize >= 54 && rdesc[52] == 0x25 && rdesc[53] == 0x01) {
0032         hid_info(hdev, "Fixing up logical maximum in report descriptor (Skycable)\n");
0033         rdesc[53] = 0x65;
0034     }
0035     return rdesc;
0036 }
0037 
0038 static const struct hid_device_id ortek_devices[] = {
0039     { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) },
0040     { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
0041     { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S) },
0042     { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
0043     { }
0044 };
0045 MODULE_DEVICE_TABLE(hid, ortek_devices);
0046 
0047 static struct hid_driver ortek_driver = {
0048     .name = "ortek",
0049     .id_table = ortek_devices,
0050     .report_fixup = ortek_report_fixup
0051 };
0052 module_hid_driver(ortek_driver);
0053 
0054 MODULE_LICENSE("GPL");