I had a play with my SpaceNavigator, SDL and the Mac OS X beta Framework but unfortunately I could not interface with the device. I've pretty much exhausted what I can do without some input from the friendly 3Dconnexion engineers
I've detailed what I did (and how you can easily replicate it) at the bottom of this post.
In short, I think the possible issue is is that the SpaceNavigator is not registering itself with the HID library such that SDL can find it (specifically: kHIDUsage_GD_Joystick). Judging by some of the strings in the 3Dconnexion driver (ahem) I
think may have been registered as a mouse. This has a certain logic to it but a joystick feels a more instinctive to me given the number of degrees of freedom the SpaceNavigator et al support. Would it be possible to register them as joysticks instead? If there are reasons why a mouse was chosen (and must remain so), is it possible to register a device using two different kHIDUsage_*?
Many thanks for any help/assistance you can provide.
----------
What I did was:
1) Download the
runtime SDL library.
2) After mounting the .dmg, copy
SDL.framework to ~/Library/Frameworks
3) Download the
development SDL library (this will make it a lot easier to get up-and-running).
4) After mounting the .dmg, copy
TemplatesForXcode/* to ~/Library/Application Support/Apple/Developer Tools/
Project Templates/Application (you will have to manually create the subdirectory hierarchy I've highlighted).
5) Start Xcode
6) Choose the
File ->
New Project... menu item
7) Select
SDL Application that is in the
Application collapsable list of project types.
8 ) Save the project wherever you want.
9) Edit main.c:
- change "Uint32 initflags = SDL_INIT_VIDEO;" to "Uint32 initflags = SDL_INIT_VIDEO | SDL_INIT_JOYSTICK;"
- add the following after the SDL_Init if() block and before the setting of the video mode block:
Code: Select all
else
{
fprintf(stderr, "SDL successfully initialized\n");
}
int num_joysticks = SDL_NumJoysticks();
fprintf(stderr, "num_joysticks = %d\n", num_joysticks);
10) Select the
Build ->
Build and run menu item. The application will now run (assuming it compiles successfully, which it should). stderr is logged to the
Run Log window. It should display automatically but you can reach it via the
Window ->
Tools ->
Run Log menu item. (NB: don't command-Q quit the application as any key press (including the command key) will cause the application to quit and you may inadvertantly send a command-Q to Xcode instead...)
When I run it I get:
Code: Select all
[Session started at 2007-03-12 20:54:22 +0000.]
SDL successfully initialized
num_joysticks = 0
so it looks like that the 3Dconnexion driver software isn't registering itself correctly with IOHIDDeviceInterface - or at least not how SDL is expecting it to be.
Documentation of interest:
The SDL source code dealing with joysticks on Mac OS X:
SDL-1.2/src/joystick/darwin/SDL_sysjoystick.c. I'd recommend looking at the
SDL_SYS_JoystickInit function to see how SDL is detecting relevant devices.
SDL documentation index
SDL: Input Handling: Handling Joysticks
Again, many thanks for any assistance you can provide.