blob: 9a4770d79c644247135c2296687208479e296ac1 [file] [log] [blame]
Thomas Gleixner2874c5f2019-05-27 08:55:01 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Johnathon Harriscd9ec302010-01-21 14:36:52 +00002/*
Jiri Kosinad586dca2011-03-21 13:54:22 +01003 * HID driver for various devices which are apparently based on the same chipset
4 * from certain vendor which produces chips that contain wrong LogicalMaximum
5 * value in their HID report descriptor. Currently supported devices are:
6 *
7 * Ortek PKB-1700
8 * Ortek WKB-2000
Benjamin Tissoiresc2283522017-07-18 18:28:13 +02009 * iHome IMAC-A210S
Jiri Kosinad586dca2011-03-21 13:54:22 +010010 * Skycable wireless presenter
Johnathon Harriscd9ec302010-01-21 14:36:52 +000011 *
12 * Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com>
Jiri Kosinad586dca2011-03-21 13:54:22 +010013 * Copyright (c) 2011 Jiri Kosina
Johnathon Harriscd9ec302010-01-21 14:36:52 +000014 */
15
16/*
Johnathon Harriscd9ec302010-01-21 14:36:52 +000017 */
18
19#include <linux/device.h>
20#include <linux/hid.h>
21#include <linux/module.h>
22
23#include "hid-ids.h"
24
Nikolai Kondrashov73e40082010-08-06 23:03:06 +040025static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
26 unsigned int *rsize)
Johnathon Harriscd9ec302010-01-21 14:36:52 +000027{
Nikolai Kondrashov73e40082010-08-06 23:03:06 +040028 if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
Benjamin Tissoiresc2283522017-07-18 18:28:13 +020029 hid_info(hdev, "Fixing up logical maximum in report descriptor (Ortek)\n");
Johnathon Harriscd9ec302010-01-21 14:36:52 +000030 rdesc[55] = 0x92;
Jiri Kosinad586dca2011-03-21 13:54:22 +010031 } else if (*rsize >= 54 && rdesc[52] == 0x25 && rdesc[53] == 0x01) {
Benjamin Tissoiresc2283522017-07-18 18:28:13 +020032 hid_info(hdev, "Fixing up logical maximum in report descriptor (Skycable)\n");
Jiri Kosinad586dca2011-03-21 13:54:22 +010033 rdesc[53] = 0x65;
Johnathon Harriscd9ec302010-01-21 14:36:52 +000034 }
Nikolai Kondrashov73e40082010-08-06 23:03:06 +040035 return rdesc;
Johnathon Harriscd9ec302010-01-21 14:36:52 +000036}
37
38static const struct hid_device_id ortek_devices[] = {
Herton Ronaldo Krzesinski270fdc02011-03-16 14:13:53 -030039 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) },
Johnathon Harriscd9ec302010-01-21 14:36:52 +000040 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
Benjamin Tissoiresc2283522017-07-18 18:28:13 +020041 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S) },
Jiri Kosinad586dca2011-03-21 13:54:22 +010042 { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
Johnathon Harriscd9ec302010-01-21 14:36:52 +000043 { }
44};
45MODULE_DEVICE_TABLE(hid, ortek_devices);
46
47static struct hid_driver ortek_driver = {
48 .name = "ortek",
49 .id_table = ortek_devices,
50 .report_fixup = ortek_report_fixup
51};
H Hartley Sweetenf4254582012-12-17 15:28:26 -070052module_hid_driver(ortek_driver);
Johnathon Harriscd9ec302010-01-21 14:36:52 +000053
Johnathon Harriscd9ec302010-01-21 14:36:52 +000054MODULE_LICENSE("GPL");