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 - XInput compatible device initialized as a DirectInput device
Summary: XInput compatible device initialized as a DirectInput device
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: 2.0.0
Hardware: x86_64 Windows (All)
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL: http://forums.libsdl.org/viewtopic.ph...
Keywords: target-2.0.0
Depends on:
Blocks:
 
Reported: 2013-07-25 05:14 UTC by yamamoto
Modified: 2013-08-28 20:58 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.