From 66fa2685f021ca1fc482f46f60bca49b69527f37 Mon Sep 17 00:00:00 2001 From: David Hendricks Date: Fri, 20 Apr 2012 13:37:05 -0700 Subject: [PATCH] fix array indexing bug in message_process_cmd Source buffer was not being incremented properly, so the destination buffer containing message payload was always msg[0]. BUG=none TEST=tested on daisy (now keyboard protocol actually shows keys...) Signed-off-by: David Hendricks Change-Id: If5a417291c9bff36bbeb2a87153de80300045257 --- common/message.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/message.c b/common/message.c index 44fea62648..94474253be 100644 --- a/common/message.c +++ b/common/message.c @@ -83,8 +83,8 @@ int message_process_cmd(int cmd, uint8_t *out_msg, int max_len) for (i = 0; i < msg_len; i++) { if (need_copy) - out_msg[i + 3] = *msg; - sum += *msg; + out_msg[i + 3] = msg[i]; + sum += msg[i]; } out_msg[i + 3] = sum & 0xff; out_msg[i + 4] = MSG_PREAMBLE;