[RFC 3/6] HID: 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 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 <hdegoede@xxxxxxxxxx>
---
 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;
-- 
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