diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-08-19 18:56:05 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-08-19 18:56:05 -0700 |
commit | 158d33c15df60696946031a0319e2bd2ec8b9541 (patch) | |
tree | d62f33223034628a6aaf1ec37974143ea8df0ce8 | |
parent | 891d55e759ff6a30f62809081a11c3da20fc0551 (diff) | |
download | xorg-driver-xf86-input-keyboard-158d33c15df60696946031a0319e2bd2ec8b9541.tar.gz |
sun_kbd: 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_kbd.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/sun_kbd.c b/src/sun_kbd.c index f6d99f3..614835e 100644 --- a/src/sun_kbd.c +++ b/src/sun_kbd.c @@ -184,12 +184,18 @@ KbdOn(InputInfoPtr pInfo, int what) } if (priv->strmod) { - SYSCALL(i = ioctl(pInfo->fd, I_PUSH, priv->strmod)); - if (i < 0) { - xf86Msg(X_ERROR, - "%s: cannot push module '%s' onto keyboard device: %s\n", - pInfo->name, priv->strmod, strerror(errno)); + /* Check to see if module is already pushed */ + SYSCALL(i = ioctl(pInfo->fd, I_FIND, priv->strmod)); + + if (i == 0) { /* Not already pushed */ + SYSCALL(i = ioctl(pInfo->fd, I_PUSH, priv->strmod)); + if (i < 0) { + xf86Msg(X_ERROR, "%s: cannot push module '%s' onto " + "keyboard device: %s\n", + pInfo->name, priv->strmod, strerror(errno)); + } } + #ifdef HIDIOCKMSDIRECT if (strcmp(priv->strmod, "usbkbm") == 0) { io_get_direct = HIDIOCKMGDIRECT; |