From patchwork Sat Mar 30 13:37:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10878487 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-2.web.codeaurora.org (Postfix) with ESMTP id 6D4F61669 for ; Sat, 30 Mar 2019 13:37:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5861E28727 for ; Sat, 30 Mar 2019 13:37:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CED128E44; Sat, 30 Mar 2019 13:37:49 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 74CB728727 for ; Sat, 30 Mar 2019 13:37:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730840AbfC3Nhr (ORCPT ); Sat, 30 Mar 2019 09:37:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37492 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730784AbfC3Nhr (ORCPT ); Sat, 30 Mar 2019 09:37:47 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C939A368A5; Sat, 30 Mar 2019 13:37:46 +0000 (UTC) Received: from shalem.localdomain.com (ovpn-116-76.ams2.redhat.com [10.36.116.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87141102BD78; Sat, 30 Mar 2019 13:37:45 +0000 (UTC) From: Hans de Goede To: Jiri Kosina , Benjamin Tissoires , Dmitry Torokhov Cc: Hans de Goede , Peter Hutterer , linux-input@vger.kernel.org Subject: [RFC 3/6] HID: Stop using deprecated BTN_EXTRA, _SIDE, _FORWARD and _BACK defines Date: Sat, 30 Mar 2019 14:37:32 +0100 Message-Id: <20190330133735.14681-4-hdegoede@redhat.com> In-Reply-To: <20190330133735.14681-1-hdegoede@redhat.com> References: <20190330133735.14681-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 30 Mar 2019 13:37:46 +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 Because the name of the BTN_EXTRA, _SIDE, _FORWARD and _BACK defines was a mismatch with how their values were actually being used, they have been deprecated. This commit moves all users of these defines under drivers/hid over to the new defines with the _same_ value. This commit does not cause any functional changes, after this userspace will see the exact same input_event codes as before. Note that at least in the case of the m560 code in hid-logitech-hidpp.c it seems that accidentally the old, not interpreted by userspace as such, _FORWARD and _BACK defines were used. At least with Xorg this may have worked somewhat if the BTN_EXTRA and BTN_SIDE buttons were not generated as Xorg will remove holes from the range, so the buttons would still be mapped to Xorg button 8 and 9, but in this case forward and back will have been swapped. Fixing this falls outside of the scope of this commit as that would actually cause a functional change. Signed-off-by: Hans de Goede --- drivers/hid/hid-kensington.c | 2 +- drivers/hid/hid-logitech-hidpp.c | 12 +++---- drivers/hid/usbhid/usbmouse.c | 8 ++--- drivers/hid/wacom_wac.c | 54 ++++++++++++++++---------------- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/drivers/hid/hid-kensington.c b/drivers/hid/hid-kensington.c index fe9a99dd8d08..5f99397d83db 100644 --- a/drivers/hid/hid-kensington.c +++ b/drivers/hid/hid-kensington.c @@ -29,7 +29,7 @@ static int ks_input_mapping(struct hid_device *hdev, struct hid_input *hi, switch (usage->hid & HID_USAGE) { case 0x01: ks_map_key(BTN_MIDDLE); break; - case 0x02: ks_map_key(BTN_SIDE); break; + case 0x02: ks_map_key(BTN_BACKWRD); break; default: return 0; } diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index 08040ef095ef..5765452a16e0 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c @@ -2600,14 +2600,14 @@ static int m560_raw_event(struct hid_device *hdev, u8 *data, int size) input_report_key(hidpp->input, BTN_MIDDLE, 1); break; case 0xb0: - input_report_key(hidpp->input, BTN_FORWARD, 1); + input_report_key(hidpp->input, BTN_EXTRA1, 1); break; case 0xae: - input_report_key(hidpp->input, BTN_BACK, 1); + input_report_key(hidpp->input, BTN_EXTRA2, 1); break; case 0x00: - input_report_key(hidpp->input, BTN_BACK, 0); - input_report_key(hidpp->input, BTN_FORWARD, 0); + input_report_key(hidpp->input, BTN_EXTRA2, 0); + input_report_key(hidpp->input, BTN_EXTRA1, 0); input_report_key(hidpp->input, BTN_MIDDLE, 0); break; default: @@ -2667,8 +2667,8 @@ static void m560_populate_input(struct hidpp_device *hidpp, __set_bit(BTN_MIDDLE, input_dev->keybit); __set_bit(BTN_RIGHT, input_dev->keybit); __set_bit(BTN_LEFT, input_dev->keybit); - __set_bit(BTN_BACK, input_dev->keybit); - __set_bit(BTN_FORWARD, input_dev->keybit); + __set_bit(BTN_EXTRA2, input_dev->keybit); + __set_bit(BTN_EXTRA1, input_dev->keybit); __set_bit(EV_REL, input_dev->evbit); __set_bit(REL_X, input_dev->relbit); diff --git a/drivers/hid/usbhid/usbmouse.c b/drivers/hid/usbhid/usbmouse.c index 589ad7c15a58..9c73b38778bf 100644 --- a/drivers/hid/usbhid/usbmouse.c +++ b/drivers/hid/usbhid/usbmouse.c @@ -80,8 +80,8 @@ static void usb_mouse_irq(struct urb *urb) input_report_key(dev, BTN_LEFT, data[0] & 0x01); input_report_key(dev, BTN_RIGHT, data[0] & 0x02); input_report_key(dev, BTN_MIDDLE, data[0] & 0x04); - input_report_key(dev, BTN_SIDE, data[0] & 0x08); - input_report_key(dev, BTN_EXTRA, data[0] & 0x10); + input_report_key(dev, BTN_BACKWRD, data[0] & 0x08); + input_report_key(dev, BTN_FORWRD, data[0] & 0x10); input_report_rel(dev, REL_X, data[1]); input_report_rel(dev, REL_Y, data[2]); @@ -180,8 +180,8 @@ static int usb_mouse_probe(struct usb_interface *intf, const struct usb_device_i input_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE); input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); - input_dev->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_SIDE) | - BIT_MASK(BTN_EXTRA); + input_dev->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_BACKWRD) | + BIT_MASK(BTN_FORWRD); input_dev->relbit[0] |= BIT_MASK(REL_WHEEL); input_set_drvdata(input_dev, mouse); diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 5dd3a8245f0f..df2426b1e283 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -406,8 +406,8 @@ static int wacom_graphire_irq(struct wacom_wac *wacom) prox = data[7] & 0xf8; if (prox || wacom->id[1]) { wacom->id[1] = PAD_DEVICE_ID; - input_report_key(pad_input, BTN_BACK, (data[7] & 0x40)); - input_report_key(pad_input, BTN_FORWARD, (data[7] & 0x80)); + input_report_key(pad_input, BTN_EXTRA2, (data[7] & 0x40)); + input_report_key(pad_input, BTN_EXTRA1, (data[7] & 0x80)); rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); input_report_rel(pad_input, REL_WHEEL, rw); if (!prox) @@ -421,9 +421,9 @@ static int wacom_graphire_irq(struct wacom_wac *wacom) prox = (data[7] & 0xf8) || data[8]; if (prox || wacom->id[1]) { wacom->id[1] = PAD_DEVICE_ID; - input_report_key(pad_input, BTN_BACK, (data[7] & 0x08)); + input_report_key(pad_input, BTN_EXTRA2, (data[7] & 0x08)); input_report_key(pad_input, BTN_LEFT, (data[7] & 0x20)); - input_report_key(pad_input, BTN_FORWARD, (data[7] & 0x10)); + input_report_key(pad_input, BTN_EXTRA1, (data[7] & 0x10)); input_report_key(pad_input, BTN_RIGHT, (data[7] & 0x40)); input_report_abs(pad_input, ABS_WHEEL, (data[8] & 0x7f)); if (!prox) @@ -709,8 +709,8 @@ static void wacom_exit_report(struct wacom_wac *wacom) input_report_key(input, BTN_LEFT, 0); input_report_key(input, BTN_MIDDLE, 0); input_report_key(input, BTN_RIGHT, 0); - input_report_key(input, BTN_SIDE, 0); - input_report_key(input, BTN_EXTRA, 0); + input_report_key(input, BTN_BACKWRD, 0); + input_report_key(input, BTN_FORWRD, 0); input_report_abs(input, ABS_THROTTLE, 0); input_report_abs(input, ABS_RZ, 0); } else { @@ -903,8 +903,8 @@ static int wacom_intuos_general(struct wacom_wac *wacom) input_report_key(input, BTN_MIDDLE, data[8] & 0x02); input_report_key(input, BTN_RIGHT, data[8] & 0x04); - input_report_key(input, BTN_SIDE, data[8] & 0x20); - input_report_key(input, BTN_EXTRA, data[8] & 0x10); + input_report_key(input, BTN_BACKWRD, data[8] & 0x20); + input_report_key(input, BTN_FORWRD, data[8] & 0x10); t = (data[6] << 2) | ((data[7] >> 6) & 3); input_report_abs(input, ABS_THROTTLE, (data[8] & 0x08) ? -t : t); break; @@ -916,8 +916,8 @@ static int wacom_intuos_general(struct wacom_wac *wacom) input_report_key(input, BTN_RIGHT, data[6] & 0x04); input_report_rel(input, REL_WHEEL, ((data[7] & 0x80) >> 7) - ((data[7] & 0x40) >> 6)); - input_report_key(input, BTN_SIDE, data[6] & 0x08); - input_report_key(input, BTN_EXTRA, data[6] & 0x10); + input_report_key(input, BTN_BACKWRD, data[6] & 0x08); + input_report_key(input, BTN_FORWRD, data[6] & 0x10); input_report_abs(input, ABS_TILT_X, (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); @@ -935,8 +935,8 @@ static int wacom_intuos_general(struct wacom_wac *wacom) /* I3 2D mouse side buttons */ if (features->type >= INTUOS3S && features->type <= INTUOS3L) { - input_report_key(input, BTN_SIDE, data[8] & 0x40); - input_report_key(input, BTN_EXTRA, data[8] & 0x20); + input_report_key(input, BTN_BACKWRD, data[8] & 0x40); + input_report_key(input, BTN_FORWRD, data[8] & 0x20); } } else if (wacom->tool[idx] == BTN_TOOL_LENS) { @@ -944,8 +944,8 @@ static int wacom_intuos_general(struct wacom_wac *wacom) input_report_key(input, BTN_LEFT, data[8] & 0x01); input_report_key(input, BTN_MIDDLE, data[8] & 0x02); input_report_key(input, BTN_RIGHT, data[8] & 0x04); - input_report_key(input, BTN_SIDE, data[8] & 0x10); - input_report_key(input, BTN_EXTRA, data[8] & 0x08); + input_report_key(input, BTN_BACKWRD, data[8] & 0x10); + input_report_key(input, BTN_FORWRD, data[8] & 0x08); } break; @@ -2791,8 +2791,8 @@ static int wacom_bpt_touch(struct wacom_wac *wacom) input_mt_sync_frame(input); input_report_key(pad_input, BTN_LEFT, (data[1] & 0x08) != 0); - input_report_key(pad_input, BTN_FORWARD, (data[1] & 0x04) != 0); - input_report_key(pad_input, BTN_BACK, (data[1] & 0x02) != 0); + input_report_key(pad_input, BTN_EXTRA1, (data[1] & 0x04) != 0); + input_report_key(pad_input, BTN_EXTRA2, (data[1] & 0x02) != 0); input_report_key(pad_input, BTN_RIGHT, (data[1] & 0x01) != 0); wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); @@ -2849,12 +2849,12 @@ static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data) if (features->type == INTUOSHT || features->type == INTUOSHT2) { input_report_key(input, BTN_LEFT, (data[1] & 0x02) != 0); - input_report_key(input, BTN_BACK, (data[1] & 0x08) != 0); + input_report_key(input, BTN_EXTRA2, (data[1] & 0x08) != 0); } else { - input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0); + input_report_key(input, BTN_EXTRA2, (data[1] & 0x02) != 0); input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); } - input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0); + input_report_key(input, BTN_EXTRA1, (data[1] & 0x04) != 0); input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0); } @@ -3323,8 +3323,8 @@ static void wacom_setup_intuos(struct wacom_wac *wacom_wac) __set_bit(BTN_LEFT, input_dev->keybit); __set_bit(BTN_RIGHT, input_dev->keybit); __set_bit(BTN_MIDDLE, input_dev->keybit); - __set_bit(BTN_SIDE, input_dev->keybit); - __set_bit(BTN_EXTRA, input_dev->keybit); + __set_bit(BTN_BACKWRD, input_dev->keybit); + __set_bit(BTN_FORWRD, input_dev->keybit); __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); __set_bit(BTN_TOOL_LENS, input_dev->keybit); @@ -3948,16 +3948,16 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev, break; case WACOM_MO: - __set_bit(BTN_BACK, input_dev->keybit); + __set_bit(BTN_EXTRA2, input_dev->keybit); __set_bit(BTN_LEFT, input_dev->keybit); - __set_bit(BTN_FORWARD, input_dev->keybit); + __set_bit(BTN_EXTRA1, input_dev->keybit); __set_bit(BTN_RIGHT, input_dev->keybit); input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); break; case WACOM_G4: - __set_bit(BTN_BACK, input_dev->keybit); - __set_bit(BTN_FORWARD, input_dev->keybit); + __set_bit(BTN_EXTRA2, input_dev->keybit); + __set_bit(BTN_EXTRA1, input_dev->keybit); input_set_capability(input_dev, EV_REL, REL_WHEEL); break; @@ -4041,8 +4041,8 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev, __clear_bit(ABS_MISC, input_dev->absbit); __set_bit(BTN_LEFT, input_dev->keybit); - __set_bit(BTN_FORWARD, input_dev->keybit); - __set_bit(BTN_BACK, input_dev->keybit); + __set_bit(BTN_EXTRA1, input_dev->keybit); + __set_bit(BTN_EXTRA2, input_dev->keybit); __set_bit(BTN_RIGHT, input_dev->keybit); break;