input: Add SW_UNSUPPORT_INSERT define
Subsystems (2)
PATCH 2/3 input: Add SW_UNSUPPORT_INSERT define
From: Banajit Goswami <[email protected]>
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.
--- include/linux/mod_devicetable.h | 2 +- include/uapi/linux/input-event-codes.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
include/linux/mod_devicetable.h +1 -1
@@ -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
include/uapi/linux/input-event-codes.h +2 -1
@@ -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)/*
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Dmitry Torokhov
maintainerHi Banajit,
Quoted 8 lines · On Fri, May 24, 2019 at 01:40:38PM -0700, [email protected] wrote:
From: Banajit Goswami <[email protected]>
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_MAXandSW_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.
Signature · 1 line
Dmitry