From patchwork Mon Jul 20 12:07:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrej Shadura X-Patchwork-Id: 6826651 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 52F5EC05AC for ; Mon, 20 Jul 2015 12:08:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B9F72060A for ; Mon, 20 Jul 2015 12:08:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DEB792062C for ; Mon, 20 Jul 2015 12:08:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755413AbbGTMIS (ORCPT ); Mon, 20 Jul 2015 08:08:18 -0400 Received: from bhuna.collabora.co.uk ([93.93.135.160]:44558 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755632AbbGTMIR (ORCPT ); Mon, 20 Jul 2015 08:08:17 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: andrewsh) with ESMTPSA id 00F886001DF From: Andrew Shadura To: Linux Input Mailing List Subject: [PATCH] HID: update PenMount USB report descriptor so that only one button is reported Date: Mon, 20 Jul 2015 14:07:44 +0200 Message-Id: <1437394064-13881-1-git-send-email-andrew.shadura@collabora.co.uk> X-Mailer: git-send-email 2.1.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 PenMount USB resistive touchscreen reports it has three buttons, while in reality it doesn't have any and doesn't support active styli, and only generates touch events. Signed-off-by: Andrew Shadura --- drivers/hid/hid-penmount.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/hid/hid-penmount.c b/drivers/hid/hid-penmount.c index c11dce8..4e12502 100644 --- a/drivers/hid/hid-penmount.c +++ b/drivers/hid/hid-penmount.c @@ -30,6 +30,21 @@ static int penmount_input_mapping(struct hid_device *hdev, return 0; } +static __u8 *penmount_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int *rsize) +{ + if (*rsize == 76 && + rdesc[2] == 0x09 && rdesc[3] == 0x02 /* mouse */ && + rdesc[22] == 0x05 && rdesc[23] == 0x09 /* button */ && + rdesc[26] == 0x29 && rdesc[27] == 0x03 /* maximum */) { + hid_info(hdev, + "fixing up PenMount USB touchscreen report descriptor\n"); + + rdesc[27] = 0x01; /* just one button */ + } + return rdesc; +} + static const struct hid_device_id penmount_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) }, { } @@ -39,6 +54,7 @@ MODULE_DEVICE_TABLE(hid, penmount_devices); static struct hid_driver penmount_driver = { .name = "hid-penmount", .id_table = penmount_devices, + .report_fixup = penmount_report_fixup, .input_mapping = penmount_input_mapping, };