hid-penmount.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * HID driver for PenMount touchscreens
  3. *
  4. * Copyright (c) 2014 Christian Gmeiner <christian.gmeiner <at> gmail.com>
  5. *
  6. * based on hid-penmount copyrighted by
  7. * PenMount Touch Solutions <penmount <at> seed.net.tw>
  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/module.h>
  16. #include <linux/hid.h>
  17. #include "hid-ids.h"
  18. static int penmount_input_mapping(struct hid_device *hdev,
  19. struct hid_input *hi, struct hid_field *field,
  20. struct hid_usage *usage, unsigned long **bit, int *max)
  21. {
  22. if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) {
  23. hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
  24. return 1;
  25. }
  26. return 0;
  27. }
  28. static const struct hid_device_id penmount_devices[] = {
  29. { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) },
  30. { }
  31. };
  32. MODULE_DEVICE_TABLE(hid, penmount_devices);
  33. static struct hid_driver penmount_driver = {
  34. .name = "hid-penmount",
  35. .id_table = penmount_devices,
  36. .input_mapping = penmount_input_mapping,
  37. };
  38. module_hid_driver(penmount_driver);
  39. MODULE_AUTHOR("Christian Gmeiner <christian.gmeiner@gmail.com>");
  40. MODULE_DESCRIPTION("PenMount HID TouchScreen driver");
  41. MODULE_LICENSE("GPL");