From patchwork Tue Sep 23 18:09:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 4958771 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 25FFB9F3DF for ; Tue, 23 Sep 2014 18:09:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 11F5020136 for ; Tue, 23 Sep 2014 18:09:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3F200200E9 for ; Tue, 23 Sep 2014 18:09:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756234AbaIWSJg (ORCPT ); Tue, 23 Sep 2014 14:09:36 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:47964 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755138AbaIWSJf (ORCPT ); Tue, 23 Sep 2014 14:09:35 -0400 Received: by mail-pd0-f169.google.com with SMTP id fp1so2816668pdb.14 for ; Tue, 23 Sep 2014 11:09:35 -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:in-reply-to:references; bh=L/gFW47bqV0Ze0zj2Aoa0gPHgUH6u7I4oqrudub5bwA=; b=q/gw51DZlfFvS9Y91NI8iQJy/QEGvP71/48qNgEFwDGr61ZN++HRsedqNLsWOL132i 0DOoOq8vJLSNQy8D371ErrCgjSGHDXQFZVV/Sg+l+HdELv3E/VxfVkvT4TwlkJAoS9ig yuHMV0VtDCXm5btz2YA3kc+Lahkv8iQDHBUih66opPYd5jx6jsMOdAplEnEhlvkcewYW KasgdurQoev8VoHbSY9wCYrSqaw877RhWsm6O2hxZRoh4w4+Goa1TsWQWvK2KxlGDnCp vioAfYZmWism2g2HGsYF45XkT+YHa2DCCtBh0XLm0QpGrJsyW+4/qyRS1LzM2V2k+Fam RMiA== X-Received: by 10.66.152.131 with SMTP id uy3mr1780195pab.29.1411495774939; Tue, 23 Sep 2014 11:09:34 -0700 (PDT) Received: from wacom-arch2.localdomain ([67.51.163.2]) by mx.google.com with ESMTPSA id tu10sm12769698pab.14.2014.09.23.11.09.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Sep 2014 11:09:33 -0700 (PDT) From: Jason Gerecke To: Benjamin Tissoires , Jason Gerecke , "linux-input@vger.kernel.org" , "jkosina@suse.cz" , "pinglinux@gmail.com" Cc: Jason Gerecke Subject: [PATCH] HID: input: Fix TransducerSerialNumber implementation Date: Tue, 23 Sep 2014 11:09:28 -0700 Message-Id: <1411495768-5956-1-git-send-email-killertofu@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: References: 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.5 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 call to 'set_bit' causes MSC_PULSELED to be sent instead of the expected MSC_SERIAL. This commit addreses both issues. Signed-off-by: Jason Gerecke Reviewed-by: Ping Cheng Reviewed-by: Benjamin Tissoires --- drivers/hid/hid-input.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 2619f7f..cb1b3fa 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -689,7 +689,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel break; 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;