[PATCH] Input: add SW_COVER_ATTACHED and SW_EXT_PEN_ATTACHED

From: Jungrae Kim
Date: Fri Oct 30 2020 - 08:23:12 EST


SW_COVER_ATTACHED represents the connected state of a removable cover
of a device. Value 0 means cover was attached with device, value 1 means
removed it.
SW_EXT_PEN_ATTACHED represents the state of the pen.
Some device have internal pen slot. but other some device have external pen
slot. These two cases has different use case in userspace. So need to
separate a event. Value 0 means pen was detach on external pen slot on
device, value 1 means pen was attached external pen slot on device.

Signed-off-by: Jungrae Kim <jryu.kim@xxxxxxxxxxx>
---
include/linux/mod_devicetable.h | 2 +-
include/uapi/linux/input-event-codes.h | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 5b08a473cdba..897f5a3e7721 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -320,7 +320,7 @@ struct pcmcia_device_id {
#define INPUT_DEVICE_ID_LED_MAX 0x0f
#define INPUT_DEVICE_ID_SND_MAX 0x07
#define INPUT_DEVICE_ID_FF_MAX 0x7f
-#define INPUT_DEVICE_ID_SW_MAX 0x10
+#define INPUT_DEVICE_ID_SW_MAX 0x12
#define INPUT_DEVICE_ID_PROP_MAX 0x1f

#define INPUT_DEVICE_ID_MATCH_BUS 1
diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
index ee93428ced9a..a0506369de6d 100644
--- a/include/uapi/linux/input-event-codes.h
+++ b/include/uapi/linux/input-event-codes.h
@@ -893,7 +893,9 @@
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
#define SW_PEN_INSERTED 0x0f /* set = pen inserted */
#define SW_MACHINE_COVER 0x10 /* set = cover closed */
-#define SW_MAX 0x10
+#define SW_COVER_ATTACHED 0x11 /* set = cover attached */
+#define SW_EXT_PEN_ATTACHED 0x12 /* set = external pen attached */
+#define SW_MAX 0x12
#define SW_CNT (SW_MAX+1)

/*
--
2.17.1