From patchwork Mon Sep 22 16:58:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 4949041 X-Patchwork-Delegate: jikos@jikos.cz 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E39E1BEEA5 for ; Mon, 22 Sep 2014 16:58:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 239A22020F for ; Mon, 22 Sep 2014 16:58:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 36C2320176 for ; Mon, 22 Sep 2014 16:58:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754520AbaIVQ65 (ORCPT ); Mon, 22 Sep 2014 12:58:57 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:41485 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754519AbaIVQ64 (ORCPT ); Mon, 22 Sep 2014 12:58:56 -0400 Received: by mail-pa0-f49.google.com with SMTP id lf10so4925199pab.36 for ; Mon, 22 Sep 2014 09:58:56 -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=is8EpPsQHN5aoDUKVhOhpVnskMpB+PrpWNLzKdYkv3o=; b=LLwUE6PdiAGRpR8F50Oik4oEe5K/Rn8dDxnk7Zzz3iLHEeZYis9HE6Bik/lO/MN2/W tMEIgxnanFRe3TWVIdwXVmxobRRrj4QUldlDp6rvkiAJJslEfl7cYFJKmGymV1dLd//x 4Gb68HHWlyXGYunU6r9McZIvJHAAVliXIqiSp/6jZAJQ323jUL+/RDm3tM/ghtHYigij BWqDi8oFNJcCJRUgMPT/1b6VkLDjKOcv98iAYX/AeGPWhnPpMtb4v42ltqTcRMZ865zB kdtGzFtaUTDQfjr8/JLQ4LBUZmEI9VFokMqAFBEpo1r/5UAyaTAzDrqfDd+rNQK1Qyuw EoSw== X-Received: by 10.68.224.70 with SMTP id ra6mr26091880pbc.33.1411405136430; Mon, 22 Sep 2014 09:58:56 -0700 (PDT) Received: from wacom-arch2.localdomain ([67.51.163.2]) by mx.google.com with ESMTPSA id te8sm9899154pab.34.2014.09.22.09.58.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Sep 2014 09:58:55 -0700 (PDT) From: Jason Gerecke To: linux-input@vger.kernel.org, jkosina@suse.cz, benjamin.tissoires@redhat.com, pinglinux@gmail.com Cc: Jason Gerecke , Jason Gerecke Subject: [PATCH] HID: input: Finish TransducerSerialNumber implementation Date: Mon, 22 Sep 2014 09:58:50 -0700 Message-Id: <1411405130-1663-1-git-send-email-killertofu@gmail.com> X-Mailer: git-send-email 2.1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.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 The commit which introduced TransducerSerialNumber (368c966) is missing two crucial implementation details. Firstly, the commit does not set the type/code/bit/max fields as expected later down the code which can cause the driver to crash when a tablet with this usage is connected. Secondly, the code to send a MSC_SERIAL event to userspace when this usage is seen in a report is nowhere to be found. This commit addresses both issues. Signed-off-by: Jason Gerecke --- drivers/hid/hid-input.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 2619f7f..abed624 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -690,6 +690,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel case 0x5b: /* TransducerSerialNumber */ set_bit(MSC_SERIAL, input->mscbit); + usage->type = EV_MSC; + usage->code = MSC_SERIAL; + bit = input->mscbit; + max = MSC_MAX; break; default: goto unknown; @@ -1041,6 +1045,11 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct input_event(input, EV_KEY, BTN_TOUCH, value > a + ((b - a) >> 3)); } + if (usage->hid == (HID_UP_DIGITIZER | 0x005b)) { /* TransducerSerialNumber */ + input_event(input, EV_MSC, MSC_SERIAL, value); + return; + } + if (usage->hid == (HID_UP_PID | 0x83UL)) { /* Simultaneous Effects Max */ dbg_hid("Maximum Effects - %d\n",value); return;