Serial Spaceball and Spacenavd

I finally got my hands on a serial spaceball device. Apparently non-USB devices are literally given away on ebay for ridiculously small amounts of money, so I managed to get this wonderful Spaceball 4000 FLX for 12 pounds a couple of days ago!

spaceballs

I wanted a serial spaceball for two reasons: first of all I meant to add support for serial devices to spacenavd for a long time now. In fact John Stone was kind enough to send me his code to interface with serial spaceballs a long time ago, but not having such a device myself, for testing, I wasn’t very keen to hack at it blindly. Also, I wanted to be able to use a 6dof input device with my SGI Octane2, which doesn’t have any USB ports.

So finally, as soon as I got my hands on the serial spaceball, I went on and added serial support to spacenavd. I haven’t released a new version of spacenavd yet, because I want to iron out some details first, but you can always get the new serial-capable spacenavd through subversion if you need it.

FreeGLUT spaceball patch

The original GLUT library used to support some less well-known input devices under IRIX, such as the Spaceball, a true 3D input device which can be used to control all 6 degrees of freedom (3 axis of rotation and 3 axis of translation) simultaneously. Unfortunately, nowadays, the more “exotic” input callbacks of GLUT such as the spaceball are left unimplemented.

So, yesterday I sat down and implemented the missing spaceball bits of FreeGLUT, which is the most widely used free GLUT implementation.

To avoid adding any extra dependencies to freeglut, I just ripped the relevant code from libspnav, which is part of my free spacenav driver project, and added it directly into freeglut.

Here’s the patch against the current freeglut svn head, as well as instructions on how to check out freeglut and apply it.

I’ve also submitted it to the freeglut-devel mailing list, so hopefully they’ll merge it and we’ll have spaceball input callbacks available with the prepackaged glut that comes with any GNU/Linux distribution in the future.

Spacenavd 0.4


I just released version 0.4 of my spacenavd user space driver for 6dof input devices, which fixes some long-standing reliability and ease of use issues.

First and foremost, I cleaned up the code, which started initially as a hack, and ended as an unmaintainable mess. I’ve split and isolated the linux specific parts so that I may add support for other operating systems in the future (specifically I’d like to find the chance to add freebsd support soon).

I’ve also dropped the dodgy 30sec polling cycle to aquire the device if it’s disconnected, which had the effect of being able to use the device at some seemingly random time after plugging it in, and started using the KOBJECT_UEVENT netlink socket to get asyncronous notification of hotplug events from the kernel. Now the device lights up and is ready to use immediatly upon plugging it in the USB port.

More importantly, I lifted the responsibility of notifying the daemon that X has started and it may connect and start listening for X11 clients from the user. By using the excellent inotify API to detect when the X server’s socket is created in /tmp/.X11-unix, the daemon is now able to wake up and connect to the X server automatically as soon as it’s started up.

And finally, now spacenavd actively grabs the device when it starts, which solves the problem of the X server trying to use it as a mouse, without having to resort to messing around with the user’s HAL config files, to make hald ignore it.

To celebrate this milestone release, the free spacenav project now has a newly redesigned web site, which may help attract more attention compared to the previous plain-text web page. Thanks go to cybernoid for the new web site.

Follow

Get every new post delivered to your Inbox.