Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=867d2682e92a3999e3862f1679cfcb549142d776
Commit:     867d2682e92a3999e3862f1679cfcb549142d776
Parent:     54f9e36cb83e7da17dc0596d365fe019a25c226f
Author:     Peter Osterlund <[EMAIL PROTECTED]>
AuthorDate: Fri Mar 16 00:58:37 2007 -0400
Committer:  Dmitry Torokhov <[EMAIL PROTECTED]>
CommitDate: Fri Mar 16 00:58:37 2007 -0400

    Input: sermouse - improve protocol error recovery
    
    When using MS protocol the driver should wait for a byte with
    bit 6 set before assuming that it sees beginning of a data packet.
    This should allow driver better cope with lost bytes and prevent
    spurious left/right button events when serial communication is
    disturbed by a CPU-hungry real-time process.
    
    Also fix some formatting.
    
    Signed-off-by: Peter Osterlund <[EMAIL PROTECTED]>
    Signed-off-by: Dmitry Torokhov <[EMAIL PROTECTED]>
---
 drivers/input/mouse/sermouse.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c
index a85d747..0ac448a 100644
--- a/drivers/input/mouse/sermouse.c
+++ b/drivers/input/mouse/sermouse.c
@@ -69,7 +69,8 @@ static void sermouse_process_msc(struct sermouse *sermouse, 
signed char data)
        switch (sermouse->count) {
 
                case 0:
-                       if ((data & 0xf8) != 0x80) return;
+                       if ((data & 0xf8) != 0x80)
+                               return;
                        input_report_key(dev, BTN_LEFT,   !(data & 4));
                        input_report_key(dev, BTN_RIGHT,  !(data & 1));
                        input_report_key(dev, BTN_MIDDLE, !(data & 2));
@@ -107,7 +108,10 @@ static void sermouse_process_ms(struct sermouse *sermouse, 
signed char data)
        struct input_dev *dev = sermouse->dev;
        signed char *buf = sermouse->buf;
 
-       if (data & 0x40) sermouse->count = 0;
+       if (data & 0x40)
+               sermouse->count = 0;
+       else if (sermouse->count == 0)
+               return;
 
        switch (sermouse->count) {
 
@@ -169,7 +173,8 @@ static void sermouse_process_ms(struct sermouse *sermouse, 
signed char data)
 
                case 5:
                case 7: /* Ignore anything besides MZ++ */
-                       if (sermouse->type != SERIO_MZPP) break;
+                       if (sermouse->type != SERIO_MZPP)
+                               break;
 
                        switch (buf[1]) {
 
@@ -206,13 +211,16 @@ static irqreturn_t sermouse_interrupt(struct serio *serio,
 {
        struct sermouse *sermouse = serio_get_drvdata(serio);
 
-       if (time_after(jiffies, sermouse->last + HZ/10)) sermouse->count = 0;
+       if (time_after(jiffies, sermouse->last + HZ/10))
+               sermouse->count = 0;
+
        sermouse->last = jiffies;
 
        if (sermouse->type > SERIO_SUN)
                sermouse_process_ms(sermouse, data);
        else
                sermouse_process_msc(sermouse, data);
+
        return IRQ_HANDLED;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to