Adding SpaceNavigator support to libSDL

Hello,

I work for 3Dconnexion and I am interested in adding support for our SpaceNavigator device to libSDL. Before submitting patches, I have some questions:

  1. first of all, would you be interested in having this device supported? (I hope so :))

  2. on Linux the SpaceNavigator is a “RELative” event device. I see that event devices can be excluded with SDL_INPUT_LINUXEV: under what circumstances SDL_INPUT_LINUXEV is 0 ?

  3. I just started looking at the code, and I’d like to know if there are other special considerations or assumptions regarding event devices in libSDL that I should know.

Thanks,

Ettore Pasquini

I work for 3Dconnexion and I am interested in adding support for our SpaceNavigator device to libSDL.

Great!

  1. first of all, would you be interested in having this device supported? (I hope so :))

Sure! I would recommend starting with SDL 1.3, which is the current development branch of SDL.

  1. on Linux the SpaceNavigator is a “RELative” event device. I see that event devices can be excluded with SDL_INPUT_LINUXEV: under what circumstances SDL_INPUT_LINUXEV is 0 ?

At this point, I don’t think it’s ever 0.

  1. I just started looking at the code, and I’d like to know if there are other special considerations or assumptions regarding event devices in libSDL that I should know.

Not that I can think of offhand, but if you have any questions, feel free to ask.

See ya!
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment

I have something working for the SpaceNavigator. Two questions:

  1. To get the correct number of axes I had to add it as a special “relative” event device. This works, but it would be nicer to have SDL inspect the number of axes dynamically. Is there a way to do that with a relative device? I’m not a Linux expert. The code inside EV_ConfigJoystick reports 0 axes (I can’t find an analog of EVIOCGABS).

  2. Second problem is calibration. How is this achieved in SDL for regular joysticks? A few pointers in the code would suffice.

Thanks,

Ettore

I made a patch for adding support to the SpaceNavigator and other 3Dconnexion devices on Linux:

http://cubelogic.org/dev/libsdl/20080428/spacenav-libsdl1.3.patch

To apply, cd into your trunk working copy and give a
$ patch -p0 < spacenav-libsdl1.3.patch

I tested it against the SDLJoytest-GL sample code and it seems to work seamlessly. Basically the new (relative) event devices are recognized as a possible choice.

I think my changes are fairly straightforward but please feel free to ask any questions or give any feedback, especially if there’s something missing or wrong. My objective of course would be to see this merged into the trunk.

Ettore

This SpaceNavigator mouse looks interesting. Would you be willing to
donate one to the SDL foundation? :^)On 4/28/08, Ettore Pasquini <Ettore_Pasquini at 3dconnexion.com> wrote:

I made a patch for adding support to the SpaceNavigator and other 3Dconnexion devices on Linux:

http://cubelogic.org/dev/libsdl/20080428/spacenav-libsdl1.3.patch

To apply, cd into your trunk working copy and give a
$ patch -p0 < spacenav-libsdl1.3.patch

I tested it against the SDLJoytest-GL sample code and it seems to work seamlessly. Basically the new (relative) event devices are recognized as a possible choice.

I think my changes are fairly straightforward but please feel free to ask any questions or give any feedback, especially if there’s something missing or wrong. My objective of course would be to see this merged into the trunk.

Ettore


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

Sure, no problems, we can donate a couple. I only need to know the address. Please email me in private at ettore_pasquini at 3dconnexion dot com.

I know the SpaceNavigator is already supported on the Mac, so I was wondering, are there any plans for Windows?

Ettore> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org on behalf of JDE
Sent: Mon 4/28/2008 5:46 PM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: Re: [SDL] Adding SpaceNavigator support to libSDL

This SpaceNavigator mouse looks interesting. Would you be willing to
donate one to the SDL foundation? :^)

On 4/28/08, Ettore Pasquini <Ettore_Pasquini at 3dconnexion.com> wrote:

I made a patch for adding support to the SpaceNavigator and other 3Dconnexion devices on Linux:

http://cubelogic.org/dev/libsdl/20080428/spacenav-libsdl1.3.patch

To apply, cd into your trunk working copy and give a
$ patch -p0 < spacenav-libsdl1.3.patch

I tested it against the SDLJoytest-GL sample code and it seems to work seamlessly. Basically the new (relative) event devices are recognized as a possible choice.

I think my changes are fairly straightforward but please feel free to ask any questions or give any feedback, especially if there’s something missing or wrong. My objective of course would be to see this merged into the trunk.

Ettore


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


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

Minor corrections to my patch for 3Dconnexion devices (removed spurious tab
characters and added SpaceNavigator for notebooks):

http://cubelogic.org/dev/libsdl/20080506/3Dconnexion-linux-SDL1.3.patch

EttoreOn 4/29/08 11:18 AM, “Ettore Pasquini” <Ettore_Pasquini at 3dconnexion.com> wrote:

Sure, no problems, we can donate a couple. I only need to know the address.
Please email me in private at ettore_pasquini at 3dconnexion dot com.

I know the SpaceNavigator is already supported on the Mac, so I was wondering,
are there any plans for Windows?

Ettore

-----Original Message-----
From: sdl-bounces at lists.libsdl.org on behalf of JDE
Sent: Mon 4/28/2008 5:46 PM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: Re: [SDL] Adding SpaceNavigator support to libSDL

This SpaceNavigator mouse looks interesting. Would you be willing to
donate one to the SDL foundation? :^)

On 4/28/08, Ettore Pasquini <Ettore_Pasquini at 3dconnexion.com> wrote:

I made a patch for adding support to the SpaceNavigator and other 3Dconnexion
devices on Linux:

http://cubelogic.org/dev/libsdl/20080428/spacenav-libsdl1.3.patch

To apply, cd into your trunk working copy and give a
$ patch -p0 < spacenav-libsdl1.3.patch

I tested it against the SDLJoytest-GL sample code and it seems to work
seamlessly. Basically the new (relative) event devices are recognized as a
possible choice.

I think my changes are fairly straightforward but please feel free to ask any
questions or give any feedback, especially if there’s something missing or
wrong. My objective of course would be to see this merged into the trunk.

Ettore


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


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


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


http://www.3dconnexion.com/

I made a patch to support the SpaceNavigator and other DirectInput-only
joysticks on Windows. See attachement or here:

http://cubelogic.org/dev/libsdl/20080514/3Dconnexion-win-SDL1.3.patch

Some background notes on my work: I assumed the MultiMedia driver was the
one currently in use for Windows, as the DirectInput solution
(win32/SDL_dxjoystick.c) seems to be excluded by default. However, the
SpaceNavigator and other Space* devices are not recognized by the MultiMedia
driver, so I had to use DirectInput in some way. What I did is (1) respect
the current choice of using MM, and (2) merge in some DirectInput code when
needed, i.e. To support “special” DirectInput-only joysticks. DirectInput
is only used with joysticks listed in the SYS_SpecialJoysticks array to
avoid duplicates between MM and DI. The DirectInput code is vastly taken
from SDL_dxjoystick.c with as few changes as possible.

Let me know if you see any problems, I’ll be happy to fix them.

Ettore–
http://www.3dconnexion.com/

-------------- next part --------------
A non-text attachment was scrubbed…
Name: 3Dconnexion-win-SDL1.3.patch
Type: application/octet-stream
Size: 29301 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20080514/85510655/attachment.obj

Ettore Pasquini <ettore_pasquini 3dconnexion.com> writes:

I made a patch to support the SpaceNavigator and other DirectInput-only
joysticks on Windows. See attachement or here:

Let me know if you see any problems, I’ll be happy to fix them.

Ettore

Using Windows Vista, how do I go about linking your patch to my version of
SDL.dll? Or is this going to be a part of version 1.3 and I should therefore
wait for the dll download for that version?

Thanks!