hid-keytouch.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * HID driver for Keytouch devices not fully compliant with HID standard
  4. *
  5. * Copyright (c) 2011 Jiri Kosina
  6. */
  7. /*
  8. */
  9. #include <linux/device.h>
  10. #include <linux/hid.h>
  11. #include <linux/module.h>
  12. #include "hid-ids.h"
  13. /* Replace the broken report descriptor of this device with rather
  14. * a default one */
  15. static const __u8 keytouch_fixed_rdesc[] = {
  16. 0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 0x29, 0xe7, 0x15,
  17. 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08,
  18. 0x81, 0x01, 0x95, 0x03, 0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91,
  19. 0x02, 0x95, 0x05, 0x75, 0x01, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 0x15, 0x00,
  20. 0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 0xff, 0x00, 0x81, 0x00, 0xc0
  21. };
  22. static const __u8 *keytouch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
  23. unsigned int *rsize)
  24. {
  25. hid_info(hdev, "fixing up Keytouch IEC report descriptor\n");
  26. *rsize = sizeof(keytouch_fixed_rdesc);
  27. return keytouch_fixed_rdesc;
  28. }
  29. static const struct hid_device_id keytouch_devices[] = {
  30. { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) },
  31. { }
  32. };
  33. MODULE_DEVICE_TABLE(hid, keytouch_devices);
  34. static struct hid_driver keytouch_driver = {
  35. .name = "keytouch",
  36. .id_table = keytouch_devices,
  37. .report_fixup = keytouch_report_fixup,
  38. };
  39. module_hid_driver(keytouch_driver);
  40. MODULE_DESCRIPTION("HID driver for Keytouch devices not fully compliant with HID standard");
  41. MODULE_LICENSE("GPL");
  42. MODULE_AUTHOR("Jiri Kosina");