We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 443

Summary: Joystick Initialisation
Product: SDL Reporter: Dave Hillier <davehillier81>
Component: joystickAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P1    
Version: 1.2.11   
Hardware: x86   
OS: Windows (XP)   

Description Dave Hillier 2007-06-21 15:27:53 UTC
Joystick: Logitech Rumblepad 2 HID

I've recently upgraded to version 1.2.11 from 1.2.8.


Symptom:
SDL_NumJoysticks() returns 0 despite a joystick being attached.

Cause:
E:\libs\SDL-1.2.11\src\joystick\win32\SDL_mmjoystick.c(170):		
result = joyGetPosEx(SYS_JoystickID[i], &joyinfo);

returns JOYERR_PARMS

As a work around I've changed line 171 to:
if ( result != JOYERR_UNPLUGGED ) {

I've no idea why this is happening, as the source seems to be relatively unchanged.
Comment 1 Sam Lantinga 2007-07-07 21:38:11 UTC
Everything that I've read indicates that the error code JOYERR_PARMS indicates a joystick not installed.  I did notice a comment in MSDN that you should use joyGetPos() instead of joyGetPosEx() for simpler joysticks.  If you replace that call with joyGetPos(), does it detect the joystick?
Comment 2 Ryan C. Gordon 2007-07-08 23:50:45 UTC
Bumping some bugs' priorities to P1 for consideration before the 1.2.12 release (though some may not be resolved for 1.2.12).

--ryan.

Comment 3 Ryan C. Gordon 2007-07-15 09:12:27 UTC
I'm going to take a stab at this real quick.

--ryan.

Comment 4 Sam Lantinga 2007-07-15 09:19:19 UTC
BTW, I tested joyGetPos() and joyGetPosEx() and they were equivalent for the joysticks I have.   Can you reproduce this bug?(In reply to comment #3)
> I'm going to take a stab at this real quick.
> 
> --ryan.
> 

BTW, I tested joyGetPos() and joyGetPosEx() and they were equivalent for the joysticks I have.   Can you reproduce this bug?

Comment 5 Ryan C. Gordon 2007-07-15 09:44:41 UTC
I just tried this with a NES controller rewired with a USB chip:

  There are 1 joysticks attached
  Joystick 0: SealieComputing RetroPad
         axes: 2
        balls: 0
         hats: 0
      buttons: 8


...msdn's text says that joyGetPos() is for devices with less than 3 axes, but apparently joyGetPosEx() still works with those.

I tried this on XP Service Pack 2. Perhaps the API is buggy in older OS releases?

Maybe this is just a driver issue on Dave's system? Dave, can you verify that this definitely broke between 1.2.8 and 1.2.11?

--ryan.

Comment 6 Dave Hillier 2007-07-15 09:50:24 UTC
I think this must have been a driver bug, as I can't reproduce this anymore.
Comment 7 Sam Lantinga 2007-07-15 09:57:54 UTC
Okay, thanks for checking, Dave. :)