Reactivate USB joystick support on -CURRENT.

PR:	ports/132150
Submitted by:	hps
Approved by:	miwi (mentor)
This commit is contained in:
Marcus von Appen 2009-03-13 16:32:57 +00:00
parent 716e48ad80
commit 28cf0d4958
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=230005
2 changed files with 41 additions and 5 deletions

View file

@ -7,7 +7,7 @@
PORTNAME= sdl
PORTVERSION= 1.2.13
PORTREVISION= 2
PORTREVISION= 3
PORTEPOCH= 2
CATEGORIES= devel
MASTER_SITES= http://www.libsdl.org/release/
@ -64,10 +64,6 @@ OPTIONS+= XLIB "XLib (xorg) graphics support" On
MAN3!= ${CAT} ${FILESDIR}/man3
.if ${OSVERSION} > 800063
CONFIGURE_ARGS+=--disable-joystick
.endif
.if defined(WITHOUT_AALIB)
CONFIGURE_ARGS+=--disable-video-aalib
.else

View file

@ -0,0 +1,40 @@
--- src/joystick/bsd/SDL_sysjoystick.c.orig 2009-03-12 22:54:57.000000000 +0100
+++ src/joystick/bsd/SDL_sysjoystick.c 2009-03-12 23:04:53.000000000 +0100
@@ -74,6 +74,13 @@
#define MAX_JOY_JOYS 2
#define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS)
+#if defined(__FREEBSD__) && (__FreeBSD_version > 800063)
+struct usb_ctl_report {
+ int ucr_report;
+ u_char ucr_data[1024]; /* filled data size will vary */
+};
+#endif
+
struct report {
struct usb_ctl_report *buf; /* Buffer */
size_t size; /* Buffer size */
@@ -137,7 +144,7 @@
static int report_alloc(struct report *, struct report_desc *, int);
static void report_free(struct report *);
-#ifdef USBHID_UCR_DATA
+#if defined(USBHID_UCR_DATA) || (defined(__FREEBSD__) && (__FreeBSD_version > 800063))
#define REP_BUF_DATA(rep) ((rep)->buf->ucr_data)
#else
#define REP_BUF_DATA(rep) ((rep)->buf->data)
@@ -292,9 +299,13 @@
strerror(errno));
goto usberr;
}
-
+#if defined(__FREEBSD__) && (__FreeBSD_version > 800063)
+ rep->rid = hid_get_report_id(fd);
+ if (rep->rid < 0) {
+#else
rep = &hw->inreport;
if (ioctl(fd, USB_GET_REPORT_ID, &rep->rid) < 0) {
+#endif
rep->rid = -1; /* XXX */
}
if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) {