From patchwork Sat Mar 30 13:37:30 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: 10878483 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 946AA1874 for ; Sat, 30 Mar 2019 13:37:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 806BE28727 for ; Sat, 30 Mar 2019 13:37:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74B6B28E44; Sat, 30 Mar 2019 13:37:45 +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 DF35628E41 for ; Sat, 30 Mar 2019 13:37:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730837AbfC3Nho (ORCPT ); Sat, 30 Mar 2019 09:37:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37438 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730784AbfC3Nho (ORCPT ); Sat, 30 Mar 2019 09:37:44 -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 8A77F859FE; Sat, 30 Mar 2019 13:37:43 +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 4BCED1001E8A; Sat, 30 Mar 2019 13:37:42 +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 1/6] Input: Rename extra mouse buttons defines to match their actual usage Date: Sat, 30 Mar 2019 14:37:30 +0100 Message-Id: <20190330133735.14681-2-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.26]); Sat, 30 Mar 2019 13:37:43 +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 Almost all modern mice use HID. For buttons 1 - 3 the order of left / right / middle specified in the HUT matches with the BTN_LEFT, BTN_RIGHT and BTN_MIDDLE order of the evdev code defines since the HUT does not specify any meaning for button usages >= 4 the HID input driver simply maps buttons to BTN_LEFT + (number - 1). In practice on most mice which have more then 3 buttons, usage 4 is used for the back(ward) button and usage 5 for the forward button. This means that these buttons generate an input_event code of 0x113 resp. 0x114, which looking at the old defines maps to BTN_SIDE and BTN_EXTRA. Under X these are mapped to buttons 8 resp. 9; and under wayland the input_event code is passed through unmodified. Apps, e.g. Firefox both when running as Wayland client under GNOME3 and when running under Xorg, correctly interpret these as back and forward. So we've back and forward buttons generating BTN_SIDE and BTN_EXTRA, which the apps then interpret as BTN_BACK and BTN_FORWARD, rather then as BTN_SIDE and BTN_EXTRA (which have no clear meaning). I find this all very confusing, this commit tries to remove the confusion by deprecating the old defines and adding new defines which assign labels to the 0x113 - 0x116 input_event codes which match how they are actually used today. Note there are no functional changes here, after this userspace will see the exact same input_event codes as before, this purely about assigning a human-readable label to these codes which matches with how they are actually being used. Signed-off-by: Hans de Goede --- Documentation/input/event-codes.rst | 2 +- drivers/hid/hid-debug.c | 6 +++--- drivers/input/mousedev.c | 8 ++++---- include/uapi/linux/input-event-codes.h | 13 ++++++++++++- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Documentation/input/event-codes.rst b/Documentation/input/event-codes.rst index b24b5343f5eb..db52b96e7a83 100644 --- a/Documentation/input/event-codes.rst +++ b/Documentation/input/event-codes.rst @@ -422,7 +422,7 @@ should be used to report when the tool is in contact with the tablet. BTN_{STYLUS,STYLUS2} should be used to report buttons on the tool itself. Any button may be used for buttons on the tablet except BTN_{MOUSE,LEFT}. BTN_{0,1,2,etc} are good generic codes for unlabeled buttons. Do not use -meaningful buttons, like BTN_FORWARD, unless the button is labeled for that +meaningful buttons, like BTN_FORWRD, unless the button is labeled for that purpose on the device. For new hardware, both INPUT_PROP_DIRECT and INPUT_PROP_POINTER should be set. diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index ac9fda1b5a72..45b56f933fd1 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c @@ -855,9 +855,9 @@ static const char *keys[KEY_MAX + 1] = { [BTN_6] = "Btn6", [BTN_7] = "Btn7", [BTN_8] = "Btn8", [BTN_9] = "Btn9", [BTN_LEFT] = "LeftBtn", [BTN_RIGHT] = "RightBtn", - [BTN_MIDDLE] = "MiddleBtn", [BTN_SIDE] = "SideBtn", - [BTN_EXTRA] = "ExtraBtn", [BTN_FORWARD] = "ForwardBtn", - [BTN_BACK] = "BackBtn", [BTN_TASK] = "TaskBtn", + [BTN_MIDDLE] = "MiddleBtn", [BTN_BACKWRD] = "BackwardBtn", + [BTN_FORWRD] = "ForwardBtn", [BTN_EXTRA1] = "ExtraBtn1", + [BTN_EXTRA2] = "ExtraBtn2", [BTN_TASK] = "TaskBtn", [BTN_TRIGGER] = "Trigger", [BTN_THUMB] = "ThumbBtn", [BTN_THUMB2] = "ThumbBtn2", [BTN_TOP] = "TopBtn", [BTN_TOP2] = "TopBtn2", [BTN_PINKIE] = "PinkieBtn", diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index 412fa71245af..7504e854900f 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c @@ -238,16 +238,16 @@ static void mousedev_key_event(struct mousedev *mousedev, case BTN_RIGHT: index = 1; break; case BTN_2: - case BTN_FORWARD: + case BTN_EXTRA1: case BTN_STYLUS2: case BTN_MIDDLE: index = 2; break; case BTN_3: - case BTN_BACK: - case BTN_SIDE: index = 3; break; + case BTN_EXTRA2: + case BTN_BACKWRD: index = 3; break; case BTN_4: - case BTN_EXTRA: index = 4; break; + case BTN_FORWRD: index = 4; break; default: return; } diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h index 7f14d4a66c28..f11ce5d2c228 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h @@ -355,11 +355,22 @@ #define BTN_LEFT 0x110 #define BTN_RIGHT 0x111 #define BTN_MIDDLE 0x112 +#define BTN_BACKWRD 0x113 +#define BTN_FORWRD 0x114 +#define BTN_EXTRA1 0x115 +#define BTN_EXTRA2 0x116 +#define BTN_TASK 0x117 + +/* + * DEPRECATED: Do not use! + * These old defines are to not break the compilation of user code ONLY. + * Over time they have grown to be incorrect. Almost all modern mice with + * back / forward buttons generate 0x113 for back and 0x114 for forward. + */ #define BTN_SIDE 0x113 #define BTN_EXTRA 0x114 #define BTN_FORWARD 0x115 #define BTN_BACK 0x116 -#define BTN_TASK 0x117 #define BTN_JOYSTICK 0x120 #define BTN_TRIGGER 0x120 From patchwork Sat Mar 30 13:37:31 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: 10878485 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 48C7F1669 for ; Sat, 30 Mar 2019 13:37:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 324F028727 for ; Sat, 30 Mar 2019 13:37:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 269AD28E44; Sat, 30 Mar 2019 13:37:48 +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 188D928727 for ; Sat, 30 Mar 2019 13:37:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730839AbfC3Nhq (ORCPT ); Sat, 30 Mar 2019 09:37:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42606 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730784AbfC3Nhp (ORCPT ); Sat, 30 Mar 2019 09:37:45 -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 44B31821DE; Sat, 30 Mar 2019 13:37:45 +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 CF0791001E8A; Sat, 30 Mar 2019 13:37:43 +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 2/6] Input: Stop using deprecated BTN_EXTRA, _SIDE, _FORWARD and _BACK defines Date: Sat, 30 Mar 2019 14:37:31 +0100 Message-Id: <20190330133735.14681-3-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.28]); Sat, 30 Mar 2019 13:37:45 +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 alps and elan touchpad code 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 some- what 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/input/joystick/a3d.c | 6 +++--- drivers/input/joystick/adi.c | 2 +- drivers/input/mouse/alps.c | 8 ++++---- drivers/input/mouse/elantech.c | 8 ++++---- drivers/input/mouse/logips2pp.c | 20 ++++++++++---------- drivers/input/mouse/psmouse-base.c | 24 ++++++++++++------------ drivers/input/mouse/sentelic.c | 8 ++++---- drivers/input/mouse/sermouse.c | 12 ++++++------ drivers/input/mouse/synaptics.c | 16 ++++++++-------- 9 files changed, 52 insertions(+), 52 deletions(-) diff --git a/drivers/input/joystick/a3d.c b/drivers/input/joystick/a3d.c index 98307039a534..60d9a1aca517 100644 --- a/drivers/input/joystick/a3d.c +++ b/drivers/input/joystick/a3d.c @@ -142,8 +142,8 @@ static void a3d_read(struct a3d *a3d, unsigned char *data) input_report_key(dev, BTN_RIGHT, data[2] & 1); input_report_key(dev, BTN_LEFT, data[3] & 2); input_report_key(dev, BTN_MIDDLE, data[3] & 4); - input_report_key(dev, BTN_SIDE, data[7] & 2); - input_report_key(dev, BTN_EXTRA, data[7] & 4); + input_report_key(dev, BTN_BACKWRD, data[7] & 2); + input_report_key(dev, BTN_FORWRD, data[7] & 4); input_report_abs(dev, ABS_X, ((signed char)((data[15] << 6) | (data[16] << 3) | (data[17]))) + 128); input_report_abs(dev, ABS_Y, ((signed char)((data[18] << 6) | (data[19] << 3) | (data[20]))) + 128); @@ -328,7 +328,7 @@ static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv) BIT_MASK(ABS_HAT1X) | BIT_MASK(ABS_HAT1Y); input_dev->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | - BIT_MASK(BTN_SIDE) | BIT_MASK(BTN_EXTRA); + BIT_MASK(BTN_BACKWRD) | BIT_MASK(BTN_FORWRD); input_dev->keybit[BIT_WORD(BTN_JOYSTICK)] |= BIT_MASK(BTN_TRIGGER) | BIT_MASK(BTN_THUMB) | BIT_MASK(BTN_TOP) | BIT_MASK(BTN_PINKIE); diff --git a/drivers/input/joystick/adi.c b/drivers/input/joystick/adi.c index f466c0d34247..e187a2558213 100644 --- a/drivers/input/joystick/adi.c +++ b/drivers/input/joystick/adi.c @@ -78,7 +78,7 @@ static char adi_cm2_abs[] = { ABS_X, ABS_Y, ABS_Z, ABS_RX, ABS_RY, ABS_RZ }; static char adi_wmf_abs[] = { ABS_WHEEL, ABS_GAS, ABS_BRAKE, ABS_HAT0X, ABS_HAT0Y, ABS_HAT1X, ABS_HAT1Y, ABS_HAT2X, ABS_HAT2Y }; static short adi_wmgpe_key[] = { BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL, BTN_TR, BTN_START, BTN_MODE, BTN_SELECT }; -static short adi_wmi_key[] = { BTN_TRIGGER, BTN_TOP, BTN_THUMB, BTN_TOP2, BTN_BASE, BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_EXTRA }; +static short adi_wmi_key[] = { BTN_TRIGGER, BTN_TOP, BTN_THUMB, BTN_TOP2, BTN_BASE, BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_FORWRD }; static short adi_wmed3d_key[] = { BTN_TRIGGER, BTN_THUMB, BTN_THUMB2, BTN_TOP, BTN_TOP2, BTN_BASE, BTN_BASE2 }; static short adi_cm2_key[] = { BTN_1, BTN_2, BTN_3, BTN_4, BTN_5, BTN_6, BTN_7, BTN_8 }; diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 0a6f7ca883e7..07d65fa6ca86 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c @@ -341,8 +341,8 @@ static void alps_process_packet_v1_v2(struct psmouse *psmouse) input_report_rel(dev, REL_WHEEL, ((packet[2] << 1) & 0x08) - ((packet[0] >> 4) & 0x07)); if (priv->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) { - input_report_key(dev, BTN_FORWARD, forward); - input_report_key(dev, BTN_BACK, back); + input_report_key(dev, BTN_EXTRA1, forward); + input_report_key(dev, BTN_EXTRA2, back); } if (priv->flags & ALPS_FOUR_BUTTONS) { @@ -3057,8 +3057,8 @@ int alps_init(struct psmouse *psmouse) } if (priv->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) { - dev1->keybit[BIT_WORD(BTN_FORWARD)] |= BIT_MASK(BTN_FORWARD); - dev1->keybit[BIT_WORD(BTN_BACK)] |= BIT_MASK(BTN_BACK); + dev1->keybit[BIT_WORD(BTN_EXTRA1)] |= BIT_MASK(BTN_EXTRA1); + dev1->keybit[BIT_WORD(BTN_EXTRA2)] |= BIT_MASK(BTN_EXTRA2); } if (priv->flags & ALPS_FOUR_BUTTONS) { diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index a7f8b1614559..0577e0e2fc9f 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -288,9 +288,9 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse) if (etd->info.fw_version < 0x020000 && (etd->info.capabilities[0] & ETP_CAP_HAS_ROCKER)) { /* rocker up */ - input_report_key(dev, BTN_FORWARD, packet[0] & 0x40); + input_report_key(dev, BTN_EXTRA1, packet[0] & 0x40); /* rocker down */ - input_report_key(dev, BTN_BACK, packet[0] & 0x80); + input_report_key(dev, BTN_EXTRA2, packet[0] & 0x80); } input_sync(dev); @@ -1226,8 +1226,8 @@ static int elantech_set_input_params(struct psmouse *psmouse) /* Rocker button */ if (info->fw_version < 0x020000 && (info->capabilities[0] & ETP_CAP_HAS_ROCKER)) { - __set_bit(BTN_FORWARD, dev->keybit); - __set_bit(BTN_BACK, dev->keybit); + __set_bit(BTN_EXTRA1, dev->keybit); + __set_bit(BTN_EXTRA2, dev->keybit); } input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0); input_set_abs_params(dev, ABS_Y, y_min, y_max, 0, 0); diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c index 3d5637e6fa5f..5deb74a97ea2 100644 --- a/drivers/input/mouse/logips2pp.c +++ b/drivers/input/mouse/logips2pp.c @@ -63,18 +63,18 @@ static psmouse_ret_t ps2pp_process_byte(struct psmouse *psmouse) input_report_rel(dev, packet[2] & 0x80 ? REL_HWHEEL : REL_WHEEL, -sign_extend32(packet[2], 3)); - input_report_key(dev, BTN_SIDE, packet[2] & BIT(4)); - input_report_key(dev, BTN_EXTRA, packet[2] & BIT(5)); + input_report_key(dev, BTN_BACKWRD, packet[2] & BIT(4)); + input_report_key(dev, BTN_FORWRD, packet[2] & BIT(5)); break; case 0x0e: /* buttons 4, 5, 6, 7, 8, 9, 10 info */ - input_report_key(dev, BTN_SIDE, packet[2] & BIT(0)); - input_report_key(dev, BTN_EXTRA, packet[2] & BIT(1)); + input_report_key(dev, BTN_BACKWRD, packet[2] & BIT(0)); + input_report_key(dev, BTN_FORWRD, packet[2] & BIT(1)); input_report_key(dev, BTN_TASK, packet[2] & BIT(2)); - input_report_key(dev, BTN_BACK, packet[2] & BIT(3)); - input_report_key(dev, BTN_FORWARD, packet[2] & BIT(4)); + input_report_key(dev, BTN_EXTRA2, packet[2] & BIT(3)); + input_report_key(dev, BTN_EXTRA1, packet[2] & BIT(4)); break; @@ -277,17 +277,17 @@ static void ps2pp_set_model_properties(struct psmouse *psmouse, struct input_dev *input_dev = psmouse->dev; if (model_info->features & PS2PP_SIDE_BTN) - input_set_capability(input_dev, EV_KEY, BTN_SIDE); + input_set_capability(input_dev, EV_KEY, BTN_BACKWRD); if (model_info->features & PS2PP_EXTRA_BTN) - input_set_capability(input_dev, EV_KEY, BTN_EXTRA); + input_set_capability(input_dev, EV_KEY, BTN_FORWRD); if (model_info->features & PS2PP_TASK_BTN) input_set_capability(input_dev, EV_KEY, BTN_TASK); if (model_info->features & PS2PP_NAV_BTN) { - input_set_capability(input_dev, EV_KEY, BTN_FORWARD); - input_set_capability(input_dev, EV_KEY, BTN_BACK); + input_set_capability(input_dev, EV_KEY, BTN_EXTRA1); + input_set_capability(input_dev, EV_KEY, BTN_EXTRA2); } if (model_info->features & PS2PP_WHEEL) diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index d3ff1fc09af7..2eab4714438d 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -192,8 +192,8 @@ psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse) else input_report_rel(dev, REL_WHEEL, -wheel); - input_report_key(dev, BTN_SIDE, packet[3] & BIT(4)); - input_report_key(dev, BTN_EXTRA, packet[3] & BIT(5)); + input_report_key(dev, BTN_BACKWRD, packet[3] & BIT(4)); + input_report_key(dev, BTN_FORWRD, packet[3] & BIT(5)); break; } break; @@ -203,13 +203,13 @@ psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse) input_report_rel(dev, REL_WHEEL, -(s8) packet[3]); /* Extra buttons on Genius NewNet 3D */ - input_report_key(dev, BTN_SIDE, packet[0] & BIT(6)); - input_report_key(dev, BTN_EXTRA, packet[0] & BIT(7)); + input_report_key(dev, BTN_BACKWRD, packet[0] & BIT(6)); + input_report_key(dev, BTN_FORWRD, packet[0] & BIT(7)); break; case PSMOUSE_THINKPS: /* Extra button on ThinkingMouse */ - input_report_key(dev, BTN_EXTRA, packet[0] & BIT(3)); + input_report_key(dev, BTN_FORWRD, packet[0] & BIT(3)); /* * Without this bit of weirdness moving up gives wildly @@ -223,7 +223,7 @@ psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse) * Cortron PS2 Trackball reports SIDE button in the * 4th bit of the first byte. */ - input_report_key(dev, BTN_SIDE, packet[0] & BIT(3)); + input_report_key(dev, BTN_BACKWRD, packet[0] & BIT(3)); packet[0] |= BIT(3); break; @@ -561,8 +561,8 @@ static int genius_detect(struct psmouse *psmouse, bool set_properties) if (set_properties) { __set_bit(BTN_MIDDLE, psmouse->dev->keybit); - __set_bit(BTN_EXTRA, psmouse->dev->keybit); - __set_bit(BTN_SIDE, psmouse->dev->keybit); + __set_bit(BTN_FORWRD, psmouse->dev->keybit); + __set_bit(BTN_BACKWRD, psmouse->dev->keybit); __set_bit(REL_WHEEL, psmouse->dev->relbit); psmouse->vendor = "Genius"; @@ -639,8 +639,8 @@ static int im_explorer_detect(struct psmouse *psmouse, bool set_properties) __set_bit(BTN_MIDDLE, psmouse->dev->keybit); __set_bit(REL_WHEEL, psmouse->dev->relbit); __set_bit(REL_HWHEEL, psmouse->dev->relbit); - __set_bit(BTN_SIDE, psmouse->dev->keybit); - __set_bit(BTN_EXTRA, psmouse->dev->keybit); + __set_bit(BTN_BACKWRD, psmouse->dev->keybit); + __set_bit(BTN_FORWRD, psmouse->dev->keybit); if (!psmouse->vendor) psmouse->vendor = "Generic"; @@ -677,7 +677,7 @@ static int thinking_detect(struct psmouse *psmouse, bool set_properties) if (set_properties) { __set_bit(BTN_MIDDLE, psmouse->dev->keybit); - __set_bit(BTN_EXTRA, psmouse->dev->keybit); + __set_bit(BTN_FORWRD, psmouse->dev->keybit); psmouse->vendor = "Kensington"; psmouse->name = "ThinkingMouse"; @@ -718,7 +718,7 @@ static int cortron_detect(struct psmouse *psmouse, bool set_properties) psmouse->name = "PS/2 Trackball"; __set_bit(BTN_MIDDLE, psmouse->dev->keybit); - __set_bit(BTN_SIDE, psmouse->dev->keybit); + __set_bit(BTN_BACKWRD, psmouse->dev->keybit); } return 0; diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c index 1d6010d463e2..c95e90575e59 100644 --- a/drivers/input/mouse/sentelic.c +++ b/drivers/input/mouse/sentelic.c @@ -833,8 +833,8 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse) input_report_rel(dev, REL_WHEEL, (int)(packet[3] & 8) - (int)(packet[3] & 7)); input_report_rel(dev, REL_HWHEEL, lscroll - rscroll); - input_report_key(dev, BTN_BACK, lscroll); - input_report_key(dev, BTN_FORWARD, rscroll); + input_report_key(dev, BTN_EXTRA2, lscroll); + input_report_key(dev, BTN_EXTRA1, rscroll); /* * Standard PS/2 Mouse @@ -937,8 +937,8 @@ static int fsp_set_input_params(struct psmouse *psmouse) if (pad->ver < FSP_VER_STL3888_C0) { __set_bit(BTN_MIDDLE, dev->keybit); - __set_bit(BTN_BACK, dev->keybit); - __set_bit(BTN_FORWARD, dev->keybit); + __set_bit(BTN_EXTRA2, dev->keybit); + __set_bit(BTN_EXTRA1, dev->keybit); __set_bit(REL_WHEEL, dev->relbit); __set_bit(REL_HWHEEL, dev->relbit); } else { diff --git a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c index 3e8fb8136452..727f81361a12 100644 --- a/drivers/input/mouse/sermouse.c +++ b/drivers/input/mouse/sermouse.c @@ -145,12 +145,12 @@ static void sermouse_process_ms(struct sermouse *sermouse, signed char data) case SERIO_MP: if ((data >> 2) & 3) break; /* M++ Wireless Extension packet. */ input_report_key(dev, BTN_MIDDLE, (data >> 5) & 1); - input_report_key(dev, BTN_SIDE, (data >> 4) & 1); + input_report_key(dev, BTN_BACKWRD, (data >> 4) & 1); break; case SERIO_MZP: case SERIO_MZPP: - input_report_key(dev, BTN_SIDE, (data >> 5) & 1); + input_report_key(dev, BTN_BACKWRD, (data >> 5) & 1); /* fall through */ case SERIO_MZ: @@ -175,8 +175,8 @@ static void sermouse_process_ms(struct sermouse *sermouse, signed char data) case 1: /* Extra mouse info */ - input_report_key(dev, BTN_SIDE, (data >> 4) & 1); - input_report_key(dev, BTN_EXTRA, (data >> 5) & 1); + input_report_key(dev, BTN_BACKWRD, (data >> 4) & 1); + input_report_key(dev, BTN_FORWRD, (data >> 5) & 1); input_report_rel(dev, data & 0x80 ? REL_HWHEEL : REL_WHEEL, (data & 7) - (data & 8)); break; @@ -269,8 +269,8 @@ static int sermouse_connect(struct serio *serio, struct serio_driver *drv) input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); if (c & 0x01) set_bit(BTN_MIDDLE, input_dev->keybit); - if (c & 0x02) set_bit(BTN_SIDE, input_dev->keybit); - if (c & 0x04) set_bit(BTN_EXTRA, input_dev->keybit); + if (c & 0x02) set_bit(BTN_BACKWRD, input_dev->keybit); + if (c & 0x04) set_bit(BTN_FORWRD, input_dev->keybit); if (c & 0x10) set_bit(REL_WHEEL, input_dev->relbit); if (c & 0x20) set_bit(REL_HWHEEL, input_dev->relbit); diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index b6da0c1267e3..18b8313c0222 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -966,8 +966,8 @@ static void synaptics_report_buttons(struct psmouse *psmouse, input_report_key(dev, BTN_MIDDLE, hw->middle); if (SYN_CAP_FOUR_BUTTON(priv->info.capabilities)) { - input_report_key(dev, BTN_FORWARD, hw->up); - input_report_key(dev, BTN_BACK, hw->down); + input_report_key(dev, BTN_EXTRA1, hw->up); + input_report_key(dev, BTN_EXTRA2, hw->down); } synaptics_report_ext_buttons(psmouse, hw); @@ -1070,16 +1070,16 @@ static void synaptics_process_packet(struct psmouse *psmouse) priv->scroll += hw.scroll; while (priv->scroll >= 4) { - input_report_key(dev, BTN_BACK, !hw.down); + input_report_key(dev, BTN_EXTRA2, !hw.down); input_sync(dev); - input_report_key(dev, BTN_BACK, hw.down); + input_report_key(dev, BTN_EXTRA2, hw.down); input_sync(dev); priv->scroll -= 4; } while (priv->scroll <= -4) { - input_report_key(dev, BTN_FORWARD, !hw.up); + input_report_key(dev, BTN_EXTRA1, !hw.up); input_sync(dev); - input_report_key(dev, BTN_FORWARD, hw.up); + input_report_key(dev, BTN_EXTRA1, hw.up); input_sync(dev); priv->scroll += 4; } @@ -1327,8 +1327,8 @@ static int set_input_params(struct psmouse *psmouse, if (SYN_CAP_FOUR_BUTTON(info->capabilities) || SYN_CAP_MIDDLE_BUTTON(info->capabilities)) { - input_set_capability(dev, EV_KEY, BTN_FORWARD); - input_set_capability(dev, EV_KEY, BTN_BACK); + input_set_capability(dev, EV_KEY, BTN_EXTRA1); + input_set_capability(dev, EV_KEY, BTN_EXTRA2); } if (!SYN_CAP_EXT_BUTTONS_STICK(info->ext_cap_10)) 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; From patchwork Sat Mar 30 13:37:33 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: 10878489 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 182921874 for ; Sat, 30 Mar 2019 13:37:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02F5528727 for ; Sat, 30 Mar 2019 13:37:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB9C128E44; 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 8843B28727 for ; Sat, 30 Mar 2019 13:37:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730841AbfC3Nhs (ORCPT ); Sat, 30 Mar 2019 09:37:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37502 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730784AbfC3Nhs (ORCPT ); Sat, 30 Mar 2019 09:37:48 -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 5C1CD368A5; Sat, 30 Mar 2019 13:37:48 +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 18A8D1042B7B; Sat, 30 Mar 2019 13:37:46 +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 4/6] ARM: Stop using deprecated BTN_EXTRA, _SIDE, _FORWARD and _BACK defines Date: Sat, 30 Mar 2019 14:37:33 +0100 Message-Id: <20190330133735.14681-5-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:48 +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 arch/arm 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 in case of the "user" buttons in the dts files, the original usage of BTN_EXTRA is incorrect, as stated in Documentation/input/event-codes.rst: "BTN_{0,1,2,etc} are good generic codes for unlabeled buttons. Do not use meaningful buttons, like BTN_FORWARD.", fixing this falls outside of the scope of this commit as that would actually cause a functional change. Signed-off-by: Hans de Goede --- arch/arm/boot/dts/imx27-apf27dev.dts | 2 +- arch/arm/boot/dts/omap3-devkit8000-common.dtsi | 2 +- arch/arm/boot/dts/omap4-var-om44customboard.dtsi | 2 +- arch/arm/mach-imx/mach-pcm037_eet.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/boot/dts/imx27-apf27dev.dts b/arch/arm/boot/dts/imx27-apf27dev.dts index 5f84b598e0d0..246ae4f99a83 100644 --- a/arch/arm/boot/dts/imx27-apf27dev.dts +++ b/arch/arm/boot/dts/imx27-apf27dev.dts @@ -44,7 +44,7 @@ user-key { label = "user"; gpios = <&gpio6 13 GPIO_ACTIVE_HIGH>; - linux,code = <276>; /* BTN_EXTRA */ + linux,code = <276>; /* BTN_FORWRD */ }; }; diff --git a/arch/arm/boot/dts/omap3-devkit8000-common.dtsi b/arch/arm/boot/dts/omap3-devkit8000-common.dtsi index 746a658e84b6..e0620d12ccfc 100644 --- a/arch/arm/boot/dts/omap3-devkit8000-common.dtsi +++ b/arch/arm/boot/dts/omap3-devkit8000-common.dtsi @@ -63,7 +63,7 @@ user { label = "user"; gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>; - linux,code = ; + linux,code = ; wakeup-source; }; }; diff --git a/arch/arm/boot/dts/omap4-var-om44customboard.dtsi b/arch/arm/boot/dts/omap4-var-om44customboard.dtsi index 676d8dd0624a..88597c4dd19e 100644 --- a/arch/arm/boot/dts/omap4-var-om44customboard.dtsi +++ b/arch/arm/boot/dts/omap4-var-om44customboard.dtsi @@ -40,7 +40,7 @@ user-key@184 { label = "user"; gpios = <&gpio6 24 GPIO_ACTIVE_HIGH>; /* gpio 184 */ - linux,code = ; + linux,code = ; wakeup-source; }; }; diff --git a/arch/arm/mach-imx/mach-pcm037_eet.c b/arch/arm/mach-imx/mach-pcm037_eet.c index 15bc956d466b..59b815449f94 100644 --- a/arch/arm/mach-imx/mach-pcm037_eet.c +++ b/arch/arm/mach-imx/mach-pcm037_eet.c @@ -124,13 +124,13 @@ static struct gpio_keys_button pcm037_gpio_keys[] = { .wakeup = 0, }, { .type = EV_KEY, - .code = BTN_FORWARD, + .code = BTN_EXTRA1, .gpio = 50, .desc = "Focus Forward", .wakeup = 0, }, { .type = EV_KEY, - .code = BTN_BACK, + .code = BTN_EXTRA2, .gpio = 51, .desc = "Focus Backward", .wakeup = 0, @@ -142,7 +142,7 @@ static struct gpio_keys_button pcm037_gpio_keys[] = { .wakeup = 0, }, { .type = EV_KEY, - .code = BTN_EXTRA, + .code = BTN_FORWRD, .gpio = 53, .desc = "Release Full", .wakeup = 0, From patchwork Sat Mar 30 13:37:34 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: 10878491 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 149EF1669 for ; Sat, 30 Mar 2019 13:37:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 003E528727 for ; Sat, 30 Mar 2019 13:37:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8ED228E44; Sat, 30 Mar 2019 13:37:50 +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 8E5B428727 for ; Sat, 30 Mar 2019 13:37:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730844AbfC3Nhu (ORCPT ); Sat, 30 Mar 2019 09:37:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37184 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730784AbfC3Nhu (ORCPT ); Sat, 30 Mar 2019 09:37:50 -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 DF234308339D; Sat, 30 Mar 2019 13:37:49 +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 9CEEB1062229; Sat, 30 Mar 2019 13:37:48 +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 5/6] media: rc-core: ati_remote: Stop using deprecated BTN_EXTRA, _SIDE defines Date: Sat, 30 Mar 2019 14:37:34 +0100 Message-Id: <20190330133735.14681-6-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.44]); Sat, 30 Mar 2019 13:37:49 +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 and BTN_SIDE defines was a mismatch with how their values were actually being used, they have been deprecated. This commit moves the ati_remote code 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. Signed-off-by: Hans de Goede --- drivers/media/rc/ati_remote.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c index 265e91a2a70d..451efa9d7d49 100644 --- a/drivers/media/rc/ati_remote.c +++ b/drivers/media/rc/ati_remote.c @@ -306,8 +306,8 @@ static const struct { /* Artificial "doubleclick" events are generated by the hardware. * They are mapped to the "side" and "extra" mouse buttons here. */ - {KIND_FILTERED, 0x7a, BTN_SIDE}, /* left dblclick */ - {KIND_FILTERED, 0x7e, BTN_EXTRA},/* right dblclick */ + {KIND_FILTERED, 0x7a, BTN_BACKWRD}, /* left dblclick */ + {KIND_FILTERED, 0x7e, BTN_FORWRD},/* right dblclick */ /* Non-mouse events are handled by rc-core */ {KIND_END, 0x00, 0} @@ -737,7 +737,7 @@ static void ati_remote_input_init(struct ati_remote *ati_remote) idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); idev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) | - BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_SIDE) | BIT_MASK(BTN_EXTRA); + BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_BACKWRD) | BIT_MASK(BTN_FORWRD); idev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) if (ati_remote_tbl[i].kind == KIND_LITERAL || From patchwork Sat Mar 30 13:37:35 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: 10878493 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 C63631669 for ; Sat, 30 Mar 2019 13:37:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2AE828727 for ; Sat, 30 Mar 2019 13:37:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A582F28E44; Sat, 30 Mar 2019 13:37:52 +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 49D6528727 for ; Sat, 30 Mar 2019 13:37:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730849AbfC3Nhv (ORCPT ); Sat, 30 Mar 2019 09:37:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33626 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730784AbfC3Nhv (ORCPT ); Sat, 30 Mar 2019 09:37:51 -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 7083430821F7; Sat, 30 Mar 2019 13:37:51 +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 2D79E1001E8A; Sat, 30 Mar 2019 13:37:50 +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 6/6] Bluetooth: hidp: Stop using deprecated BTN_EXTRA, _SIDE defines Date: Sat, 30 Mar 2019 14:37:35 +0100 Message-Id: <20190330133735.14681-7-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.47]); Sat, 30 Mar 2019 13:37:51 +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 and BTN_SIDE defines was a mismatch with how their values were actually being used, they have been deprecated. This commit moves the bluetooth-hidp code 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. Signed-off-by: Hans de Goede --- net/bluetooth/hidp/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index a442e21f3894..f1905930ceea 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -211,8 +211,8 @@ static void hidp_input_report(struct hidp_session *session, struct sk_buff *skb) input_report_key(dev, BTN_LEFT, sdata[0] & 0x01); input_report_key(dev, BTN_RIGHT, sdata[0] & 0x02); input_report_key(dev, BTN_MIDDLE, sdata[0] & 0x04); - input_report_key(dev, BTN_SIDE, sdata[0] & 0x08); - input_report_key(dev, BTN_EXTRA, sdata[0] & 0x10); + input_report_key(dev, BTN_BACKWRD, sdata[0] & 0x08); + input_report_key(dev, BTN_FORWRD, sdata[0] & 0x10); input_report_rel(dev, REL_X, sdata[1]); input_report_rel(dev, REL_Y, sdata[2]); @@ -690,8 +690,8 @@ static int hidp_setup_input(struct hidp_session *session, input->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE); input->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); - input->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_SIDE) | - BIT_MASK(BTN_EXTRA); + input->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_BACKWRD) | + BIT_MASK(BTN_FORWRD); input->relbit[0] |= BIT_MASK(REL_WHEEL); }