From 13d549489b4bd2eade719cf2ec8c37724be6e640 Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Sat, 7 Sep 2013 09:17:11 +0200
Subject: [PATCH] Revert/Fix "Input: introduce BTN/ABS bits for drums and
 guitars"

commit 61e00655e9cb82e034eb72b95a51072e718d14a7
Author: David Herrmann <dh.herrmann@gmail.com>
Date:   Mon Aug 26 19:14:46 2013 +0200

    Input: introduce BTN/ABS bits for drums and guitars

This introduced several new identifiers for drums/guitar devices. However,
it also increased ABS_MAX. Unfortunately, 0x3f is already the maximum we
can use for ABS_MAX due to the limited EVIOCSABS ioctl.

Revert this commit and move the new identifiers somewhere in between. We
need to figure out some other way to add new identifiers for the future.
To avoid this happening again, I added a small comment.

This also fixes an issue where xf86-input-evdev failed on EVIOCGABS() due
to ABS_MAX not being a full mask.

Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
 include/linux/mod_devicetable.h |  2 +-
 include/uapi/linux/input.h      | 33 ++++++++++++++++++---------------
 2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 329aa30..45e9214 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -277,7 +277,7 @@ struct pcmcia_device_id {
 #define INPUT_DEVICE_ID_KEY_MIN_INTERESTING	0x71
 #define INPUT_DEVICE_ID_KEY_MAX		0x2ff
 #define INPUT_DEVICE_ID_REL_MAX		0x0f
-#define INPUT_DEVICE_ID_ABS_MAX		0x4f
+#define INPUT_DEVICE_ID_ABS_MAX		0x3f
 #define INPUT_DEVICE_ID_MSC_MAX		0x07
 #define INPUT_DEVICE_ID_LED_MAX		0x0f
 #define INPUT_DEVICE_ID_SND_MAX		0x07
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index 76457ee..12c33f8 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -819,8 +819,24 @@ struct input_keymap_entry {
 
 #define ABS_VOLUME		0x20
 
+/* Drums and guitars (mostly toys) */
+#define ABS_TOM_FAR_LEFT	0x21
+#define ABS_TOM_LEFT		0x22
+#define ABS_TOM_RIGHT		0x23
+#define ABS_TOM_FAR_RIGHT	0x24
+#define ABS_CYMBAL_FAR_LEFT	0x25
+#define ABS_CYMBAL_LEFT		0x26
+#define ABS_CYMBAL_RIGHT	0x27
+
 #define ABS_MISC		0x28
 
+/* Drums and guitars continued */
+#define ABS_CYMBAL_FAR_RIGHT	0x29
+#define ABS_BASS		0x2a
+#define ABS_HI_HAT		0x2b
+#define ABS_FRET_BOARD		0x2c	/* Guitar fret board, vertical pos */
+#define ABS_WHAMMY_BAR		0x2d	/* Guitar whammy bar (or vibrato) */
+
 #define ABS_MT_SLOT		0x2f	/* MT slot being modified */
 #define ABS_MT_TOUCH_MAJOR	0x30	/* Major axis of touching ellipse */
 #define ABS_MT_TOUCH_MINOR	0x31	/* Minor axis (omit if circular) */
@@ -837,21 +853,8 @@ struct input_keymap_entry {
 #define ABS_MT_TOOL_X		0x3c	/* Center X tool position */
 #define ABS_MT_TOOL_Y		0x3d	/* Center Y tool position */
 
-/* Drums and guitars (mostly toys) */
-#define ABS_TOM_FAR_LEFT	0x40
-#define ABS_TOM_LEFT		0x41
-#define ABS_TOM_RIGHT		0x42
-#define ABS_TOM_FAR_RIGHT	0x43
-#define ABS_CYMBAL_FAR_LEFT	0x44
-#define ABS_CYMBAL_LEFT		0x45
-#define ABS_CYMBAL_RIGHT	0x46
-#define ABS_CYMBAL_FAR_RIGHT	0x47
-#define ABS_BASS		0x48
-#define ABS_HI_HAT		0x49
-#define ABS_FRET_BOARD		0x4a	/* Guitar fret board, vertical pos */
-#define ABS_WHAMMY_BAR		0x4b	/* Guitar whammy bar (or vibrato) */
-
-#define ABS_MAX			0x4f
+/* EVIOCSABS() does not support ABS_MAX > 0x3f */
+#define ABS_MAX			0x3f
 #define ABS_CNT			(ABS_MAX+1)
 
 /*
-- 
1.8.4

