hid-keytouch.c 1.6 KB

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