Patched to compile on FreeBSD (1.2 branch). SDL-1.2
authorRyan C. Gordon <icculus@icculus.org>
Wed, 16 Nov 2011 05:20:17 -0500
branchSDL-1.2
changeset 6081 895486678126
parent 6059 a04171d6fa11
child 6082 3d4488ae2e24
Patched to compile on FreeBSD (1.2 branch).
src/joystick/bsd/SDL_sysjoystick.c
--- a/src/joystick/bsd/SDL_sysjoystick.c	Mon Nov 07 16:01:03 2011 -0500
+++ b/src/joystick/bsd/SDL_sysjoystick.c	Wed Nov 16 05:20:17 2011 -0500
@@ -63,6 +63,9 @@
 #ifndef __DragonFly__
 #include <osreldate.h>
 #endif
+#if __FreeBSD_kernel_version > 800063
+#include <dev/usb/usb_ioctl.h>
+#endif
 #include <sys/joystick.h>
 #endif
 
@@ -78,15 +81,12 @@
 #define MAX_JOY_JOYS	2
 #define MAX_JOYS	(MAX_UHID_JOYS + MAX_JOY_JOYS)
 
-#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) && false
-struct usb_ctl_report {
-	int	ucr_report;
-	u_char	ucr_data[1024]; /* filled data size will vary */
-};
+struct report {
+#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)
+	struct	usb_gen_descriptor *buf;	/* Buffer */
+#else
+	struct	usb_ctl_report *buf;	/* Buffer */
 #endif
-
-struct report {
-	struct	usb_ctl_report *buf;	/* Buffer */
 	size_t	size;			/* Buffer size */
 	int	rid;			/* Report ID */
 	enum {
@@ -148,8 +148,10 @@
 static int	report_alloc(struct report *, struct report_desc *, int);
 static void	report_free(struct report *);
 
-#if defined(USBHID_UCR_DATA) || (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)) || defined(__FreeBSD_kernel__)
+#if defined(USBHID_UCR_DATA) || defined(__FreeBSD_kernel__)
 #define REP_BUF_DATA(rep) ((rep)->buf->ucr_data)
+#elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063))
+#define REP_BUF_DATA(rep) ((rep)->buf->ugd_data)
 #else
 #define REP_BUF_DATA(rep) ((rep)->buf->data)
 #endif