From b7189f6fbf2745dc61c76e32bffa32a2a45aaa5a Mon Sep 17 00:00:00 2001 From: Tim Zimmermann Date: Tue, 2 Apr 2024 20:04:30 +0200 Subject: [PATCH] input: Sync switch event codes with upstream linux * They are checked as of https://android.googlesource.com/platform/frameworks/native/+/9762ac9c1b813850379f55dfc2bd6698b8c96c64, values > upstream linux SW_MAX will now cause a system_server crash Change-Id: Ib26f230bfa663f78ec17fc91890679210558ad60 --- drivers/input/keyboard/certify_hall_ic.c | 6 +++--- include/linux/mod_devicetable.h | 2 +- include/uapi/linux/input-event-codes.h | 5 ++--- include/uapi/linux/input.h | 10 ---------- 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/input/keyboard/certify_hall_ic.c b/drivers/input/keyboard/certify_hall_ic.c index b9fa1ac3cab9..9b168d340c68 100755 --- a/drivers/input/keyboard/certify_hall_ic.c +++ b/drivers/input/keyboard/certify_hall_ic.c @@ -76,7 +76,7 @@ static void certify_cover_work(struct work_struct *work) if (first == second) { certify_cover = first; - input_report_switch(ddata->input, SW_CERTIFYHALL, certify_cover); + input_report_switch(ddata->input, SW_MACHINE_COVER, certify_cover); input_sync(ddata->input); #if defined(CONFIG_SUPPORT_HALL_ABNORMAL_TEST) /* send uevent for hall ic */ @@ -100,7 +100,7 @@ static void certify_cover_work(struct work_struct *work) certify_cover = first; input_report_switch(ddata->input, - SW_CERTIFYHALL, certify_cover); + SW_MACHINE_COVER, certify_cover); input_sync(ddata->input); } #endif @@ -237,7 +237,7 @@ static int certify_hall_probe(struct platform_device *pdev) input->dev.parent = &pdev->dev; input->evbit[0] |= BIT_MASK(EV_SW); - input_set_capability(input, EV_SW, SW_CERTIFYHALL); + input_set_capability(input, EV_SW, SW_MACHINE_COVER); input->open = certify_hall_open; input->close = certify_hall_close; diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 9af6bc4d8493..cfec5a782444 100755 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -293,7 +293,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 0x20 +#define INPUT_DEVICE_ID_SW_MAX 0x10 #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 aabb07da3447..8b59dafc1767 100755 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h @@ -824,9 +824,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_MACHINE_COVER 0x14 /* set = cover closed */ -#define SW_GLOVE 0x20 /* set = glove mode */ -#define SW_MAX 0x20 +#define SW_MACHINE_COVER 0x10 /* set = cover closed */ +#define SW_MAX 0x10 #define SW_CNT (SW_MAX+1) /* diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h index 6b3f40946ef8..98fd1219f081 100755 --- a/include/uapi/linux/input.h +++ b/include/uapi/linux/input.h @@ -329,16 +329,6 @@ struct input_mask { #define EVIOCSCLOCKID _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */ -/* - * Switch events - */ -#define SW_FLIP 0x15 /* set = flip cover open, close*/ -#define SW_CERTIFYHALL 0x1b /* set = certify_hall attach/detach */ -#define SW_SLIDINGUPHALL 0x1c /* set = sliding_up_hall attach/detach */ -#define SW_SLIDINGDOWNHALL 0x1d /* set = sliding_down_hall attach/detach */ -#define SW_DIGITALUPHALL 0x1e /* set = digital_up_hall attach/detach */ -#define SW_DIGITALDOWNHALL 0x1f /* set = digital_down_hall attach/detach */ - /* * IDs. */