^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * HID driver for quirky Macally devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2019 Alex Henrie <alexhenrie24@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/hid.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "hid-ids.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) MODULE_AUTHOR("Alex Henrie <alexhenrie24@gmail.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) MODULE_DESCRIPTION("Macally devices");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * The Macally ikey keyboard says that its logical and usage maximums are both
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * 101, but the power key is 102 and the equals key is 103
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) static __u8 *macally_report_fixup(struct hid_device *hdev, __u8 *rdesc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) unsigned int *rsize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) if (*rsize >= 60 && rdesc[53] == 0x65 && rdesc[59] == 0x65) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) hid_info(hdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) "fixing up Macally ikey keyboard report descriptor\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) rdesc[53] = rdesc[59] = 0x67;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) return rdesc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) static const struct hid_device_id macally_id_table[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) { HID_USB_DEVICE(USB_VENDOR_ID_SOLID_YEAR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) USB_DEVICE_ID_MACALLY_IKEY_KEYBOARD) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) MODULE_DEVICE_TABLE(hid, macally_id_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) static struct hid_driver macally_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) .name = "macally",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) .id_table = macally_id_table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) .report_fixup = macally_report_fixup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) module_hid_driver(macally_driver);