Skip to contentSkip to conversation

input - input.h: Add a new switch event

PATCH In review Ping Cheng 3 participants 3 messages Oct 3, 2013 – Oct 4, 2013

Subsystems (2)
lore
Share & tools
lore

Ping Cheng

author
#0 lore raw

PATCH 1/1 input - input.h: Add a new switch event

One of Wacom's pen and touch capable models added a switch for users to turn on/off touch events. We need to report the state of this switch to userland. But, there is no existing switch event defined for this purpose. Luckily enough, there is a room for a new switch event.

---
 include/uapi/linux/input.h | 1 +
 1 file changed, 1 insertion(+)
include/uapi/linux/input.h +1 -0
index d08abf9..d4097b0 100644
@@ -855,6 +855,7 @@ struct input_keymap_entry {
 #define SW_FRONT_PROXIMITY	0x0b  /* set = front proximity sensor active */
 #define SW_ROTATE_LOCK		0x0c  /* set = rotate locked/disabled */
 #define SW_LINEIN_INSERT	0x0d  /* set = inserted */
+#define SW_TOUCH_ENABLED	0x0e  /* set = touch switch turned on (touch events off) */
 #define SW_MAX			0x0f
 #define SW_CNT			(SW_MAX+1)
 
Signature · 1 line
1.8.1.2
Acked-by on v1 1/1
#1 lore raw
Quoted 25 lines · Ping Cheng

One of Wacom's pen and touch capable models added a switch for users to turn on/off touch events. We need to report the state of this switch to userland. But, there is no existing switch event defined for this purpose. Luckily enough, there is a room for a new switch event.

---
 include/uapi/linux/input.h | 1 +
 1 file changed, 1 insertion(+)
include/uapi/linux/input.h +1 -0
index d08abf9..d4097b0 100644
@@ -855,6 +855,7 @@ struct input_keymap_entry {
 #define SW_FRONT_PROXIMITY	0x0b  /* set = front proximity sensor active */
 #define SW_ROTATE_LOCK		0x0c  /* set = rotate locked/disabled */
 #define SW_LINEIN_INSERT	0x0d  /* set = inserted */
+#define SW_TOUCH_ENABLED	0x0e  /* set = touch switch turned on (touch events off) */
 #define SW_MAX			0x0f
 #define SW_CNT			(SW_MAX+1)
 
Signature · 1 line
1.8.1.2

though I think SW_TOUCH would be enough, given that the switch already communicates on/off.

Cheers,
Peter

#2 lore raw
In reply to Ping Cheng
Quoted 5 lines · Ping Cheng

One of Wacom's pen and touch capable models added a switch for users to turn on/off touch events. We need to report the state of this switch to userland. But, there is no existing switch event defined for this purpose. Luckily enough, there is a room for a new switch event.

It is a switch so hard to argue against adding it this way... but I also want to point out existing feature to consider.

Touchpads on several laptops have either a single touchpad toggle button or a touchpad switch that serve same basic purpose. Most of these switches are hooked up as keys and controlled by platform/x86 driver or udev.

Most platform/x86 drivers map these "keys" to KEY_TOUCHPAD_TOGGLE, KEY_TOUCHPAD_ON, and KEY_TOUCHPAD_OFF. Since those don't make it to X, most udev keymaps instead use f21, f22, and f23 for same purpose.

As long as this is a touch+tablet that looks like a touchpad then using those keys will cause gnome-settings-daemon to give a nice OSD touchpad status when switch is moved and will also enable/disable the touchpad using "Device Enabled" X property.

On the down side, I think these keys are treated as system wide disable of all touchpads. Having a Switch reported against the device its controlling (as apposed to above which is reported over different input then touchpad) would allow user land an easy way to know to only disable the single device.

Chris

Quoted 25 lines
---
 include/uapi/linux/input.h | 1 +
 1 file changed, 1 insertion(+)
include/uapi/linux/input.h +1 -1
index d08abf9..d4097b0 100644
@@ -855,6 +855,7 @@ struct input_keymap_entry {
 #define SW_FRONT_PROXIMITY     0x0b  /* set = front proximity sensor active */
 #define SW_ROTATE_LOCK         0x0c  /* set = rotate locked/disabled */
 #define SW_LINEIN_INSERT       0x0d  /* set = inserted */
+#define SW_TOUCH_ENABLED       0x0e  /* set = touch switch turned on (touch events off) */
 #define SW_MAX                 0x0f
 #define SW_CNT                 (SW_MAX+1)
 
--

1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html