armbian_build/patch/kernel/archive/sunxi-6.6/patches.megous/input-pinephone-keyboard-Allow-to-disable-Fn-layer-processing.patch
The-going 25b0741531 sunxi-6.6: megous patches: revert commit changes e103e2e1da
Undo changes that are made massively and create a lot of noise.
e103e2e1da
2025-01-19 20:22:11 +01:00

47 lines
1.6 KiB
Diff

From 9a64311ad956beb150ad8ad1cd80167e6fe8a478 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Sat, 29 Oct 2022 00:51:19 +0200
Subject: 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 365037d8609d..f758c1eabe40 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