hid-kye.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * HID driver for Kye/Genius devices not fully compliant with HID standard
  3. *
  4. * Copyright (c) 2009 Jiri Kosina
  5. * Copyright (c) 2009 Tomas Hanak
  6. */
  7. /*
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the Free
  10. * Software Foundation; either version 2 of the License, or (at your option)
  11. * any later version.
  12. */
  13. #include <linux/device.h>
  14. #include <linux/hid.h>
  15. #include <linux/module.h>
  16. #include "hid-ids.h"
  17. /* the fixups that need to be done:
  18. * - change led usage page to button for extra buttons
  19. * - report size 8 count 1 must be size 1 count 8 for button bitfield
  20. * - change the button usage range to 4-7 for the extra buttons
  21. */
  22. static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
  23. unsigned int *rsize)
  24. {
  25. if (*rsize >= 74 &&
  26. rdesc[61] == 0x05 && rdesc[62] == 0x08 &&
  27. rdesc[63] == 0x19 && rdesc[64] == 0x08 &&
  28. rdesc[65] == 0x29 && rdesc[66] == 0x0f &&
  29. rdesc[71] == 0x75 && rdesc[72] == 0x08 &&
  30. rdesc[73] == 0x95 && rdesc[74] == 0x01) {
  31. hid_info(hdev,
  32. "fixing up Kye/Genius Ergo Mouse report descriptor\n");
  33. rdesc[62] = 0x09;
  34. rdesc[64] = 0x04;
  35. rdesc[66] = 0x07;
  36. rdesc[72] = 0x01;
  37. rdesc[74] = 0x08;
  38. }
  39. return rdesc;
  40. }
  41. static const struct hid_device_id kye_devices[] = {
  42. { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) },
  43. { }
  44. };
  45. MODULE_DEVICE_TABLE(hid, kye_devices);
  46. static struct hid_driver kye_driver = {
  47. .name = "kye",
  48. .id_table = kye_devices,
  49. .report_fixup = kye_report_fixup,
  50. };
  51. static int __init kye_init(void)
  52. {
  53. return hid_register_driver(&kye_driver);
  54. }
  55. static void __exit kye_exit(void)
  56. {
  57. hid_unregister_driver(&kye_driver);
  58. }
  59. module_init(kye_init);
  60. module_exit(kye_exit);
  61. MODULE_LICENSE("GPL");