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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <000d01d5abde$8532b540$8f981fc0$@emc.com.tw>
Date:   Fri, 6 Dec 2019 10:40:28 +0800
From:   "Dave.Wang" <dave.wang@....com.tw>
To:     <Linux-kernel@...r.kernel.org>, <Linux-input@...r.kernel.org>,
        "'Benjamin Tissoires'" <benjamin.tissoires@...hat.com>,
        <Dmitry.torokhov@...il.com>
Cc:     "'Josh.Chen'" <josh.chen@....com.tw>, <jingle.wu@....com.tw>,
        "'phoenix'" <phoenix@....com.tw>
Subject: [PATCH 5/6] Input: elantech - Transfer the device information from PS/2 to SMBus

Many commands in SMBus interface cannot be triggered. In order to
get the correct device information, transfer the device information
from PS/2 to SMBus interface for PS/2+SMbus protocol.

Signed-off-by: Dave Wang <dave.wang@....com.tw>
---
 drivers/input/mouse/elantech.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 53d7ff719d76..0392b668cd39 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1889,12 +1889,28 @@ static int elantech_create_smbus(struct psmouse
*psmouse,
 				 struct elantech_device_info *info,
 				 bool leave_breadcrumbs)
 {
-	struct property_entry i2c_props[11] = {};
+	struct property_entry i2c_props[19] = {};
 	struct i2c_board_info smbus_board = {
 		I2C_BOARD_INFO("elan_i2c", 0x15),
 		.flags = I2C_CLIENT_HOST_NOTIFY,
 	};
 	unsigned int idx = 0;
+	u16 product_id, ic_type;
+	u8 sm_version, fw_version, iap_version;
+
+	if (info->pattern > 0) {
+		product_id = get_unaligned_be16(info->samples);
+		sm_version = info->bus;
+		ic_type = get_unaligned_be16(info->ic_body);
+		fw_version = info->ic_body[2];
+		iap_version = info->iap_version[2];
+	} else {
+		product_id = info->samples[1];
+		sm_version = info->samples[0];
+		ic_type = (info->fw_version & 0x0f0000) >> 16;
+		fw_version = info->fw_version & 0x0000ff;
+		iap_version = 0x00;
+	}
 
 	smbus_board.properties = i2c_props;
 
@@ -1906,6 +1922,22 @@ static int elantech_create_smbus(struct psmouse
*psmouse,
 						   info->x_min);
 	i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-min-y",
 						   info->y_min);
+	i2c_props[idx++] = PROPERTY_ENTRY_U16("elan,product_id",
+							product_id);
+	i2c_props[idx++] = PROPERTY_ENTRY_U8("elan,sm_version",
+							sm_version);
+	i2c_props[idx++] = PROPERTY_ENTRY_U16("elan,ic_type",
+							ic_type);
+	i2c_props[idx++] = PROPERTY_ENTRY_U8("elan,fw_version",
+							fw_version);
+	i2c_props[idx++] = PROPERTY_ENTRY_U16("elan,fw_checksum",
+			info->fw_checksum[0] << 8 | info->fw_checksum[1]);
+	i2c_props[idx++] = PROPERTY_ENTRY_U16("elan,iap_checksum",
+			info->iap_checksum[0] << 8 | info->iap_checksum[1]);
+	i2c_props[idx++] = PROPERTY_ENTRY_U8("elan,iap_version",
+							iap_version);
+	i2c_props[idx++] = PROPERTY_ENTRY_U8("elan,pattern",
+							info->pattern);
 	if (info->x_res)
 		i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-x-mm",
 						      (info->x_max + 1) /
info->x_res);
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ