linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: cros-ec: copy the whole event when msg->version is 0
@ 2018-09-27  9:24 Emil Karlson
  2018-09-27  9:30 ` Emil Karlson
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Emil Karlson @ 2018-09-27  9:24 UTC (permalink / raw)
  To: Emil Renner Berthing, Neil Armstrong, Stefan Adolfsson, linux-kernel
  Cc: Emil Karlson

Commit 57e94c8b974db2d83c60e1139c89a70806abbea0 caused cros-ec keyboard events
be truncated on many chromebooks so that Left and Right keys on Column 12 were
always 0. This commit fixes the issue by restoring the old semantics when the
protocol version is 0.
---
 drivers/platform/chrome/cros_ec_proto.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index 398393ab5df8..457e4940dba4 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -519,8 +519,14 @@ static int get_next_event_xfer(struct cros_ec_device *ec_dev,
 
 	ret = cros_ec_cmd_xfer(ec_dev, msg);
 	if (ret > 0) {
+		unsigned int copy_size;
+
 		ec_dev->event_size = ret - 1;
-		memcpy(&ec_dev->event_data, msg->data, ec_dev->event_size);
+		if (!version)
+			copy_size = sizeof(struct ec_response_get_next_event);
+		else
+			copy_size = ec_dev->event_size;
+		memcpy(&ec_dev->event_data, msg->data, copy_size);
 	}
 
 	return ret;
-- 
2.19.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-10-10  5:06 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-27  9:24 [PATCH] mfd: cros-ec: copy the whole event when msg->version is 0 Emil Karlson
2018-09-27  9:30 ` Emil Karlson
2018-09-28 12:15 ` Neil Armstrong
2018-09-28 17:08   ` [PATCH] mfd: cros-ec: copy the whole event in get_next_event_xfer Emil Karlson
2018-09-28 17:16     ` Emil Karlson
2018-10-03 11:01     ` Enric Balletbo i Serra
2018-10-03 13:41       ` Neil Armstrong
2018-10-03 18:43         ` [PATCH v3] " Emil Karlson
2018-10-10  5:06           ` Benson Leung
2018-10-10  3:44       ` [PATCH] " Benson Leung
2018-09-28 20:27   ` [PATCH] mfd: cros-ec: copy the whole event when msg->version is 0 Emil Renner Berthing
2018-10-09 10:13 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).