Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: add support for PenMount HID TouchScreen Driver

This patch adds a seperate hid-penmount driver to work
around an issue with the HID report descriptor. The
descriptor does not contain the ContactID usage and as
result the touchscreen is represented as normal mouse
to the system.

This driver maps the button 0 emitted by the touchscreen
to BTN_TOUCH. This makes it possible to use touch events
in userspace.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

authored by

Christian Gmeiner and committed by
Jiri Kosina
ffe51d0d 67a97845

+63
+11
drivers/hid/Kconfig
··· 530 530 Say Y here if you have a PantherLord/GreenAsia based game controller 531 531 or adapter and want to enable force feedback support for it. 532 532 533 + config HID_PENMOUNT 534 + tristate "Penmount touch device" 535 + depends on USB_HID 536 + ---help--- 537 + This selects a driver for the PenMount 6000 touch controller. 538 + 539 + The driver works around a problem in the report descript allowing 540 + the userspace to touch events instead of mouse events. 541 + 542 + Say Y here if you have a Penmount based touch controller. 543 + 533 544 config HID_PETALYNX 534 545 tristate "Petalynx Maxter remote control" 535 546 depends on HID
+1
drivers/hid/Makefile
··· 71 71 obj-$(CONFIG_HID_ORTEK) += hid-ortek.o 72 72 obj-$(CONFIG_HID_PRODIKEYS) += hid-prodikeys.o 73 73 obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o 74 + obj-$(CONFIG_HID_PENMOUNT) += hid-penmount.o 74 75 obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o 75 76 obj-$(CONFIG_HID_PICOLCD) += hid-picolcd.o 76 77 hid-picolcd-y += hid-picolcd_core.o
+1
drivers/hid/hid-core.c
··· 1880 1880 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) }, 1881 1881 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, 1882 1882 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, 1883 + { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) }, 1883 1884 { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, 1884 1885 { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) }, 1885 1886 #if IS_ENABLED(CONFIG_HID_ROCCAT)
+1
drivers/hid/hid-ids.h
··· 722 722 #define USB_DEVICE_ID_PENMOUNT_PCI 0x3500 723 723 #define USB_DEVICE_ID_PENMOUNT_1610 0x1610 724 724 #define USB_DEVICE_ID_PENMOUNT_1640 0x1640 725 + #define USB_DEVICE_ID_PENMOUNT_6000 0x6000 725 726 726 727 #define USB_VENDOR_ID_PETALYNX 0x18b1 727 728 #define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037
+49
drivers/hid/hid-penmount.c
··· 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 + /* 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 + 17 + #include <linux/module.h> 18 + #include <linux/hid.h> 19 + #include "hid-ids.h" 20 + 21 + static int penmount_input_mapping(struct hid_device *hdev, 22 + struct hid_input *hi, struct hid_field *field, 23 + struct hid_usage *usage, 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 + 30 + return 0; 31 + } 32 + 33 + static const struct hid_device_id penmount_devices[] = { 34 + { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) }, 35 + { } 36 + }; 37 + MODULE_DEVICE_TABLE(hid, penmount_devices); 38 + 39 + static struct hid_driver penmount_driver = { 40 + .name = "hid-penmount", 41 + .id_table = penmount_devices, 42 + .input_mapping = penmount_input_mapping, 43 + }; 44 + 45 + module_hid_driver(penmount_driver); 46 + 47 + MODULE_AUTHOR("Christian Gmeiner <christian.gmeiner@gmail.com>"); 48 + MODULE_DESCRIPTION("PenMount HID TouchScreen driver"); 49 + MODULE_LICENSE("GPL");