Skip to content

Commit ffe51d0

Browse files
austriancoderJiri Kosina
authored andcommitted
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>
1 parent 67a9784 commit ffe51d0

5 files changed

Lines changed: 63 additions & 0 deletions

File tree

‎drivers/hid/Kconfig‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,17 @@ config PANTHERLORD_FF
530530
Say Y here if you have a PantherLord/GreenAsia based game controller
531531
or adapter and want to enable force feedback support for it.
532532

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+
533544
config HID_PETALYNX
534545
tristate "Petalynx Maxter remote control"
535546
depends on HID

‎drivers/hid/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o
7171
obj-$(CONFIG_HID_ORTEK) += hid-ortek.o
7272
obj-$(CONFIG_HID_PRODIKEYS) += hid-prodikeys.o
7373
obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o
74+
obj-$(CONFIG_HID_PENMOUNT) += hid-penmount.o
7475
obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o
7576
obj-$(CONFIG_HID_PICOLCD) += hid-picolcd.o
7677
hid-picolcd-y += hid-picolcd_core.o

‎drivers/hid/hid-core.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,6 +1880,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
18801880
{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) },
18811881
{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) },
18821882
{ 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) },
18831884
{ HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
18841885
{ HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) },
18851886
#if IS_ENABLED(CONFIG_HID_ROCCAT)

‎drivers/hid/hid-ids.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,7 @@
722722
#define USB_DEVICE_ID_PENMOUNT_PCI 0x3500
723723
#define USB_DEVICE_ID_PENMOUNT_1610 0x1610
724724
#define USB_DEVICE_ID_PENMOUNT_1640 0x1640
725+
#define USB_DEVICE_ID_PENMOUNT_6000 0x6000
725726

726727
#define USB_VENDOR_ID_PETALYNX 0x18b1
727728
#define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037

‎drivers/hid/hid-penmount.c‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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");

0 commit comments

Comments
 (0)