zhang / rpms / kernel

Forked from rpms/kernel 5 years ago
Clone
e293be
centosplus patch
e293be
e293be
commit 03ae3a9caf4a59edd32b65c89c375a98ce3ea1ef                                                            
e293be
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>                                                        
e293be
Date:   Mon Jun 25 12:02:40 2018 -0700                                                                     
e293be
                                                                                                           
e293be
    Input: psmouse - fix button reporting for basic protocols                                              
e293be
                                                                                                           
e293be
    The commit ba667650c568 ("Input: psmouse - clean up code") was pretty                                  
e293be
    brain-dead and broke extra buttons reporting for variety of PS/2 mice:                                 
e293be
    Genius, Thinkmouse and Intellimouse Explorer. We need to actually inspect                              
e293be
    the data coming from the device when reporting events.                                                 
e293be
                                                                                                           
e293be
    Fixes: ba667650c568 ("Input: psmouse - clean up code")
e293be
    Reported-by: Jiri Slaby <jslaby@suse.cz>
e293be
    Cc: stable@vger.kernel.org
e293be
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
e293be
e293be
    Applied-by: Akemi Yagi <toracat@elrepo.org>
e293be
e293be
e293be
--- a/drivers/input/mouse/psmouse-base.c	2018-11-15 09:07:13.000000000 -0800
e293be
+++ b/drivers/input/mouse/psmouse-base.c	2018-12-11 17:03:45.350702424 -0800
e293be
@@ -175,8 +175,8 @@ psmouse_ret_t psmouse_process_byte(struc
e293be
 		case 0xC0:
e293be
 			input_report_rel(dev, REL_WHEEL,
e293be
 					 -sign_extend32(packet[3], 3));
e293be
-			input_report_key(dev, BTN_SIDE,  BIT(4));
e293be
-			input_report_key(dev, BTN_EXTRA, BIT(5));
e293be
+			input_report_key(dev, BTN_SIDE,  packet[3] & BIT(4));
e293be
+			input_report_key(dev, BTN_EXTRA, packet[3] & BIT(5));
e293be
 			break;
e293be
 		}
e293be
 		break;
e293be
@@ -186,13 +186,13 @@ psmouse_ret_t psmouse_process_byte(struc
e293be
 		input_report_rel(dev, REL_WHEEL, -(s8) packet[3]);
e293be
 
e293be
 		/* Extra buttons on Genius NewNet 3D */
e293be
-		input_report_key(dev, BTN_SIDE,  BIT(6));
e293be
-		input_report_key(dev, BTN_EXTRA, BIT(7));
e293be
+		input_report_key(dev, BTN_SIDE,  packet[0] & BIT(6));
e293be
+		input_report_key(dev, BTN_EXTRA, packet[0] & BIT(7));
e293be
 		break;
e293be
 
e293be
 	case PSMOUSE_THINKPS:
e293be
 		/* Extra button on ThinkingMouse */
e293be
-		input_report_key(dev, BTN_EXTRA, BIT(3));
e293be
+		input_report_key(dev, BTN_EXTRA, packet[0] & BIT(3));
e293be
 
e293be
 		/*
e293be
 		 * Without this bit of weirdness moving up gives wildly
e293be
@@ -206,7 +206,7 @@ psmouse_ret_t psmouse_process_byte(struc
e293be
 		 * Cortron PS2 Trackball reports SIDE button in the
e293be
 		 * 4th bit of the first byte.
e293be
 		 */
e293be
-		input_report_key(dev, BTN_SIDE, BIT(3));
e293be
+		input_report_key(dev, BTN_SIDE, packet[0] & BIT(3));
e293be
 		packet[0] |= BIT(3);
e293be
 		break;
e293be