open-src/driver/xf86-input-mouse/6892799.patch
author Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
Thu, 16 Dec 2010 17:09:59 -0800
changeset 1054 1c1ff42df15b
parent 943 294f64612d23
child 1124 7bc7e624f965
permissions -rw-r--r--
7006573 X11R7.6 Update: Driver modules (except intel)

# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

diff -Nurp -x '*~' -x '*.orig' src/mouse.c src/mouse.c
--- src/mouse.c	2010-08-14 01:04:54.000000000 -0700
+++ src/mouse.c	2010-09-09 11:31:51.072960718 -0700
@@ -1637,13 +1637,14 @@ MouseProc(DeviceIntPtr device, int what)
 	ErrorF("assigning %p atom=%d name=%s\n", device, pInfo->atom,
 		pInfo->name);
 #endif
-	break;
-
-    case DEVICE_ON:
 	pInfo->fd = xf86OpenSerial(pInfo->options);
 	if (pInfo->fd == -1)
 	    xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
-	else {
+
+	break;
+
+    case DEVICE_ON:
+	if (pInfo->fd != -1) {
 	    if (pMse->xisbscale)
 		pMse->buffer = XisbNew(pInfo->fd, pMse->xisbscale * 4);
 	    else
@@ -1699,8 +1700,6 @@ MouseProc(DeviceIntPtr device, int what)
 		XisbFree(pMse->buffer);
 		pMse->buffer = NULL;
 	    }
-	    xf86CloseSerial(pInfo->fd);
-	    pInfo->fd = -1;
 	    if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft)
 	    {
 		RemoveBlockAndWakeupHandlers (MouseBlockHandler,
@@ -1711,6 +1710,10 @@ MouseProc(DeviceIntPtr device, int what)
 	device->public.on = FALSE;
 	break;
     case DEVICE_CLOSE:
+ 	if (pInfo->fd != -1) {
+	    xf86CloseSerial(pInfo->fd);
+	    pInfo->fd = -1;
+	}
 	xfree(pMse->mousePriv);
 	pMse->mousePriv = NULL;
 	break;