int fgPlatformHasSpaceball(void) 
{
    /* XXX this function should somehow query the driver if there's a device
     * plugged in, as opposed to just checking if there's a driver to talk to.
     */
    return spnav_fd() == -1 ? 0 : 1;
}
int fgHasSpaceball(void)
{
    if(!sball_initialized) {
        fgInitialiseSpaceball();
        if(!sball_initialized) {
            fgWarning("fgInitialiseSpaceball failed\n");
            return 0;
        }
    }

#if TARGET_HOST_POSIX_X11
    /* XXX this function should somehow query the driver if there's a device
     * plugged in, as opposed to just checking if there's a driver to talk to.
     */
    return spnav_fd() == -1 ? 0 : 1;
#else
    return 0;
#endif
}
QSpaceNavigator::QSpaceNavigator() {
	if(spnav_open() != -1) {
		spaceSock = new QSocketNotifier(spnav_fd(),QSocketNotifier::Read, this);
		connect(spaceSock, SIGNAL(activated(int)), this, SLOT(poll()));
	}