# Steering Wheel

**URL:** <https://discourse.libsdl.org/t/steering-wheel/10269>\
**Category:** SDL Development\
**Created:** [March 1, 2004, 9:59am UTC](https://discourse.libsdl.org/t/steering-wheel/10269 "2004-03-01T09:59:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian\_Allgood](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/c/8c91f0/32.png) [@Christian\_Allgood](https://discourse.libsdl.org/u/Christian_Allgood)\
**Post date:** [March 1, 2004, 9:59am UTC](https://discourse.libsdl.org/t/steering-wheel/10269/1 "2004-03-01T09:59:23Z")

</div>

I’m having a problem with using a USB steering wheel. For some reason,  
the SDL\_JoystickNumButtons() function is returning the wrong number of  
buttons. I’m not doing anything fancy, just . . .

joystick = SDL\_JoystickOpen(which);  
if(joystick == NULL){  
return(1);  
}//end if

int numButtons = SDL\_JoystickNumButtons();

. . . this returns two more buttons than are present on my steering  
wheel. I tested things a little with a program I found called  
SDLJoytest that simply displays “lights” for all of the buttons found,  
and makes them red when they are pressed down.

Any ideas?

Christian

---

<div class="post-metadata">

**Author:** ![Wes\_Poole](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/w/13edae/32.png) [@Wes\_Poole](https://discourse.libsdl.org/u/Wes_Poole)\
**Post date:** [March 1, 2004, 10:32am UTC](https://discourse.libsdl.org/t/steering-wheel/10269/2 "2004-03-01T10:32:58Z")

</div>

I’m going out on a limb here, but my guess would be that the driver is  
counting peddles, which are probably optional for your wheel and  
possibly not present (I know the wheels logitech sells now has the  
peddles seperate). If this is the case it’s not SDL’s fault and you  
just need to see if you can get the name of the device (through  
joystick calls) and have logic to ignore the extra buttons.

Christian Allgood wrote:\> I’m having a problem with using a USB steering wheel. For some reason,

> the SDL\_JoystickNumButtons() function is returning the wrong number of  
> buttons. I’m not doing anything fancy, just . . .
> 
> joystick = SDL\_JoystickOpen(which);  
> if(joystick == NULL){  
> return(1);  
> }//end if
> 
> int numButtons = SDL\_JoystickNumButtons();
> 
> . . . this returns two more buttons than are present on my steering  
> wheel. I tested things a little with a program I found called  
> SDLJoytest that simply displays “lights” for all of the buttons found,  
> and makes them red when they are pressed down.
> 
> Any ideas?
> 
> Christian
> 
> * * *
> 
> SDL mailing list  
> SDL at [libsdl.org](http://libsdl.org)  
> [http://www.libsdl.org/mailman/listinfo/sdl](http://www.libsdl.org/mailman/listinfo/sdl)
