Commit 1d8cdd55 authored by Sam Lantinga's avatar Sam Lantinga

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.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40612
parent 108052b0
...@@ -55,6 +55,10 @@ static char rcsid = ...@@ -55,6 +55,10 @@ static char rcsid =
#include <libusbhid.h> #include <libusbhid.h>
#endif #endif
#ifdef __FreeBSD__
#include <osreldate.h>
#endif
#include "SDL_error.h" #include "SDL_error.h"
#include "SDL_joystick.h" #include "SDL_joystick.h"
#include "SDL_sysjoystick.h" #include "SDL_sysjoystick.h"
...@@ -210,6 +214,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick *joy) ...@@ -210,6 +214,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick *joy)
} }
rep = &hw->inreport; rep = &hw->inreport;
rep->rid = 0;
if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) { if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) {
goto usberr; goto usberr;
} }
...@@ -219,7 +224,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick *joy) ...@@ -219,7 +224,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick *joy)
goto usberr; 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); hdata = hid_start_parse(hw->repdesc, 1 << hid_input, rep->rid);
#else #else
hdata = hid_start_parse(hw->repdesc, 1 << hid_input); hdata = hid_start_parse(hw->repdesc, 1 << hid_input);
...@@ -309,7 +314,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick *joy) ...@@ -309,7 +314,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick *joy)
if (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) != rep->size) { if (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) != rep->size) {
return; 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); hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input, rep->rid);
#else #else
hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input); hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input);
...@@ -410,7 +415,11 @@ report_alloc(struct report *r, struct report_desc *rd, int repind) ...@@ -410,7 +415,11 @@ report_alloc(struct report *r, struct report_desc *rd, int repind)
#ifdef __FreeBSD__ #ifdef __FreeBSD__
# if (__FreeBSD_version >= 470000) # if (__FreeBSD_version >= 470000)
# if (__FreeBSD_version <= 500111)
len = hid_report_size(rd, r->rid, repinfo[repind].kind); len = hid_report_size(rd, r->rid, repinfo[repind].kind);
# else
len = hid_report_size(rd, repinfo[repind].kind, r->rid);
# endif
# else # else
len = hid_report_size(rd, repinfo[repind].kind, &r->rid); len = hid_report_size(rd, repinfo[repind].kind, &r->rid);
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment