hid-ortek.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * HID driver for Ortek PKB-1700/WKB-2000 (wireless keyboard + mouse trackpad).
  3. * Fixes LogicalMaximum error in HID report description.
  4. *
  5. * Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com>
  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. static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
  18. unsigned int *rsize)
  19. {
  20. if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
  21. hid_info(hdev, "Fixing up Ortek WKB-2000 report descriptor\n");
  22. rdesc[55] = 0x92;
  23. }
  24. return rdesc;
  25. }
  26. static const struct hid_device_id ortek_devices[] = {
  27. { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) },
  28. { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
  29. { }
  30. };
  31. MODULE_DEVICE_TABLE(hid, ortek_devices);
  32. static struct hid_driver ortek_driver = {
  33. .name = "ortek",
  34. .id_table = ortek_devices,
  35. .report_fixup = ortek_report_fixup
  36. };
  37. static int __init ortek_init(void)
  38. {
  39. return hid_register_driver(&ortek_driver);
  40. }
  41. static void __exit ortek_exit(void)
  42. {
  43. hid_unregister_driver(&ortek_driver);
  44. }
  45. module_init(ortek_init);
  46. module_exit(ortek_exit);
  47. MODULE_LICENSE("GPL");