Joystick Hat switch/stick

matrixpeckham wrote on Saturday, January 17, 2009:

Hello, is it currently (or in planning to be) possible to use GLFW to program for a hat switch such as the one on the <a href="">Logitech 3D Pro</a>?

dalfy wrote on Saturday, January 17, 2009:

I am not a joystick user so can you tell me exactly what is a hat switch. I have at home a pretty old but similar joystick called sidewinder precision pro of Microsoft. Can you tell me if this joystick also has a hat switch as it seems to me. If so I will investigate how much of the different features of the joystick are supported by GLFW and how it is possible to extend support for this kind of device if needed.


matrixpeckham wrote on Saturday, January 17, 2009:

The hat switch is the 8 way stick at the very top of the joystick. i’ve done a few tests myself, and GLFW doesn’t seem to recognize that it’s on the stick, it will read the buttons the stick the rotation and the throttle, but it doesn’t know that the 8-way hat is there

dalfy wrote on Saturday, January 17, 2009:

Okay, I have the appropriate hardware to do some testing and investigate. Can you open a ticket on the tracker. I will make some tests shortly. I don’t see anything that goes against this button to work. It is not different from a regular button of the joystick (except the fact that there is eight buttons in one.

matrixpeckham wrote on Sunday, January 18, 2009:

I just signed up here so i’m not quite sure what you mean by open a ticket on the tracker, sorry for my ignorence.

dalfy wrote on Sunday, January 25, 2009:

I did a few investigation of the joystick API. I created a simple test (that still need to be polished slightly to be added to the examples directory) that report the state of the first joystick available every so often. Using this test I discover that my device (with a hat switch/stick) is properly handled by GLFW in the following way:
- the joystick reports six axis for the joystick. The first three are for forward/backward left/right and rotation around the z axis. The fourth axis correspond to the gas/power axis and finally the hat switch/stick are reported by glfw as axis 5 and 6.

I will soon check-in the example (by the end of the week) so that you can test by yourself.

celtx wrote on Monday, March 09, 2009:

Hi all,

class library… I’m having this issue with the d-pad on a xbox 360 game pad. Windows controller config recognize it as the hat. GLFW not reporting it as an axis or as buttons. Any suggestions (would be v.welcome)? i can look into patching myself if necessary

elmindreda wrote on Tuesday, March 10, 2009:

No suggestions, sorry.

Patches are very welcome.

celtx wrote on Tuesday, March 10, 2009:

thanks for reply, will give it a shot