From patchwork Tue Feb 17 22:54:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 5841881 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0FD359F36A for ; Tue, 17 Feb 2015 22:54:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4EDE9201DD for ; Tue, 17 Feb 2015 22:54:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 77B7C20160 for ; Tue, 17 Feb 2015 22:54:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753102AbbBQWyY (ORCPT ); Tue, 17 Feb 2015 17:54:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55910 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753076AbbBQWyX (ORCPT ); Tue, 17 Feb 2015 17:54:23 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1HMsHsS022545 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 17 Feb 2015 17:54:17 -0500 Received: from plouf.banquise.eu.com (ovpn-113-48.phx2.redhat.com [10.3.113.48]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1HMsEe7004986; Tue, 17 Feb 2015 17:54:16 -0500 From: Benjamin Tissoires To: Nikolai Kondrashov , Jiri Kosina Cc: Peter Hutterer , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] HID: huion: split the stylus and pad in 2 nodes Date: Tue, 17 Feb 2015 17:54:13 -0500 Message-Id: <1424213653-5970-3-git-send-email-benjamin.tissoires@redhat.com> In-Reply-To: <1424213653-5970-1-git-send-email-benjamin.tissoires@redhat.com> References: <1424213653-5970-1-git-send-email-benjamin.tissoires@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Libinput expects the pad node to be different from the stylus one. We can just use HID_QUIRK_MULTI_INPUT to separate the buttons of the pad than the actual stylus. We can also remove the unused interfaces. Last, we append "Pen" or "Pad" suffix to the appropriate input node to match what the Wacom driver does and be more convenient for the users to know which one is which. Signed-off-by: Benjamin Tissoires --- drivers/hid/hid-huion.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/hid/hid-huion.c b/drivers/hid/hid-huion.c index 50fbda4..f298f66 100644 --- a/drivers/hid/hid-huion.c +++ b/drivers/hid/hid-huion.c @@ -142,6 +142,33 @@ static __u8 *huion_report_fixup(struct hid_device *hdev, __u8 *rdesc, return rdesc; } +static void huion_input_configured(struct hid_device *hdev, + struct hid_input *hi) +{ + char *name; + const char *suffix = NULL; + struct hid_field *field = hi->report->field[0]; + + switch (field->application) { + case HID_GD_KEYPAD: + suffix = "Pad"; + break; + case HID_DG_PEN: + suffix = "Pen"; + break; + } + + if (suffix) { + name = devm_kzalloc(&hi->input->dev, + strlen(hdev->name) + strlen(suffix) + 2, + GFP_KERNEL); + if (name) { + sprintf(name, "%s %s", hdev->name, suffix); + hi->input->name = name; + } + } +} + /** * Enable fully-functional tablet mode and determine device parameters. * @@ -282,6 +309,9 @@ static int huion_probe(struct hid_device *hdev, const struct hid_device_id *id) hid_err(hdev, "tablet enabling failed\n"); return rc; } + hdev->quirks |= HID_QUIRK_MULTI_INPUT; + } else { + return -ENODEV; } break; } @@ -335,6 +365,7 @@ static struct hid_driver huion_driver = { .probe = huion_probe, .report_fixup = huion_report_fixup, .raw_event = huion_raw_event, + .input_configured = huion_input_configured, }; module_hid_driver(huion_driver);