I read that SecondLife (SL) is "planning" on working on joystick support for Linux... Windows has it... Mac has it... why don't we?
I'm a long-time Linux user, off and on since the Kernel version started with a zero, and full-time user since around the Y2K fiasco (no, I didn't shift because of that!)
SL opened up their source code for the viewer recently (YAAY!), and I've recently purchased a shiny SpaceNavigator (SN) to play with. Of course, the SN isn't well supported on Linux, but there are a few decent drivers out there, and I've built my own just for fun and learning too...
So then I tackle the issue of joysticks in general, and the SpaceNavigator specifically not working with the SL Viewer in Linux...
One Download of the aforementioned SL Viewer source code later...
I find this:
In the file: .../linden/indra/newview/llviewerjoystick.h
Line 37:
#define LIB_NDOF (LL_WINDOWS || LL_DARWIN)
For those of you who aren't programmers... this essentially says "Define the flag LIB_NDOF if we're compiling for WINDOWS *OR* MAC (darwin)"
The rest of the joystick code then bases its working (or not) on this flag.
example on lines 39: (same file)
#if LIB_NDOF
and in the file:
.../linden/indra/newview/llviewerjoystick.cpp
Lines 168-236:
void LLViewerJoystick::init(bool autoenable)
{
#if LIB_NDOF
... {snip} ...
#endif
}
Which effectively cuts OUT the entire joystick initialization routine. This is continued throughout the joystick support modules.
So... since we're compiling for Linux, LL_WINDOWS and LL_DARWIN are FALSE, while LL_LINUX is TRUE... thus LIB_NDOF is FALSE... and the Linux users [rant mode] HAVEN'T EVEN GOT A CHANCE TO TRY! [/rant mode].
From this, it is apparent that Linux users will NEVER get a joystick working, unless we resort to mapping keystrokes to joystick positions. That's not a solution, it's a crude patch.
Yes, I CAN (and will!) edit the code and enable joystick support for the Linux SL Viewer. This helps me. But doesn't do much for the other 17 Linux users out there.
Please, at least ENABLE the joystick code for Linux users, so we can try to make things work. You're not even giving us a chance.
[Edit] 2008-05-19 02:13
Ok, after reading several bazillion bug tracker entries on SL's bug tracker system (!)... I find that a potential reason this is 'commented out' is because somehow SDL (a Linux Graphics system) doesn't seem to be able to obtain the motion data from the SN.
Hmmm, I'll try writing some sample code tonight (this morning?!?) or tomorrow and see if I can read the data from SDL calls. I think what might be creating havoc is the possibility that SL is wanting to use the 3Dconnexion supplied drivers, or even the FOSS replacement drivers. I've had *NO* problems reading the data using 'evdev' and 'uinput' type code, and really would like to not use those additional drivers. The SN responds as a HID (Human Interface Device) as per USB standards, just like my two USB gamepads, my USB keyboard and USB mice. So I don't think a special driver would be necessary.
I say this based on the fact that my joysticks/gamepads are sensed properly (and without extra drivers) by some of the SDL games and examples I've found. So following that logic... I believe it can be done, and quite simply. (Of course, 'simply' saying that, I've now cursed myself and will suffer through the many circles of Hell while researching this. {sigh})
[/Edit]