[AD] Linux joystick driver button limitation

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


I have a USB SideWinder GamePad Pro and allegro
has always ignored the 9th button, so i took
a look at ljoy.c and changed the 'if(num_buttons > 8)...'
to 'if(num_buttons > 9)...', and also the line
in joy_poll so now I have a working 9th button
and want to know if this change would affect
other joysticks? (i.e.: gameport joysticks)

If no one has a problem with this change, I've
included a small diff file which should be applied
in the src/linux directory.

-- 
Tom Fjellstrom
tfjellstrom@xxxxxxxxxx
http://strangesoft.net/
--- ljoy.old	Tue Feb 20 11:37:13 2001
+++ ljoy.c	Tue Feb 20 11:42:24 2001
@@ -59,7 +59,7 @@
 		ioctl (joy_fd[i], JSIOCGBUTTONS, &num_buttons);
 
 		if (num_axes > 8) num_axes = 8;
-		if (num_buttons > 8) num_buttons = 8;
+		if (num_buttons > 9) num_buttons = 9;
 
 		/* User is allow to override our simple assumption of which
 		 * axis number (kernel) the throttle is located at. */
@@ -148,7 +148,7 @@
 		if (ready <= 0) continue;
 		read (joy_fd[i], &e, sizeof e);
 		if (e.type & JS_EVENT_BUTTON) {
-			if (e.number < 8)
+			if (e.number < 9)
 				joy[i].button[e.number].b = e.value;
 		} else if (e.type & JS_EVENT_AXIS) {
 			if (e.number < 8) 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/