summaryrefslogtreecommitdiff
path: root/src/backend_bsd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend_bsd.c')
-rw-r--r--src/backend_bsd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/backend_bsd.c b/src/backend_bsd.c
index f3f501e..d8c6bac 100644
--- a/src/backend_bsd.c
+++ b/src/backend_bsd.c
@@ -91,10 +91,12 @@ jstkOpenDevice_bsd(JoystickDevPtr joystick, Bool probe)
report_desc_t rd;
struct jstk_bsd_hid_data *bsddata;
- if ((joystick->fd = open(joystick->device, O_RDWR | 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_RDWR | O_NDELAY, 0)) < 0) {
+ xf86Msg(X_ERROR, "Cannot open joystick '%s' (%s)\n",
+ joystick->device, strerror(errno));
+ return -1;
+ }
}
if ((rd = hid_get_report_desc(joystick->fd)) == 0) {