ignatenkobrain / rpms / kernel

Forked from rpms/kernel 3 years ago
Clone
Blob Blame History Raw
centosplus patch

commit 03ae3a9caf4a59edd32b65c89c375a98ce3ea1ef                                                            
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>                                                        
Date:   Mon Jun 25 12:02:40 2018 -0700                                                                     
                                                                                                           
    Input: psmouse - fix button reporting for basic protocols                                              
                                                                                                           
    The commit ba667650c568 ("Input: psmouse - clean up code") was pretty                                  
    brain-dead and broke extra buttons reporting for variety of PS/2 mice:                                 
    Genius, Thinkmouse and Intellimouse Explorer. We need to actually inspect                              
    the data coming from the device when reporting events.                                                 
                                                                                                           
    Fixes: ba667650c568 ("Input: psmouse - clean up code")
    Reported-by: Jiri Slaby <jslaby@suse.cz>
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

    Applied-by: Akemi Yagi <toracat@elrepo.org>


--- a/drivers/input/mouse/psmouse-base.c	2018-11-15 09:07:13.000000000 -0800
+++ b/drivers/input/mouse/psmouse-base.c	2018-12-11 17:03:45.350702424 -0800
@@ -175,8 +175,8 @@ psmouse_ret_t psmouse_process_byte(struc
 		case 0xC0:
 			input_report_rel(dev, REL_WHEEL,
 					 -sign_extend32(packet[3], 3));
-			input_report_key(dev, BTN_SIDE,  BIT(4));
-			input_report_key(dev, BTN_EXTRA, BIT(5));
+			input_report_key(dev, BTN_SIDE,  packet[3] & BIT(4));
+			input_report_key(dev, BTN_EXTRA, packet[3] & BIT(5));
 			break;
 		}
 		break;
@@ -186,13 +186,13 @@ psmouse_ret_t psmouse_process_byte(struc
 		input_report_rel(dev, REL_WHEEL, -(s8) packet[3]);
 
 		/* Extra buttons on Genius NewNet 3D */
-		input_report_key(dev, BTN_SIDE,  BIT(6));
-		input_report_key(dev, BTN_EXTRA, BIT(7));
+		input_report_key(dev, BTN_SIDE,  packet[0] & BIT(6));
+		input_report_key(dev, BTN_EXTRA, packet[0] & BIT(7));
 		break;
 
 	case PSMOUSE_THINKPS:
 		/* Extra button on ThinkingMouse */
-		input_report_key(dev, BTN_EXTRA, BIT(3));
+		input_report_key(dev, BTN_EXTRA, packet[0] & BIT(3));
 
 		/*
 		 * Without this bit of weirdness moving up gives wildly
@@ -206,7 +206,7 @@ psmouse_ret_t psmouse_process_byte(struc
 		 * Cortron PS2 Trackball reports SIDE button in the
 		 * 4th bit of the first byte.
 		 */
-		input_report_key(dev, BTN_SIDE, BIT(3));
+		input_report_key(dev, BTN_SIDE, packet[0] & BIT(3));
 		packet[0] |= BIT(3);
 		break;