[RFC PATCH 1/2] Input: psmouse - work around EC buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: JJ Ding <dgdunix@xxxxxxxxx>

With some EC chips, when we resync due to bad packets, those bad bytes would
still remain in EC's buffer area. That makes us always get bad data back,
no matter what.

So shift packet for 1 byte when encounter bad packet, until we get rid of
those bytes.

Signed-off-by: JJ Ding <dgdunix@xxxxxxxxx>
---
 drivers/input/mouse/psmouse-base.c |    5 +++++
 drivers/input/mouse/psmouse.h      |    3 ++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 200be9c..b849cec 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -279,6 +279,11 @@ static int psmouse_handle_byte(struct psmouse *psmouse)
 		}
 		break;
 
+	case PSMOUSE_SHIFT_PACKET:
+		memmove(psmouse->packet, psmouse->packet + 1, psmouse->pktsize - 1);
+		psmouse->pktcnt--;
+		break;
+
 	case PSMOUSE_GOOD_DATA:
 		break;
 	}
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index 6a41709..1742c1b 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -33,7 +33,8 @@ enum psmouse_state {
 typedef enum {
 	PSMOUSE_BAD_DATA,
 	PSMOUSE_GOOD_DATA,
-	PSMOUSE_FULL_PACKET
+	PSMOUSE_FULL_PACKET,
+	PSMOUSE_SHIFT_PACKET
 } psmouse_ret_t;
 
 struct psmouse {
-- 
1.7.8

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux