hid-elecom.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * HID driver for Elecom BM084 (bluetooth mouse).
  3. * Removes a non-existing horizontal wheel from
  4. * the HID descriptor.
  5. * (This module is based on "hid-ortek".)
  6. *
  7. * Copyright (c) 2010 Richard Nauber <Richard.Nauber@gmail.com>
  8. */
  9. /*
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the Free
  12. * Software Foundation; either version 2 of the License, or (at your option)
  13. * any later version.
  14. */
  15. #include <linux/device.h>
  16. #include <linux/hid.h>
  17. #include <linux/module.h>
  18. #include "hid-ids.h"
  19. static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,
  20. unsigned int *rsize)
  21. {
  22. if (*rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) {
  23. hid_info(hdev, "Fixing up Elecom BM084 report descriptor\n");
  24. rdesc[47] = 0x00;
  25. }
  26. return rdesc;
  27. }
  28. static const struct hid_device_id elecom_devices[] = {
  29. { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084)},
  30. { }
  31. };
  32. MODULE_DEVICE_TABLE(hid, elecom_devices);
  33. static struct hid_driver elecom_driver = {
  34. .name = "elecom",
  35. .id_table = elecom_devices,
  36. .report_fixup = elecom_report_fixup
  37. };
  38. static int __init elecom_init(void)
  39. {
  40. return hid_register_driver(&elecom_driver);
  41. }
  42. static void __exit elecom_exit(void)
  43. {
  44. hid_unregister_driver(&elecom_driver);
  45. }
  46. module_init(elecom_init);
  47. module_exit(elecom_exit);
  48. MODULE_LICENSE("GPL");