/*
- * freeglut_joystick.c
+ * fg_joystick.c
*
* Joystick handling code
*
# ifdef HAVE_USB_JS
# if defined(__NetBSD__)
-/* XXX The below hack is done until freeglut's autoconf is updated. */
-# define HAVE_USBHID_H 1
# ifdef HAVE_USBHID_H
# include <usbhid.h>
# else
# include <usb.h>
# endif
+# include <dev/usb/usb.h>
# elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# ifdef HAVE_USBHID_H
# include <usbhid.h>
# else
# include <libusbhid.h>
# endif
+# include <legacy/dev/usb/usb.h>
# endif
-# include <legacy/dev/usb/usb.h>
# include <dev/usb/usbhid.h>
/* Compatibility with older usb.h revisions */
if (cp)
return 1;
}
-#ifdef HAVE_ERRNO_H
else if (errno == EACCES) {
if (!protection_warned) {
fgWarning ( "Can't open %s for read!", buf );
protection_warned = 1;
}
}
-#endif
}
return 0;
}
if ( ( rd = hid_get_report_desc( os->fd ) ) == 0 )
{
-#ifdef HAVE_ERRNO_H
fgWarning ( "error: %s: %s", os->fname, strerror( errno ) );
-#else
- fgWarning ( "error: %s", os->fname );
-#endif
return FALSE;
}
if( ioctl( os->fd, USB_GET_REPORT_ID, &report_id ) < 0)
{
/*** XXX {report_id} may not be the right variable? ***/
-#ifdef HAVE_ERRNO_H
fgWarning ( "error: %s%d: %s", UHIDDEV, report_id, strerror( errno ) );
-#else
- fgWarning ( "error: %s%d", UHIDDEV, report_id );
-#endif
return FALSE;
}
if( joy->error )
return;
- fgPlatformJoystickRawRead ( joy, buttons, axes );
+ fgPlatformJoystickRawRead ( joy, buttons, axes );
}
/*
void fgPlatformJoystickOpen( SFG_Joystick* joy )
{
- int i = 0;
+ int i = 0;
OSStatus err;
/* XXX FIXME: get joystick name in Mac */
joy->num_axes = joy->num_buttons = 0;
joy->name[ 0 ] = '\0';
- fgPlatformJoystickOpen ( joy );
+ fgPlatformJoystickOpen ( joy );
}
fgJoystick[ ident ]->num_axes = fgJoystick[ ident ]->num_buttons = 0;
fgJoystick[ ident ]->error = GL_TRUE;
- fgPlatformJoystickInit( fgJoystick, ident );
+ fgPlatformJoystickInit( fgJoystick, ident );
fghJoystickOpen( fgJoystick[ ident ] );
}
{
if( fgJoystick[ ident ] )
{
- fgPlatformJoystickClose ( ident );
+ fgPlatformJoystickClose ( ident );
free( fgJoystick[ ident ] );
fgJoystick[ ident ] = NULL;