SDL_HapticOpenFromJoystick doesn't initialize correctly on Win32

Hi,

I’ve detected a weird behaviour of the new haptic interface of SDL (post SDL 2.0rc1 version). I’ve tried to open the haptic interface for a joystick using SDL_HapticOpenFromJoystick and queried the capabilities using SDL_HapticQuery. I was really wondered when it returned 0. It is a Sixaxxis 3 controller running under Windows with MotionInJoy as driver in XInput mode (looks like a Xbox360 wireless controller to the OS) and I am really sure that the rumble effect works extreme well.

Then I’ve tested testrumble and noticed that also works extreme well in this program. So what is the difference? Yes, it is the call to SDL_HapticOpen. I’ve just added an SDL_HapticOpen(0) before my SDL_HapticOpenFromJoystick because I have only one haptic controller and this is also the only device (thus this call should make no difference). But funny enough, now the Query using the haptic device I got from SDL_HapticOpenFromJoystick works.

I would guess that some initialization done in SDL_HapticOpen isn’t done when calling SDL_HapticOpenFromJoystick.

Here in short from my first version:

h = SDL_HapticOpenFromJoystick(x)
SDL_Query(h) -> 0 (br0ken)

Here in short form my second version
SDL_HapticOpen(0)
h = SDL_HapticOpenFromJoystick(x)
SDL_Query(h) -> 2

And this also works but I also cannot do this im my program:
h = SDL_HapticOpen(0)
SDL_Query(h) -> 2

HI,

I’ve attached an easy example program. Check out the XXX lines and try it under windows

----- Urspr?ngliche Message -----Von: Franz Schrober <@Franz_Schrober>
An: “sdl at lists.libsdl.org
CC:
Gesendet: 19:56 Mittwoch, 26.Juni 2013
Betreff: SDL_HapticOpenFromJoystick doesn’t initialize correctly on Win32

Hi,

I’ve detected a weird behaviour of the new haptic interface of SDL (post SDL 2.0rc1 version). I’ve tried to open the haptic interface for a joystick using SDL_HapticOpenFromJoystick and queried the capabilities using SDL_HapticQuery. I was really wondered when it returned 0. It is a Sixaxxis 3 controller running under Windows with MotionInJoy as driver in XInput mode (looks like a Xbox360 wireless controller to the OS) and I am really sure that the rumble effect works extreme well.

Then I’ve tested testrumble and noticed that also works extreme well in this program. So what is the difference? Yes, it is the call to SDL_HapticOpen. I’ve just added an SDL_HapticOpen(0) before my SDL_HapticOpenFromJoystick because I have only one haptic controller and this is also the only device (thus this call should make no difference). But funny enough, now the Query using the haptic device I got from SDL_HapticOpenFromJoystick works.

I would guess that some initialization done in SDL_HapticOpen isn’t done when calling SDL_HapticOpenFromJoystick.

Here in short from my first version:

h = SDL_HapticOpenFromJoystick(x)
SDL_Query(h) -> 0 (br0ken)

Here in short form my second version
SDL_HapticOpen(0)
h = SDL_HapticOpenFromJoystick(x)
SDL_Query(h) -> 2

And this also works but I also cannot do this im my program:
h = SDL_HapticOpen(0)
SDL_Query(h) -> 2
-------------- next part --------------
A non-text attachment was scrubbed…
Name: testrumble.c
Type: text/x-csrc
Size: 3555 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130626/ec8f9e36/attachment.c

Is this the same issue? http://bugzilla.libsdl.org/show_bug.cgi?id=1867On 2013-06-26, at 4:46 PM, Franz Schrober wrote:

HI,

I’ve attached an easy example program. Check out the XXX lines and try it under windows

----- Urspr?ngliche Message -----
Von: Franz Schrober
An: “sdl at lists.libsdl.org
CC:
Gesendet: 19:56 Mittwoch, 26.Juni 2013
Betreff: SDL_HapticOpenFromJoystick doesn’t initialize correctly on Win32

Hi,

I’ve detected a weird behaviour of the new haptic interface of SDL (post SDL 2.0rc1 version). I’ve tried to open the haptic interface for a joystick using SDL_HapticOpenFromJoystick and queried the capabilities using SDL_HapticQuery. I was really wondered when it returned 0. It is a Sixaxxis 3 controller running under Windows with MotionInJoy as driver in XInput mode (looks like a Xbox360 wireless controller to the OS) and I am really sure that the rumble effect works extreme well.

Then I’ve tested testrumble and noticed that also works extreme well in this program. So what is the difference? Yes, it is the call to SDL_HapticOpen. I’ve just added an SDL_HapticOpen(0) before my SDL_HapticOpenFromJoystick because I have only one haptic controller and this is also the only device (thus this call should make no difference). But funny enough, now the Query using the haptic device I got from SDL_HapticOpenFromJoystick works.

I would guess that some initialization done in SDL_HapticOpen isn’t done when calling SDL_HapticOpenFromJoystick.

Here in short from my first version:

h = SDL_HapticOpenFromJoystick(x)
SDL_Query(h) -> 0 (br0ken)

Here in short form my second version
SDL_HapticOpen(0)
h = SDL_HapticOpenFromJoystick(x)
SDL_Query(h) -> 2

And this also works but I also cannot do this im my program:
h = SDL_HapticOpen(0)
SDL_Query(h) -> 2
<testrumble.c>_______________________________________________
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I’ve just looking through the code and found following things:

SDL_HapticOpenFromJoystick is missing:
?* haptic->index = device_index; (don’t ask me how to do it)
?* SDL_HapticSetGain
?* SDL_HapticSetAutoCenter

Windows SDL_SYS_HapticOpenFromJoystick doesn’t go through SDL_SYS_HapticOpenFromXInput. This is the reason why it cannot correctly initialize the haptic->supported and similar things done in this function (this is the only place for XInput were the supported stuff is touched)

----- Urspr?ngliche Message -----Von: Franz Schrober <@Franz_Schrober>
An: “sdl at lists.libsdl.org
CC:
Gesendet: 21:46 Mittwoch, 26.Juni 2013
Betreff: Re: SDL_HapticOpenFromJoystick doesn’t initialize correctly on Win32

HI,

I’ve attached an easy example program. Check out the XXX lines and try it under windows

----- Urspr?ngliche Message -----
Von: Franz Schrober <@Franz_Schrober>
An: “sdl at lists.libsdl.org
CC:
Gesendet: 19:56 Mittwoch, 26.Juni 2013
Betreff: SDL_HapticOpenFromJoystick doesn’t initialize correctly on Win32

Hi,

I’ve detected a weird behaviour of the new haptic interface of SDL (post SDL 2.0rc1 version). I’ve tried to open the haptic interface for a joystick using SDL_HapticOpenFromJoystick and queried the capabilities using SDL_HapticQuery. I was really wondered when it returned 0. It is a Sixaxxis 3 controller running under Windows with MotionInJoy as driver in XInput mode (looks like a Xbox360 wireless controller to the OS) and I am really sure that the rumble effect works extreme well.

Then I’ve tested testrumble and noticed that also works extreme well in this program. So what is the difference? Yes, it is the call to SDL_HapticOpen. I’ve just added an SDL_HapticOpen(0) before my SDL_HapticOpenFromJoystick because I have only one haptic controller and this is also the only device (thus this call should make no difference). But funny enough, now the Query using the haptic device I got from SDL_HapticOpenFromJoystick works.

I would guess that some initialization done in SDL_HapticOpen isn’t done when calling SDL_HapticOpenFromJoystick.

Here in short from my first version:

h = SDL_HapticOpenFromJoystick(x)
SDL_Query(h) -> 0 (br0ken)

Here in short form my second version
SDL_HapticOpen(0)
h = SDL_HapticOpenFromJoystick(x)
SDL_Query(h) -> 2

And this also works but I also cannot do this im my program:
h = SDL_HapticOpen(0)
SDL_Query(h) -> 2

Here is my patch for the problem

----- Urspr?ngliche Message -----Von: Franz Schrober <@Franz_Schrober>
An: “sdl at lists.libsdl.org
CC:
Gesendet: 22:15 Mittwoch, 26.Juni 2013
Betreff: Re: SDL_HapticOpenFromJoystick doesn’t initialize correctly on Win32

I’ve just looking through the code and found following things:

SDL_HapticOpenFromJoystick is missing:
?* haptic->index = device_index; (don’t ask me how to do it)
?* SDL_HapticSetGain
?* SDL_HapticSetAutoCenter

Windows SDL_SYS_HapticOpenFromJoystick doesn’t go through SDL_SYS_HapticOpenFromXInput. This is the reason why it cannot correctly initialize the haptic->supported and similar things done in this function (this is the only place for XInput were the supported stuff is touched)

----- Urspr?ngliche Message -----
Von: Franz Schrober <@Franz_Schrober>
An: “sdl at lists.libsdl.org
CC:
Gesendet: 21:46 Mittwoch, 26.Juni 2013
Betreff: Re: SDL_HapticOpenFromJoystick doesn’t initialize correctly on Win32

HI,

I’ve attached an easy example program. Check out the XXX lines and try it under windows

----- Urspr?ngliche Message -----
Von: Franz Schrober <@Franz_Schrober>
An: “sdl at lists.libsdl.org
CC:
Gesendet: 19:56 Mittwoch, 26.Juni 2013
Betreff: SDL_HapticOpenFromJoystick doesn’t initialize correctly on Win32

Hi,

I’ve detected a weird behaviour of the new haptic interface of SDL (post SDL 2.0rc1 version). I’ve tried to open the haptic interface for a joystick using SDL_HapticOpenFromJoystick and queried the capabilities using SDL_HapticQuery. I was really wondered when it returned 0. It is a Sixaxxis 3 controller running under Windows with MotionInJoy as driver in XInput mode (looks like a Xbox360 wireless controller to the OS) and I am really sure that the rumble effect works extreme well.

Then I’ve tested testrumble and noticed that also works extreme well in this program. So what is the difference? Yes, it is the call to SDL_HapticOpen. I’ve just added an SDL_HapticOpen(0) before my SDL_HapticOpenFromJoystick because I have only one haptic controller and this is also the only device (thus this call should make no difference). But funny enough, now the Query using the haptic device I got from SDL_HapticOpenFromJoystick works.

I would guess that some initialization done in SDL_HapticOpen isn’t done when calling SDL_HapticOpenFromJoystick.

Here in short from my first version:

h = SDL_HapticOpenFromJoystick(x)
SDL_Query(h) -> 0 (br0ken)

Here in short form my second version
SDL_HapticOpen(0)
h = SDL_HapticOpenFromJoystick(x)
SDL_Query(h) -> 2

And this also works but I also cannot do this im my program:
h = SDL_HapticOpen(0)
SDL_Query(h) -> 2
-------------- next part --------------
A non-text attachment was scrubbed…
Name: sdl2-1-xinput_init.patch
Type: text/x-patch
Size: 727 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130626/8a2b0002/attachment-0001.bin

I adapted your patch and cleaned up the code a bit. Please let me know if
there are any problems.

Thanks!On Wed, Jun 26, 2013 at 1:40 PM, Franz Schrober wrote:

Here is my patch for the problem

----- Urspr?ngliche Message -----
Von: Franz Schrober
An: “sdl at lists.libsdl.org
CC:
Gesendet: 22:15 Mittwoch, 26.Juni 2013
Betreff: Re: SDL_HapticOpenFromJoystick doesn’t initialize correctly on
Win32

I’ve just looking through the code and found following things:

SDL_HapticOpenFromJoystick is missing:

  • haptic->index = device_index; (don’t ask me how to do it)
  • SDL_HapticSetGain
  • SDL_HapticSetAutoCenter

Windows SDL_SYS_HapticOpenFromJoystick doesn’t go through
SDL_SYS_HapticOpenFromXInput. This is the reason why it cannot correctly
initialize the haptic->supported and similar things done in this function
(this is the only place for XInput were the supported stuff is touched)

----- Urspr?ngliche Message -----
Von: Franz Schrober
An: “sdl at lists.libsdl.org
CC:
Gesendet: 21:46 Mittwoch, 26.Juni 2013
Betreff: Re: SDL_HapticOpenFromJoystick doesn’t initialize correctly on
Win32

HI,

I’ve attached an easy example program. Check out the XXX lines and try it
under windows

----- Urspr?ngliche Message -----
Von: Franz Schrober
An: “sdl at lists.libsdl.org
CC:
Gesendet: 19:56 Mittwoch, 26.Juni 2013
Betreff: SDL_HapticOpenFromJoystick doesn’t initialize correctly on Win32

Hi,

I’ve detected a weird behaviour of the new haptic interface of SDL (post
SDL 2.0rc1 version). I’ve tried to open the haptic interface for a joystick
using SDL_HapticOpenFromJoystick and queried the capabilities using
SDL_HapticQuery. I was really wondered when it returned 0. It is a Sixaxxis
3 controller running under Windows with MotionInJoy as driver in XInput
mode (looks like a Xbox360 wireless controller to the OS) and I am really
sure that the rumble effect works extreme well.

Then I’ve tested testrumble and noticed that also works extreme well in
this program. So what is the difference? Yes, it is the call to
SDL_HapticOpen. I’ve just added an SDL_HapticOpen(0) before my
SDL_HapticOpenFromJoystick because I have only one haptic controller and
this is also the only device (thus this call should make no difference).
But funny enough, now the Query using the haptic device I got from
SDL_HapticOpenFromJoystick works.

I would guess that some initialization done in SDL_HapticOpen isn’t done
when calling SDL_HapticOpenFromJoystick.

Here in short from my first version:

h = SDL_HapticOpenFromJoystick(x)
SDL_Query(h) -> 0 (br0ken)

Here in short form my second version
SDL_HapticOpen(0)
h = SDL_HapticOpenFromJoystick(x)
SDL_Query(h) -> 2

And this also works but I also cannot do this im my program:
h = SDL_HapticOpen(0)
SDL_Query(h) -> 2


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org