Mercurial > sdl-ios-xcode
comparison src/joystick/linux/SDL_sysjoystick.c @ 896:b56dc586a5ef
Date: Tue, 16 Mar 2004 12:40:33 +0000
From: Alan Swanson
Subject: [SDL] [PATCH] Linux joystick evdev axis count fix
The event device configuration under Linux does not check the returned
ioctl value when reading the axis information. This means extra
undefined axes are returned.
Note, in EV_HandleEvents, the default for case EV_ABS is to return any
axis information which is fine as we have already checked for all valid
absolute axes. No new axes should be returned after opening the device.
(Unless, of course, the evdev allows closing and reassigning a new
device while in use and I can't believe that happens.)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 16 May 2004 22:48:06 +0000 |
parents | dc29e5907694 |
children | bbf8dcc8aed6 |
comparison
equal
deleted
inserted
replaced
895:ec659230eaac | 896:b56dc586a5ef |
---|---|
592 continue; | 592 continue; |
593 } | 593 } |
594 if ( test_bit(i, absbit) ) { | 594 if ( test_bit(i, absbit) ) { |
595 int values[5]; | 595 int values[5]; |
596 | 596 |
597 ioctl(fd, EVIOCGABS(i), values); | 597 if ( ioctl(fd, EVIOCGABS(i), values) < 0 ) |
598 continue; | |
598 #ifdef DEBUG_INPUT_EVENTS | 599 #ifdef DEBUG_INPUT_EVENTS |
599 printf("Joystick has absolute axis: %x\n", i); | 600 printf("Joystick has absolute axis: %x\n", i); |
600 printf("Values = { %d, %d, %d, %d, %d }\n", | 601 printf("Values = { %d, %d, %d, %d, %d }\n", |
601 values[0], values[1], | 602 values[0], values[1], |
602 values[2], values[3], values[4]); | 603 values[2], values[3], values[4]); |