hid-topseed.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * HID driver for TopSeed Cyberlink remote
  3. *
  4. * Copyright (c) 2008 Lev Babiev
  5. * based on hid-cherry driver
  6. *
  7. * Modified to also support BTC "Emprex 3009URF III Vista MCE Remote" by
  8. * Wayne Thomas 2010.
  9. *
  10. * Modified to support Conceptronic CLLRCMCE by
  11. * Kees Bakker 2010.
  12. */
  13. /*
  14. * This program is free software; you can redistribute it and/or modify it
  15. * under the terms of the GNU General Public License as published by the Free
  16. * Software Foundation; either version 2 of the License, or (at your option)
  17. * any later version.
  18. */
  19. #include <linux/device.h>
  20. #include <linux/hid.h>
  21. #include <linux/module.h>
  22. #include "hid-ids.h"
  23. #define ts_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
  24. EV_KEY, (c))
  25. static int ts_input_mapping(struct hid_device *hdev, struct hid_input *hi,
  26. struct hid_field *field, struct hid_usage *usage,
  27. unsigned long **bit, int *max)
  28. {
  29. if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
  30. return 0;
  31. switch (usage->hid & HID_USAGE) {
  32. case 0x00d: ts_map_key_clear(KEY_MEDIA); break;
  33. case 0x024: ts_map_key_clear(KEY_MENU); break;
  34. case 0x025: ts_map_key_clear(KEY_TV); break;
  35. case 0x027: ts_map_key_clear(KEY_MODE); break;
  36. case 0x031: ts_map_key_clear(KEY_AUDIO); break;
  37. case 0x032: ts_map_key_clear(KEY_TEXT); break;
  38. case 0x033: ts_map_key_clear(KEY_CHANNEL); break;
  39. case 0x047: ts_map_key_clear(KEY_MP3); break;
  40. case 0x048: ts_map_key_clear(KEY_TV2); break;
  41. case 0x049: ts_map_key_clear(KEY_CAMERA); break;
  42. case 0x04a: ts_map_key_clear(KEY_VIDEO); break;
  43. case 0x04b: ts_map_key_clear(KEY_ANGLE); break;
  44. case 0x04c: ts_map_key_clear(KEY_LANGUAGE); break;
  45. case 0x04d: ts_map_key_clear(KEY_SUBTITLE); break;
  46. case 0x050: ts_map_key_clear(KEY_RADIO); break;
  47. case 0x05a: ts_map_key_clear(KEY_TEXT); break;
  48. case 0x05b: ts_map_key_clear(KEY_RED); break;
  49. case 0x05c: ts_map_key_clear(KEY_GREEN); break;
  50. case 0x05d: ts_map_key_clear(KEY_YELLOW); break;
  51. case 0x05e: ts_map_key_clear(KEY_BLUE); break;
  52. default:
  53. return 0;
  54. }
  55. return 1;
  56. }
  57. static const struct hid_device_id ts_devices[] = {
  58. { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
  59. { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
  60. { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
  61. { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) },
  62. { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) },
  63. { }
  64. };
  65. MODULE_DEVICE_TABLE(hid, ts_devices);
  66. static struct hid_driver ts_driver = {
  67. .name = "topseed",
  68. .id_table = ts_devices,
  69. .input_mapping = ts_input_mapping,
  70. };
  71. module_hid_driver(ts_driver);
  72. MODULE_LICENSE("GPL");