6846735 Unplugging USB mouse during suspend kills X11 nv_124a
authorAlan Coopersmith <Alan.Coopersmith@Sun.COM>
Wed, 16 Sep 2009 13:49:12 -0700
changeset 785 7f9533fe2590
parent 784 b5001053afaa
child 786 72a7af00a6e3
6846735 Unplugging USB mouse during suspend kills X11
open-src/driver/xf86-input-mouse/6846735.patch
open-src/driver/xf86-input-mouse/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/driver/xf86-input-mouse/6846735.patch	Wed Sep 16 13:49:12 2009 -0700
@@ -0,0 +1,67 @@
+From 622cf1834725c3348cfdc41c12e39b327011c836 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 12 Sep 2009 20:18:06 -0700
+Subject: [PATCH] Fix crashes due to MouseBlockHandler/MouseWakeupHandler with invalid devices
+
+Don't install the handlers if devices failed to open/initalize.
+Remove the handlers when disabling Emulate3Soft mode, since otherwise
+they'll be left around when device is closed & device structs are freed.
+
+Signed-off-by: Alan Coopersmith <[email protected]>
+---
+ src/mouse.c |   18 +++++++++++-------
+ 1 files changed, 11 insertions(+), 7 deletions(-)
+
+diff --git a/src/mouse.c b/src/mouse.c
+index 23dc726..8347be9 100644
+--- a/src/mouse.c
++++ b/src/mouse.c
+@@ -1691,6 +1691,11 @@ MouseProc(DeviceIntPtr device, int what)
+ 		    }
+ 		    xf86FlushInput(pInfo->fd);
+ 		    xf86AddEnabledDevice(pInfo);
++		    if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft) {
++			RegisterBlockAndWakeupHandlers (MouseBlockHandler,
++							MouseWakeupHandler,
++							(pointer) pInfo);
++		    }
+ 		}
+ 	    }
+ 	}
+@@ -1701,11 +1706,6 @@ MouseProc(DeviceIntPtr device, int what)
+ 	pMse->wheelButtonExpires = GetTimeInMillis ();
+ 	device->public.on = TRUE;
+ 	FlushButtons(pMse);
+-	if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft)
+-	{
+-	    RegisterBlockAndWakeupHandlers (MouseBlockHandler, MouseWakeupHandler,
+-					    (pointer) pInfo);
+-	}
+ 	break;
+ 	    
+     case DEVICE_OFF:
+@@ -1720,7 +1720,8 @@ MouseProc(DeviceIntPtr device, int what)
+ 	    pInfo->fd = -1;
+ 	    if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft)
+ 	    {
+-		RemoveBlockAndWakeupHandlers (MouseBlockHandler, MouseWakeupHandler,
++		RemoveBlockAndWakeupHandlers (MouseBlockHandler,
++					      MouseWakeupHandler,
+ 					      (pointer) pInfo);
+ 	    }
+ 	}
+@@ -1967,7 +1968,10 @@ Emulate3ButtonsSoft(InputInfoPtr pInfo)
+ 	buttonTimer(pInfo);
+ 
+     xf86Msg(X_INFO,"3rd Button detected: disabling emulate3Button\n");
+-    
++
++    RemoveBlockAndWakeupHandlers (MouseBlockHandler, MouseWakeupHandler,
++				  (pointer) pInfo);
++
+     return FALSE;
+ }
+ 
+-- 
+1.5.6.5
+
--- a/open-src/driver/xf86-input-mouse/Makefile	Wed Sep 16 13:06:25 2009 -0700
+++ b/open-src/driver/xf86-input-mouse/Makefile	Wed Sep 16 13:49:12 2009 -0700
@@ -3,7 +3,7 @@
 # xf86-input-mouse 1.x Makefile
 #
 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
-# Use subject to license terms.
+# Use is subject to license terms.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the
@@ -30,7 +30,7 @@
 # or other dealings in this Software without prior written authorization
 # of the copyright holder.
 #
-# @(#)Makefile	1.8	09/01/10
+# @(#)Makefile	1.9	09/09/16
 #
 
 # Package name used in tarballs
@@ -40,7 +40,7 @@
 MODULE_VERSION=1.4.0
 
 # Patches to apply to source after unpacking, in order
-SOURCE_PATCHES = 
+SOURCE_PATCHES = 6846735.patch,-p1
 
 # Man pages to apply Sun footer to & attributes to list
 SUNTOUCHED_MANPAGES=man/*.man