[RFC 2/6] Input: Stop using deprecated BTN_EXTRA, _SIDE, _FORWARD and _BACK defines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <hdegoede@xxxxxxxxxx>
---
 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))
-- 
2.21.0




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux