hid-macally.c 1.1 KB

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