summaryrefslogtreecommitdiff
path: root/src/backend_evdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend_evdev.c')
-rw-r--r--src/backend_evdev.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/backend_evdev.c b/src/backend_evdev.c
index 2a7b0e2..cae4b28 100644
--- a/src/backend_evdev.c
+++ b/src/backend_evdev.c
@@ -90,10 +90,12 @@ jstkOpenDevice_evdev(JoystickDevPtr joystick, Bool probe)
unsigned long key_bits[NBITS(KEY_MAX)];
int axes, buttons, j;
- if ((joystick->fd = open(joystick->device, O_RDONLY | O_NDELAY, 0)) < 0) {
- xf86Msg(X_ERROR, "Cannot open joystick '%s' (%s)\n",
- joystick->device, strerror(errno));
- return -1;
+ if (joystick->fd == -1) {
+ if ((joystick->fd = open(joystick->device, O_RDONLY | O_NDELAY, 0)) < 0) {
+ xf86Msg(X_ERROR, "Cannot open joystick '%s' (%s)\n",
+ joystick->device, strerror(errno));
+ return -1;
+ }
}
if (ioctl(joystick->fd, EVIOCGVERSION, &driver_version) == -1) {