6892799.patch revision 1351
# Copyright (c) 2009, 2013, 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.
--- a/src/mouse.c Wed Sep 26 13:43:27 2012
+++ b/src/mouse.c Wed Sep 26 13:45:30 2012
@@ -1727,13 +1727,14 @@
pInfo->name);
#endif
MouseInitProperties(device);
+ pInfo->fd = xf86OpenSerial(pInfo->options);
+ if (pInfo->fd == -1)
+ xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
+
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 {
+ if (pInfo->fd != -1) {
if (pMse->xisbscale)
pMse->buffer = XisbNew(pInfo->fd, pMse->xisbscale * 4);
else
@@ -1789,8 +1790,6 @@
XisbFree(pMse->buffer);
pMse->buffer = NULL;
}
- xf86CloseSerial(pInfo->fd);
- pInfo->fd = -1;
if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft)
{
RemoveBlockAndWakeupHandlers (MouseBlockHandler,
@@ -1801,6 +1800,10 @@
device->public.on = FALSE;
break;
case DEVICE_CLOSE:
+ if (pInfo->fd != -1) {
+ xf86CloseSerial(pInfo->fd);
+ pInfo->fd = -1;
+ }
free(pMse->mousePriv);
pMse->mousePriv = NULL;
break;