changeset 611:0a2ef9e8ca41

Date: Wed, 9 Apr 2003 01:03:25 -0400 (EDT) From: "Matthew N. Dodd" Subject: SDL patch: FreeBSD joystick support. This patch deals with the recent changes in FreeBSD. We're making an effort not to diverge our libusbhid from NetBSD's.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 15 Apr 2003 16:02:08 +0000
parents 95433459fbd2
children 0648505b1f8b
files src/joystick/bsd/SDL_sysjoystick.c
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/joystick/bsd/SDL_sysjoystick.c	Tue Apr 15 15:46:56 2003 +0000
+++ b/src/joystick/bsd/SDL_sysjoystick.c	Tue Apr 15 16:02:08 2003 +0000
@@ -55,6 +55,10 @@
 #include <libusbhid.h>
 #endif
 
+#ifdef __FreeBSD__
+#include <osreldate.h>
+#endif
+
 #include "SDL_error.h"
 #include "SDL_joystick.h"
 #include "SDL_sysjoystick.h"
@@ -210,6 +214,7 @@
 	}
 
 	rep = &hw->inreport;
+	rep->rid = 0;
 	if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) {
 		goto usberr;
 	}
@@ -219,7 +224,7 @@
 		goto usberr;
 	}
 
-#ifdef USBHID_NEW
+#if defined(USBHID_NEW) || (defined(__FreeBSD__) && __FreeBSD_version >= 500111)
 	hdata = hid_start_parse(hw->repdesc, 1 << hid_input, rep->rid);
 #else
 	hdata = hid_start_parse(hw->repdesc, 1 << hid_input);
@@ -309,7 +314,7 @@
 	if (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) != rep->size) {
 		return;
 	}
-#ifdef USBHID_NEW
+#if defined(USBHID_NEW) || (defined(__FreeBSD__) && __FreeBSD_version >= 500111)
 	hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input, rep->rid);
 #else
 	hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input);
@@ -410,7 +415,11 @@
 
 #ifdef __FreeBSD__
 # if (__FreeBSD_version >= 470000)
+#  if (__FreeBSD_version <= 500111)
 	len = hid_report_size(rd, r->rid, repinfo[repind].kind);
+#  else
+	len = hid_report_size(rd, repinfo[repind].kind, r->rid);
+#  endif
 # else
 	len = hid_report_size(rd, repinfo[repind].kind, &r->rid);
 #endif