From patchwork Wed Jul 13 16:06:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 9227853 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5BD04608A7 for ; Wed, 13 Jul 2016 16:10:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B86627FA8 for ; Wed, 13 Jul 2016 16:10:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 407A627F94; Wed, 13 Jul 2016 16:10:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD2F527FA3 for ; Wed, 13 Jul 2016 16:10:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752507AbcGMQHZ (ORCPT ); Wed, 13 Jul 2016 12:07:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56983 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752489AbcGMQHW (ORCPT ); Wed, 13 Jul 2016 12:07:22 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B141F169381; Wed, 13 Jul 2016 16:07:11 +0000 (UTC) Received: from plouf.banquise.eu.com (ovpn-116-194.phx2.redhat.com [10.3.116.194]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6DG6JwV004508; Wed, 13 Jul 2016 12:07:10 -0400 From: Benjamin Tissoires To: Jiri Kosina , Ping Cheng , Jason Gerecke , Aaron Skomra , Peter Hutterer Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Subject: [PATCH v2 26/30] HID: wacom: leds: make sure Cintiq 21UX2 and 24HD control the right LEDs Date: Wed, 13 Jul 2016 18:06:13 +0200 Message-Id: <1468425977-4819-27-git-send-email-benjamin.tissoires@redhat.com> In-Reply-To: <1468425977-4819-1-git-send-email-benjamin.tissoires@redhat.com> References: <1468425977-4819-1-git-send-email-benjamin.tissoires@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 13 Jul 2016 16:07:11 +0000 (UTC) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The code for 21UX2 and 24HD makes the LED group 1 on the left, and the group 0 on the right. The buttons are ordered in the other way, but libwacom already exports those that way. So we simply can't reassign LED group 0 to the left buttons, and have to quirk the incoming data... Signed-off-by: Benjamin Tissoires --- New in v2: - replace: "[PATCH 25/27] HID: wacom: leds: fix ordering of LED banks" --- drivers/hid/wacom_wac.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 00e0c80..a9693d5 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2768,6 +2768,15 @@ static bool wacom_is_led_toggled(struct wacom *wacom, int button_count, { int button_per_group; + /* + * 24HD and 21UX2 have LED group 1 to the left and LED group 0 + * to the right. We need to reverse the group to match this + * historical behavior. + */ + if (wacom->wacom_wac.features.type == WACOM_24HD || + wacom->wacom_wac.features.type == WACOM_21UX2) + group = 1 - group; + button_per_group = button_count/wacom->led.count; return mask & (1 << (group * button_per_group));