1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-11 07:22:22 +00:00

Fix build on -CURRENT; usbhid issue.

This commit is contained in:
Matthew N. Dodd 2003-05-04 19:05:34 +00:00
parent fe21f6bb02
commit 17ee41006f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=80117
3 changed files with 46 additions and 15 deletions

View File

@ -28,8 +28,6 @@ MAN6= bzflag.6 bzfrelay.6 bzfls.6 bzfs.6
do-configure:
@${CP} ${FILESDIR}/config-sys ${WRKSRC}/
${REINPLACE_CMD} "s,libusb.h,libusbhid.h,g" \
${WRKSRC}/src/platform/XWindow.h
${REINPLACE_CMD} "s,malloc.h,stdlib.h,g" \
${WRKSRC}/src/bzflag/HUDRenderer.cxx

View File

@ -0,0 +1,19 @@
--- src/platform/XWindow.h.bak Tue Jun 4 02:39:32 2002
+++ src/platform/XWindow.h Sun May 4 14:23:23 2003
@@ -35,9 +35,14 @@
extern "C" {
#endif
#ifdef __FreeBSD__
-#include <libusb.h>
+# include <osreldate.h>
+# if __FreeBSD_version >= 500111
+# include <usbhid.h>
+# else
+# include <libusbhid.h>
+# endif
#else
-#include <usb.h>
+# include <usb.h>
#endif
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>

View File

@ -1,6 +1,6 @@
--- src/platform/usbjoy.cxx Wed Sep 18 22:28:34 2002
+++ src/platform/usbjoy.cxx.new Wed Sep 18 22:28:22 2002
@@ -46,14 +46,14 @@
--- src/platform/usbjoy.cxx.orig Tue Jun 4 02:39:32 2002
+++ src/platform/usbjoy.cxx Sun May 4 14:36:38 2003
@@ -46,7 +46,7 @@
int data_buf_offset;
};
@ -9,21 +9,27 @@
usb_joystick::usb_joystick(const char *name)
{
report_desc_t rd;
hid_data *d;
hid_item h;
- int report_id;
+ hid_kind_t k;
@@ -58,6 +58,7 @@
status = FALSE;
hids = NULL;
@@ -67,11 +67,12 @@
num_axis = 0;
+ report_id = 0;
if ((fd = open(name, O_RDONLY | O_NONBLOCK))<0)
return;
@@ -67,15 +68,27 @@
return;
}
- data_buf_size = hid_report_size(rd, hid_input, &report_id);
+ k = hid_input;
+ data_buf_size = hid_report_size(rd, hid_input, k);
+#if (__FreeBSD_version >= 470000)
+# if (__FreeBSD_version >= 500111)
+ data_buf_size = hid_report_size(rd, hid_input, report_id);
+# else
+ data_buf_size = hid_report_size(rd, report_id, hid_input);
+# endif
+#else
data_buf_size = hid_report_size(rd, hid_input, &report_id);
+#endif
if ((data_buf = (char *)malloc(data_buf_size)) == NULL) {
hid_dispose_report_desc(rd);
}
@ -32,3 +38,11 @@
int is_joystick = 0;
int interesting_hid = FALSE;
+#if (__FreeBSD_version >= 500111)
+ for (d = hid_start_parse(rd, 1 << hid_input, report_id); hid_get_item(d, &h); ) {
+#else
for (d = hid_start_parse(rd, 1 << hid_input); hid_get_item(d, &h); ) {
+#endif
int page = HID_PAGE(h.usage);
int usage = HID_USAGE(h.usage);
is_joystick = is_joystick ||