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 6081895486678126
parent 6059 a04171d6fa11
child 6082 3d4488ae2e24
Patched to compile on FreeBSD (1.2 branch).
src/joystick/bsd/SDL_sysjoystick.c
     1.1 --- a/src/joystick/bsd/SDL_sysjoystick.c	Mon Nov 07 16:01:03 2011 -0500
     1.2 +++ b/src/joystick/bsd/SDL_sysjoystick.c	Wed Nov 16 05:20:17 2011 -0500
     1.3 @@ -63,6 +63,9 @@
     1.4  #ifndef __DragonFly__
     1.5  #include <osreldate.h>
     1.6  #endif
     1.7 +#if __FreeBSD_kernel_version > 800063
     1.8 +#include <dev/usb/usb_ioctl.h>
     1.9 +#endif
    1.10  #include <sys/joystick.h>
    1.11  #endif
    1.12  
    1.13 @@ -78,15 +81,12 @@
    1.14  #define MAX_JOY_JOYS	2
    1.15  #define MAX_JOYS	(MAX_UHID_JOYS + MAX_JOY_JOYS)
    1.16  
    1.17 -#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) && false
    1.18 -struct usb_ctl_report {
    1.19 -	int	ucr_report;
    1.20 -	u_char	ucr_data[1024]; /* filled data size will vary */
    1.21 -};
    1.22 +struct report {
    1.23 +#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)
    1.24 +	struct	usb_gen_descriptor *buf;	/* Buffer */
    1.25 +#else
    1.26 +	struct	usb_ctl_report *buf;	/* Buffer */
    1.27  #endif
    1.28 -
    1.29 -struct report {
    1.30 -	struct	usb_ctl_report *buf;	/* Buffer */
    1.31  	size_t	size;			/* Buffer size */
    1.32  	int	rid;			/* Report ID */
    1.33  	enum {
    1.34 @@ -148,8 +148,10 @@
    1.35  static int	report_alloc(struct report *, struct report_desc *, int);
    1.36  static void	report_free(struct report *);
    1.37  
    1.38 -#if defined(USBHID_UCR_DATA) || (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)) || defined(__FreeBSD_kernel__)
    1.39 +#if defined(USBHID_UCR_DATA) || defined(__FreeBSD_kernel__)
    1.40  #define REP_BUF_DATA(rep) ((rep)->buf->ucr_data)
    1.41 +#elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063))
    1.42 +#define REP_BUF_DATA(rep) ((rep)->buf->ugd_data)
    1.43  #else
    1.44  #define REP_BUF_DATA(rep) ((rep)->buf->data)
    1.45  #endif