hid-plantronics.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Plantronics USB HID Driver
  3. *
  4. * Copyright (c) 2014 JD Cole <jd.cole@plantronics.com>
  5. * Copyright (c) 2014 Terry Junge <terry.junge@plantronics.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 "hid-ids.h"
  14. #include <linux/hid.h>
  15. #include <linux/module.h>
  16. static int plantronics_input_mapping(struct hid_device *hdev,
  17. struct hid_input *hi,
  18. struct hid_field *field,
  19. struct hid_usage *usage,
  20. unsigned long **bit, int *max)
  21. {
  22. if (field->application == HID_CP_CONSUMERCONTROL
  23. && (usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER) {
  24. hid_dbg(hdev, "usage: %08x (appl: %08x) - defaulted\n",
  25. usage->hid, field->application);
  26. return 0;
  27. }
  28. hid_dbg(hdev, "usage: %08x (appl: %08x) - ignored\n",
  29. usage->hid, field->application);
  30. return -1;
  31. }
  32. static const struct hid_device_id plantronics_devices[] = {
  33. { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
  34. { }
  35. };
  36. MODULE_DEVICE_TABLE(hid, plantronics_devices);
  37. static struct hid_driver plantronics_driver = {
  38. .name = "plantronics",
  39. .id_table = plantronics_devices,
  40. .input_mapping = plantronics_input_mapping,
  41. };
  42. module_hid_driver(plantronics_driver);
  43. MODULE_AUTHOR("JD Cole <jd.cole@plantronics.com>");
  44. MODULE_AUTHOR("Terry Junge <terry.junge@plantronics.com>");
  45. MODULE_DESCRIPTION("Plantronics USB HID Driver");
  46. MODULE_LICENSE("GPL");