hid-lcpower.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * HID driver for LC Power Model RC1000MCE
  4. *
  5. * Copyright (c) 2011 Chris Schlund
  6. * based on hid-topseed module
  7. */
  8. /*
  9. */
  10. #include <linux/device.h>
  11. #include <linux/hid.h>
  12. #include <linux/module.h>
  13. #include "hid-ids.h"
  14. #define ts_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
  15. EV_KEY, (c))
  16. static int ts_input_mapping(struct hid_device *hdev, struct hid_input *hi,
  17. struct hid_field *field, struct hid_usage *usage,
  18. unsigned long **bit, int *max)
  19. {
  20. if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
  21. return 0;
  22. switch (usage->hid & HID_USAGE) {
  23. case 0x046: ts_map_key_clear(KEY_YELLOW); break;
  24. case 0x047: ts_map_key_clear(KEY_GREEN); break;
  25. case 0x049: ts_map_key_clear(KEY_BLUE); break;
  26. case 0x04a: ts_map_key_clear(KEY_RED); break;
  27. case 0x00d: ts_map_key_clear(KEY_HOME); break;
  28. case 0x025: ts_map_key_clear(KEY_TV); break;
  29. case 0x048: ts_map_key_clear(KEY_VCR); break;
  30. case 0x024: ts_map_key_clear(KEY_MENU); break;
  31. default:
  32. return 0;
  33. }
  34. return 1;
  35. }
  36. static const struct hid_device_id ts_devices[] = {
  37. { HID_USB_DEVICE( USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000) },
  38. { }
  39. };
  40. MODULE_DEVICE_TABLE(hid, ts_devices);
  41. static struct hid_driver ts_driver = {
  42. .name = "LC RC1000MCE",
  43. .id_table = ts_devices,
  44. .input_mapping = ts_input_mapping,
  45. };
  46. module_hid_driver(ts_driver);
  47. MODULE_LICENSE("GPL");