mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 17:59:20 -04:00
Build fixes for __FreeBSD_version >= 500111 (usbhid changes.)
This commit is contained in:
parent
897b3697ae
commit
aa3d7c479b
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=78644
3 changed files with 155 additions and 0 deletions
65
devel/sdl12/files/patch-joystick::bsd::SDL_sysjoystick.c
Normal file
65
devel/sdl12/files/patch-joystick::bsd::SDL_sysjoystick.c
Normal file
|
@ -0,0 +1,65 @@
|
|||
--- src/joystick/bsd/SDL_sysjoystick.c.orig Sat Oct 5 01:32:49 2002
|
||||
+++ src/joystick/bsd/SDL_sysjoystick.c Sun Apr 6 23:40:03 2003
|
||||
@@ -53,6 +53,10 @@
|
||||
#include <libusbhid.h>
|
||||
#endif
|
||||
|
||||
+#ifdef __FreeBSD__
|
||||
+#include <osreldate.h>
|
||||
+#endif
|
||||
+
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_joystick.h"
|
||||
#include "SDL_sysjoystick.h"
|
||||
@@ -201,6 +205,7 @@
|
||||
}
|
||||
|
||||
rep = &hw->inreport;
|
||||
+ rep->rid = 0;
|
||||
if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) {
|
||||
goto usberr;
|
||||
}
|
||||
@@ -210,7 +215,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);
|
||||
@@ -300,7 +305,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);
|
||||
@@ -399,11 +404,24 @@
|
||||
{
|
||||
int len;
|
||||
|
||||
-#ifdef USBHID_NEW
|
||||
+#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
|
||||
#else
|
||||
+# ifdef USBHID_NEW
|
||||
+ len = hid_report_size(rd, repinfo[repind].kind, &r->rid);
|
||||
+# else
|
||||
len = hid_report_size(rd, repinfo[repind].kind, r->rid);
|
||||
+# endif
|
||||
#endif
|
||||
+
|
||||
if (len < 0) {
|
||||
SDL_SetError("Negative HID report size");
|
||||
return (-1);
|
|
@ -0,0 +1,58 @@
|
|||
--- src/unix/joystick-drivers/joy_usb.c.orig Mon Mar 17 22:36:59 2003
|
||||
+++ src/unix/joystick-drivers/joy_usb.c Tue Apr 8 22:54:47 2003
|
||||
@@ -20,19 +20,27 @@
|
||||
"Patches to support other archs are welcome ;)"
|
||||
#endif
|
||||
|
||||
-#if defined(__ARCH_netbsd)
|
||||
-#ifdef HAVE_USBHID_H
|
||||
-#include <usbhid.h>
|
||||
+#if defined(HAVE_USBHID_H) || defined(HAVE_LIBUSBHID_H)
|
||||
+# ifdef HAVE_USBHID_H
|
||||
+# include <usbhid.h>
|
||||
+# endif
|
||||
+# ifdef HAVE_LIBUSBHID_H
|
||||
+# include <libusbhid.h>
|
||||
+# endif
|
||||
#else
|
||||
-#include <usb.h>
|
||||
-#endif
|
||||
-#elif defined(__ARCH_freebsd)
|
||||
-#ifdef HAVE_USBHID_H
|
||||
-#include <libusbhid.h>
|
||||
-#else
|
||||
-#include <libusb.h>
|
||||
+# ifdef __ARCH_netbsd
|
||||
+# include <usb.h>
|
||||
+# endif
|
||||
+# ifdef __ARCH_freebsd
|
||||
+# include <libusb.h>
|
||||
+# endif
|
||||
#endif
|
||||
+
|
||||
+#ifdef __ARCH_freebsd
|
||||
+#include <osreldate.h>
|
||||
+#include <sys/ioctl.h>
|
||||
#endif
|
||||
+
|
||||
#include <dev/usb/usb.h>
|
||||
#include <dev/usb/usbhid.h>
|
||||
|
||||
@@ -90,7 +98,7 @@
|
||||
|
||||
priv_joy_data[i].hids = NULL;
|
||||
|
||||
-#ifdef HAVE_USBHID_H
|
||||
+#if defined(HAVE_USBHID_H) || defined(HAVE_LIBUSBHID_H)
|
||||
#if defined(__ARCH_netbsd) || (defined(__ARCH_freebsd) && __FreeBSD_version > 500000)
|
||||
if (ioctl(joy_data[i].fd, USB_GET_REPORT_ID, &report_id) < 0)
|
||||
{
|
||||
@@ -114,7 +122,7 @@
|
||||
priv_joy_data[i].dlen = size;
|
||||
|
||||
is_joystick = 0;
|
||||
-#if defined(__ARCH_netbsd) && defined(HAVE_USBHID_H)
|
||||
+#if defined(HAVE_USBHID_H)
|
||||
for (d = hid_start_parse(rd, 1 << hid_input, report_id);
|
||||
hid_get_item(d, &h); )
|
||||
#else
|
|
@ -20,3 +20,35 @@
|
|||
endif
|
||||
|
||||
ifdef SOUND_WAVEOUT
|
||||
@@ -248,27 +248,20 @@
|
||||
ifdef JOY_PS2
|
||||
CONFIG += -DPS2_JOYSTICK
|
||||
endif
|
||||
+
|
||||
ifdef JOY_USB
|
||||
CONFIG += -DUSB_JOYSTICK
|
||||
-ifeq ($(ARCH), netbsd)
|
||||
ifeq ($(shell test -f /usr/include/usbhid.h && echo have_usbhid), have_usbhid)
|
||||
CONFIG += -DHAVE_USBHID_H
|
||||
MY_LIBS += -lusbhid
|
||||
else
|
||||
-MY_LIBS += -lusb
|
||||
-endif
|
||||
-else
|
||||
-ifeq ($(ARCH), freebsd)
|
||||
-ifeq ($(shell test -f /usr/include/libusbhid.h && echo have_usbhid), have_usbhid)
|
||||
-CONFIG += -DHAVE_USBHID_H
|
||||
+ifeq ($(shell test -f /usr/include/libusbhid.h && echo have_libusbhid), have_libusbhid)
|
||||
+CONFIG += -DHAVE_LIBUSBHID_H
|
||||
MY_LIBS += -lusbhid
|
||||
-else
|
||||
-MY_LIBS += -lusb
|
||||
+endif
|
||||
endif
|
||||
else
|
||||
MY_LIBS += -lusb
|
||||
-endif
|
||||
-endif
|
||||
endif
|
||||
|
||||
ifdef EFENCE
|
||||
|
|
Loading…
Add table
Reference in a new issue