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 1984

Summary: XInput compatible device initialized as a DirectInput device
Product: SDL Reporter: yamamoto
Component: joystickAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus
Version: 2.0.0Keywords: target-2.0.0
Hardware: x86_64   
OS: Windows (All)   
URL: http://forums.libsdl.org/viewtopic.php?t=9301&sid=8953aa2cdb4f5dd07891aa1271a61b22

Description yamamoto 2013-07-25 05:14:21 UTC
Overview:
SDL2 initializes XInput compatible device as a DirectInput device under 
a specific circumstance.

Steps to Reproduce:
- Prepare 2 XInput compatible input devices.
- Plug off all XInput compatible devices from your machine.
- Plug in 2 controllers to your machine in order, and make sure both are recognized.
- Plug off first connected device and leave second one connected.
- In your program, Call SDL_Init(SDL_INIT_JOYSTICK) or SDL_InitSubSystem(SDL_INIT_JOYSTICK) to have SDL2 detect your XInput device.
- Then call SDL_JoystickOpen(0) to initialize the XInput device. The function will initialize the device on DirectInput.

Actual Results:
SDL2 handles the joystick device in an unexpected manner. The connected device is handled by DirectInput. In the case of wired XBox360 game pad, you can see SDL_JoystickNumAxes() retrieves 5 for the device while the function usually returns 6 for the game pad.

Expected Results:
The connected device is handled by XInput internally. In the case of wired XBox360 game pad, SDL_JoystickNumAxes() should return 6.

Build Date & Platform:
2013 25th July with SDL 2.0.0. Windows7 64bit
Comment 1 Ryan C. Gordon 2013-08-28 20:58:26 UTC
This should now be fixed in https://hg.libsdl.org/SDL/rev/37e02f8fcfa8

--ryan.