hid-accutouch.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * HID driver for Elo Accutouch touchscreens
  3. *
  4. * Copyright (c) 2016, Collabora Ltd.
  5. * Copyright (c) 2016, General Electric Company
  6. *
  7. * based on hid-penmount.c
  8. * Copyright (c) 2014 Christian Gmeiner <christian.gmeiner <at> gmail.com>
  9. */
  10. /*
  11. * This program is free software; you can redistribute it and/or modify it
  12. * under the terms of the GNU General Public License as published by the Free
  13. * Software Foundation; either version 2 of the License, or (at your option)
  14. * any later version.
  15. */
  16. #include <linux/hid.h>
  17. #include <linux/module.h>
  18. #include "hid-ids.h"
  19. static int accutouch_input_mapping(struct hid_device *hdev,
  20. struct hid_input *hi,
  21. struct hid_field *field,
  22. struct hid_usage *usage,
  23. unsigned long **bit, int *max)
  24. {
  25. if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) {
  26. hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
  27. return 1;
  28. }
  29. return 0;
  30. }
  31. static const struct hid_device_id accutouch_devices[] = {
  32. { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_ACCUTOUCH_2216) },
  33. { }
  34. };
  35. MODULE_DEVICE_TABLE(hid, accutouch_devices);
  36. static struct hid_driver accutouch_driver = {
  37. .name = "hid-accutouch",
  38. .id_table = accutouch_devices,
  39. .input_mapping = accutouch_input_mapping,
  40. };
  41. module_hid_driver(accutouch_driver);
  42. MODULE_AUTHOR("Martyn Welch <martyn.welch@collabora.co.uk");
  43. MODULE_DESCRIPTION("Elo Accutouch HID TouchScreen driver");
  44. MODULE_LICENSE("GPL");