[alsa-devel] [PATCH 2/3] input: Add SW_UNSUPPORT_INSERT define
From: Banajit Goswami bgoswami@codeaurora.org
Some devices may not support specific type of input devices. For example, when a headset or extension cable with GND/MIC swap is plugged into a headset jack that does not support the headset/cable, it needs to be reported with a corresponding input event. Also, increase the max values for INPUT_DEVICE_ID_SW_MAX and SW_MAX, to accommodate future extension of the number of event.
Signed-off-by: Gopikrishnaiah Anandan agopik@codeaurora.org Signed-off-by: Banajit Goswami bgoswami@codeaurora.org --- include/linux/mod_devicetable.h | 2 +- include/uapi/linux/input-event-codes.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 448621c..7586099 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -299,7 +299,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 0x0f +#define INPUT_DEVICE_ID_SW_MAX 0x1f #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 85387c7..960fa86 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h @@ -808,7 +808,8 @@ #define SW_LINEIN_INSERT 0x0d /* set = inserted */ #define SW_MUTE_DEVICE 0x0e /* set = device disabled */ #define SW_PEN_INSERTED 0x0f /* set = pen inserted */ -#define SW_MAX 0x0f +#define SW_UNSUPPORT_INSERT 0x10 /* set = unsupported device inserted */ +#define SW_MAX 0x1f #define SW_CNT (SW_MAX+1)
/*
Hi Banajit,
On Fri, May 24, 2019 at 01:40:38PM -0700, bgoswami@codeaurora.org wrote:
From: Banajit Goswami bgoswami@codeaurora.org
Some devices may not support specific type of input devices. For example, when a headset or extension cable with GND/MIC swap is plugged into a headset jack that does not support the headset/cable, it needs to be reported with a corresponding input event. Also, increase the max values for INPUT_DEVICE_ID_SW_MAX and SW_MAX, to accommodate future extension of the number of event.
I do not think that adding this switch is a good idea as it will not allow you to easily extend the reporting and to convey to the user why something is not supported. I would look into alternate mechanism to signal when and why a headset/peripheral was rejected.
Thanks.
participants (2)
-
bgoswamiï¼ codeaurora.org
-
Dmitry Torokhov