summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-08-20 13:26:40 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-08-20 15:10:04 -0700
commit1be9e3cf0c491cddfb5985b6b3cc65581313f98f (patch)
treefbcc0a378becc677183a877c0fc504fd18075ee6
parentbf95ccf496d6674a83c44d559e3eef8729c69449 (diff)
sun_mouse: Check if streams module is already on the stack before pushing it
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r--src/sun_mouse.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/src/sun_mouse.c b/src/sun_mouse.c
index ac40e07..4b531b1 100644
--- a/src/sun_mouse.c
+++ b/src/sun_mouse.c
@@ -221,17 +221,22 @@ vuidPreInit(InputInfoPtr pInfo, const char *protocol, int flags)
pVuidMse->strmod = xf86SetStrOption(pInfo->options, "StreamsModule", NULL);
if (pVuidMse->strmod) {
- SYSCALL(i = ioctl(pInfo->fd, I_PUSH, pVuidMse->strmod));
- if (i < 0) {
- xf86Msg(X_ERROR,
- "%s: cannot push module '%s' onto mouse device: %s\n",
- pInfo->name, pVuidMse->strmod, strerror(errno));
- xf86CloseSerial(pInfo->fd);
- pInfo->fd = -1;
- xfree(pVuidMse->strmod);
- xfree(pVuidMse);
- xfree(pMse);
- return FALSE;
+ /* Check to see if module is already pushed */
+ SYSCALL(i = ioctl(pInfo->fd, I_FIND, pVuidMse->strmod));
+
+ if (i == 0) { /* Not already pushed */
+ SYSCALL(i = ioctl(pInfo->fd, I_PUSH, pVuidMse->strmod));
+ if (i < 0) {
+ xf86Msg(X_ERROR,
+ "%s: cannot push module '%s' onto mouse device: %s\n",
+ pInfo->name, pVuidMse->strmod, strerror(errno));
+ xf86CloseSerial(pInfo->fd);
+ pInfo->fd = -1;
+ xfree(pVuidMse->strmod);
+ xfree(pVuidMse);
+ xfree(pMse);
+ return FALSE;
+ }
}
}
@@ -531,15 +536,21 @@ vuidMouseProc(DeviceIntPtr pPointer, int what)
int fmt = VUID_FIRM_EVENT;
if (pVuidMse->strmod) {
- SYSCALL(i = ioctl(pInfo->fd, I_PUSH, pVuidMse->strmod));
- if (i < 0) {
- xf86Msg(X_WARNING,
- "%s: cannot push module '%s' onto mouse device: %s\n",
- pInfo->name, pVuidMse->strmod, strerror(errno));
- xfree(pVuidMse->strmod);
- pVuidMse->strmod = NULL;
+ /* Check to see if module is already pushed */
+ SYSCALL(i = ioctl(pInfo->fd, I_FIND, pVuidMse->strmod));
+
+ if (i == 0) { /* Not already pushed */
+ SYSCALL(i = ioctl(pInfo->fd, I_PUSH, pVuidMse->strmod));
+ if (i < 0) {
+ xf86Msg(X_WARNING, "%s: cannot push module '%s' "
+ "onto mouse device: %s\n", pInfo->name,
+ pVuidMse->strmod, strerror(errno));
+ xfree(pVuidMse->strmod);
+ pVuidMse->strmod = NULL;
+ }
}
}
+
SYSCALL(i = ioctl(pInfo->fd, VUIDSFORMAT, &fmt));
if (i < 0) {
xf86Msg(X_WARNING,