build/patch/kernel/archive/sunxi-6.1/patches.megous/input-pinephone-keyboard-Allow-to-disable-Fn-layer-processing.patch

48 lines
1.6 KiB
Diff
Raw Normal View History

From b11a857cd0fb7953ac1ed61ca76591a81230e1df Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Sat, 29 Oct 2022 00:51:19 +0200
Subject: [PATCH 325/389] input: pinephone-keyboard: Allow to disable Fn layer
processing
Sometimes it's more flexible to handle Fn key as additional modifier
that can be configured from userspace.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/input/keyboard/pinephone-keyboard.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/input/keyboard/pinephone-keyboard.c b/drivers/input/keyboard/pinephone-keyboard.c
index 82879abcbe48..00e4921f49ad 100644
--- a/drivers/input/keyboard/pinephone-keyboard.c
+++ b/drivers/input/keyboard/pinephone-keyboard.c
@@ -19,6 +19,10 @@ static bool disable_input;
module_param(disable_input, bool, S_IRUGO);
MODULE_PARM_DESC(disable_input, "Disable the keyboard part of the driver");
+static bool disable_fn;
+module_param(disable_fn, bool, S_IRUGO);
+MODULE_PARM_DESC(disable_fn, "Disable the FN layer special handling");
+
#define DRV_NAME "pinephone-keyboard"
#define PPKB_CRC8_POLYNOMIAL 0x07
@@ -249,6 +253,14 @@ static void ppkb_update(struct i2c_client *client)
if (!(changed & mask))
continue;
+ if (disable_fn) {
+ /* The FN layer is a second set of rows. */
+ code = MATRIX_SCAN_CODE(row, col, row_shift);
+ input_event(ppkb->input, EV_MSC, MSC_SCAN, code);
+ input_report_key(ppkb->input, keymap[code], value);
+ continue;
+ }
+
/*
* Save off the FN key state when the key was pressed,
* and use that to determine the code during a release.
--
2.35.3