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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 13 Mar 2012 20:04:22 +0800
From:	Daniel Kurtz <djkurtz@...omium.org>
To:	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Joonyoung Shim <jy0922.shim@...sung.com>,
	Iiro Valkonen <iiro.valkonen@...el.com>,
	Henrik Rydberg <rydberg@...omail.se>,
	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:	Benson Leung <bleung@...omium.org>,
	Yufeng Shen <miletus@...omium.org>,
	Daniel Kurtz <djkurtz@...omium.org>
Subject: [PATCH 19/20] Input: atmel_mxt_ts - remove mxt_make_highchg and parse T6 report

This function attempts to make the CHG pin high by reading a bunch of
messages until the device is happy.  Instead of just blindly trying to
read a fixed number of messages, let's actually read and process them.

It turns out that the messages after boot or nvupdates are T6 reports,
containing a status, and the config memory checksum.  So, let's parse
them and dump a useful info message.

Signed-off-by: Daniel Kurtz <djkurtz@...omium.org>
---
 drivers/input/touchscreen/atmel_mxt_ts.c |   39 ++++++++++-------------------
 1 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index dafc030..c397a01 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -252,6 +252,7 @@ struct mxt_data {
 
 	/* Cached parameters from object table */
 	u16 T5_address;
+	u8 T6_reportid;
 	u8 T9_reportid_min;
 	u8 T9_reportid_max;
 	u16 T44_address;
@@ -591,8 +592,15 @@ static int mxt_proc_messages(struct mxt_data *data, u8 count)
 		mxt_dump_message(dev, msg);
 
 		if (msg->reportid >= data->T9_reportid_min &&
-		    msg->reportid <= data->T9_reportid_max)
+		    msg->reportid <= data->T9_reportid_max) {
 			mxt_input_touchevent(data, msg);
+		} else if (msg->reportid == data->T6_reportid) {
+			unsigned csum = msg->message[1] |
+					(msg->message[2] << 8) |
+					(msg->message[3] << 16);
+			dev_info(dev, "Status: %02x Config Checksum: %06x\n",
+				 msg->message[0], csum);
+		}
 	}
 
 	return 0;
@@ -657,28 +665,6 @@ static int mxt_check_reg_init(struct mxt_data *data)
 	return 0;
 }
 
-static int mxt_make_highchg(struct mxt_data *data)
-{
-	struct device *dev = &data->client->dev;
-	struct mxt_message message;
-	int count = 10;
-	int error;
-
-	/* Read dummy message to make high CHG pin */
-	do {
-		error = mxt_read_messages(data, 1, &message);
-		if (error)
-			return error;
-	} while (message.reportid != 0xff && --count);
-
-	if (!count) {
-		dev_err(dev, "CHG pin isn't cleared\n");
-		return -EBUSY;
-	}
-
-	return 0;
-}
-
 static void mxt_handle_pdata(struct mxt_data *data)
 {
 	const struct mxt_platform_data *pdata = data->pdata;
@@ -770,6 +756,9 @@ static int mxt_get_object_table(struct mxt_data *data)
 		case MXT_GEN_MESSAGE_T5:
 			data->T5_address = object->start_address;
 			break;
+		case MXT_GEN_COMMAND_T6:
+			data->T6_reportid = object->max_reportid;
+			break;
 		case MXT_TOUCH_MULTI_T9:
 			data->T9_reportid_max = object->max_reportid;
 			data->T9_reportid_min = data->T9_reportid_max -
@@ -1033,7 +1022,7 @@ static ssize_t mxt_update_fw_store(struct device *dev,
 
 	enable_irq(data->irq);
 
-	error = mxt_make_highchg(data);
+	error = mxt_handle_messages(data);
 	if (error)
 		return error;
 
@@ -1155,7 +1144,7 @@ static int __devinit mxt_probe(struct i2c_client *client,
 		goto err_free_object;
 	}
 
-	error = mxt_make_highchg(data);
+	error = mxt_handle_messages(data);
 	if (error)
 		goto err_free_irq;
 
-- 
1.7.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ