From patchwork Wed Aug 27 09:35:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 4786821 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C702B9F2A9 for ; Wed, 27 Aug 2014 09:34:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5D81B200F2 for ; Wed, 27 Aug 2014 09:34:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BBE9D20154 for ; Wed, 27 Aug 2014 09:34:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933136AbaH0JeW (ORCPT ); Wed, 27 Aug 2014 05:34:22 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:37104 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932862AbaH0JeV (ORCPT ); Wed, 27 Aug 2014 05:34:21 -0400 Received: by mail-wi0-f177.google.com with SMTP id ho1so103553wib.16 for ; Wed, 27 Aug 2014 02:34:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=ng2dC5XUYgVsx9TTqyO/4lLcPJH6LQDqgjSTWRucPuE=; b=nIgfjLWObP2qUmOm6M6t4Aj/MGRPzbPw64X4LkOPcRYvK6g26vAvC+2g1CU60bZb8M VlmKudYKUW9hjR/9uPmdtDDdZWWB3LZnolX5W1n6R28Uf6BEPoJ9nEtrrL75pStGcQr6 dknxfkkObbprJtOi1VtmbC6wjaJhbOTkobSFfPeb/ccoY9iTOxiZ9BbSiv581PLQuILg UsKOgTUaPXMoXmpmOpMKk115CQWw0QeYOFovW3ZoXhMVZT+Rlzq8VW1AP2VD6eSHy63H 2p02rNIm9N4UGtVz0Y77skliAY3ywJp8C6Q+a99s1ArTec5Wp3AUTZEgqG/0ujA/fraa A4Yw== X-Received: by 10.194.75.138 with SMTP id c10mr35877643wjw.9.1409132057436; Wed, 27 Aug 2014 02:34:17 -0700 (PDT) Received: from chgm-pc.bachmann.at.bachmann.at (089144238156.atnat0047.highway.bob.at. [89.144.238.156]) by mx.google.com with ESMTPSA id ga9sm15440745wjb.45.2014.08.27.02.34.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Aug 2014 02:34:16 -0700 (PDT) From: Christian Gmeiner To: linux-input@vger.kernel.org Cc: benjamin.tissoires@gmail.com, Christian Gmeiner Subject: [PATCH] HID: add support for PenMount HID TouchScreen Driver v3 Date: Wed, 27 Aug 2014 11:35:15 +0200 Message-Id: <1409132115-31707-1-git-send-email-christian.gmeiner@gmail.com> X-Mailer: git-send-email 1.9.3 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. changes from v1 to v2 - incorporated feedback from Benjamin Tissoires changes from v2 to v3 - add missing hid-core.c and hid-ids.h changes Signed-off-by: Christian Gmeiner --- drivers/hid/Kconfig | 6 ++++++ drivers/hid/Makefile | 1 + drivers/hid/hid-core.c | 1 + drivers/hid/hid-ids.h | 1 + drivers/hid/hid-penmount.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+) create mode 100644 drivers/hid/hid-penmount.c diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index c18d5d7..0351b66 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -530,6 +530,12 @@ config PANTHERLORD_FF Say Y here if you have a PantherLord/GreenAsia based game controller or adapter and want to enable force feedback support for it. +config HID_PENMOUNT + tristate "Penmount touch device" + depends on USB_HID + ---help--- + Say Y here if you have a Penmount based touch controller. + config HID_PETALYNX tristate "Petalynx Maxter remote control" depends on HID diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index 4dbac7f..e2850d8 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -71,6 +71,7 @@ obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o obj-$(CONFIG_HID_ORTEK) += hid-ortek.o obj-$(CONFIG_HID_PRODIKEYS) += hid-prodikeys.o obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o +obj-$(CONFIG_HID_PENMOUNT) += hid-penmount.o obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o obj-$(CONFIG_HID_PICOLCD) += hid-picolcd.o hid-picolcd-y += hid-picolcd_core.o diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 12b6e67..6827196 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1880,6 +1880,7 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) }, { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, + { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) }, { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) }, #if IS_ENABLED(CONFIG_HID_ROCCAT) diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 25cd674..3943ffe 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -722,6 +722,7 @@ #define USB_DEVICE_ID_PENMOUNT_PCI 0x3500 #define USB_DEVICE_ID_PENMOUNT_1610 0x1610 #define USB_DEVICE_ID_PENMOUNT_1640 0x1640 +#define USB_DEVICE_ID_PENMOUNT_6000 0x6000 #define USB_VENDOR_ID_PETALYNX 0x18b1 #define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 diff --git a/drivers/hid/hid-penmount.c b/drivers/hid/hid-penmount.c new file mode 100644 index 0000000..02de4b8 --- /dev/null +++ b/drivers/hid/hid-penmount.c @@ -0,0 +1,51 @@ +/* + * HID driver for PenMount touchscreens + * + * Copyright (c) 2014 Christian Gmeiner + * + * based on hid-penmount copyrighted by + * PenMount Touch Solutions + */ + +/* + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + */ + +#include +#include +#include "hid-ids.h" + +static int penmount_input_mapping(struct hid_device *hdev, + struct hid_input *hi, struct hid_field *field, + struct hid_usage *usage, unsigned long **bit, int *max) +{ + int mapped = 0; + + if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) { + hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); + mapped = 1; + } + + return mapped; +} + +static const struct hid_device_id penmount_devices[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) }, + { } +}; +MODULE_DEVICE_TABLE(hid, penmount_devices); + +static struct hid_driver penmount_driver = { + .name = "hid-penmount", + .id_table = penmount_devices, + .input_mapping = penmount_input_mapping, +}; + +module_hid_driver(penmount_driver); + +MODULE_AUTHOR("Christian Gmeiner "); +MODULE_DESCRIPTION("PenMount HID TouchScreen driver"); +MODULE_LICENSE("GPL");