lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <b372a99d01c14d1690afba4ceedd0936@ilitek.com>
Date: Mon, 14 Jul 2025 09:51:42 +0000
From: Joe Hung (洪銘陽) <joe_hung@...tek.com>
To: "dmitry.torokhov@...il.com" <dmitry.torokhov@...il.com>,
	"francesco.dolcini@...adex.com" <francesco.dolcini@...adex.com>,
	"emanuele.ghidoli@...adex.com" <emanuele.ghidoli@...adex.com>
CC: linux-input <linux-input@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, Luca Hsu (徐嘉鍊)
	<luca_hsu@...tek.com>, Joe Hung (洪銘陽)
	<joe_hung@...tek.com>
Subject: [PATCH] input: ilitek_ts_i2c: report key event for palm

From ec0d80214fee6acc0b38f33ad0b6b487098963bc Mon Sep 17 00:00:00 2001
From: Joe Hong <joe_hung@...tek.com>
Date: Mon, 14 Jul 2025 17:20:11 +0800
Subject: [PATCH] input: ilitek_ts_i2c: report key event for palm

Add support for reporting user-defined key event while getting palm event.

Signed-off-by: Joe Hong <joe_hung@...tek.com>
---
 drivers/input/touchscreen/ilitek_ts_i2c.c | 42 +++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/drivers/input/touchscreen/ilitek_ts_i2c.c b/drivers/input/touchscreen/ilitek_ts_i2c.c
index 0dd632724a00..fdcb4ab66fbb 100644
--- a/drivers/input/touchscreen/ilitek_ts_i2c.c
+++ b/drivers/input/touchscreen/ilitek_ts_i2c.c
@@ -39,8 +39,13 @@
 #define ILITEK_TP_I2C_REPORT_ID				0x48
 
 #define REPORT_COUNT_ADDRESS				61
+#define ALGO_MODE_ADDRESS				62
 #define ILITEK_SUPPORT_MAX_POINT			40
 
+static uint palm_key;
+module_param(palm_key, uint, 0664);
+MODULE_PARM_DESC(palm_key, "Set palm key code when palm is detected");
+
 struct ilitek_protocol_info {
 	u16 ver;
 	u8 ver_major;
@@ -176,6 +181,11 @@ static int ilitek_process_and_report_v6(struct ilitek_ts_data *ts)
 		return -EINVAL;
 	}
 
+	if (palm_key) {
+		input_report_key(ts->input_dev, palm_key,
+				 (buf[ALGO_MODE_ADDRESS] & 0x80) ? 1 : 0);
+	}
+
 	count = DIV_ROUND_UP(report_max_point, packet_max_point);
 	for (i = 1; i < count; i++) {
 		error = ilitek_i2c_write_and_read(ts, NULL, 0, 0,
@@ -472,6 +482,9 @@ static int ilitek_input_dev_init(struct device *dev, struct ilitek_ts_data *ts)
 	input->name = ILITEK_TS_NAME;
 	input->id.bustype = BUS_I2C;
 
+	if (palm_key)
+		__set_bit(palm_key, input->keybit);
+
 	__set_bit(INPUT_PROP_DIRECT, input->propbit);
 
 	input_set_abs_params(input, ABS_MT_POSITION_X,
@@ -537,9 +550,38 @@ static ssize_t product_id_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(product_id);
 
+static ssize_t palm_key_show(struct device *dev,
+			     struct device_attribute *attr, char *buf)
+{
+	return sysfs_emit(buf, "palm key: [%u]\n", palm_key);
+}
+
+static ssize_t palm_key_store(struct device *dev, struct device_attribute *attr,
+			      const char *buf, size_t count)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct ilitek_ts_data *ts = i2c_get_clientdata(client);
+
+	unsigned long tmp;
+
+	if (kstrtoul(buf, 10, &tmp) || tmp > KEY_MAX)
+		return -EINVAL;
+
+	if (palm_key)
+		__clear_bit(palm_key, ts->input_dev->keybit);
+
+	__set_bit(tmp, ts->input_dev->keybit);
+	palm_key = tmp;
+
+	return count;
+}
+
+static DEVICE_ATTR_RW(palm_key);
+
 static struct attribute *ilitek_sysfs_attrs[] = {
 	&dev_attr_firmware_version.attr,
 	&dev_attr_product_id.attr,
+	&dev_attr_palm_key.attr,
 	NULL
 };
 ATTRIBUTE_GROUPS(ilitek_sysfs);
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ