summaryrefslogtreecommitdiff
path: root/src/backend_joystick.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend_joystick.c')
-rw-r--r--src/backend_joystick.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/backend_joystick.c b/src/backend_joystick.c
index d335bc2..172ce50 100644
--- a/src/backend_joystick.c
+++ b/src/backend_joystick.c
@@ -72,10 +72,12 @@ jstkOpenDevice_joystick(JoystickDevPtr joystick, Bool probe)
unsigned char axes, buttons;
int driver_version;
- 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, JSIOCGVERSION, &driver_version) == -1) {