# HG changeset patch # User Sam Lantinga # Date 1023852721 0 # Node ID 173909e17b7f3e0b347f2e9b1c68fdaee12df8a3 # Parent 9916da315b0df4b1bb756a57b672e5bc3900a537 API changes on OpenBSD and FreeBSD... diff -r 9916da315b0d -r 173909e17b7f configure.in --- a/configure.in Wed Jun 12 03:30:58 2002 +0000 +++ b/configure.in Wed Jun 12 03:32:01 2002 +0000 @@ -1614,6 +1614,33 @@ CFLAGS="$CFLAGS -DUSBHID_UCR_DATA" fi AC_MSG_RESULT($have_usbhid_ucr_data) + + AC_MSG_CHECKING(for new usbhid API) + have_usbhid_new=no + AC_TRY_COMPILE([ + #include + #if defined(HAVE_USB_H) + #include + #endif + #include + #include + #if defined(HAVE_USBHID_H) + #include + #elif defined(HAVE_LIBUSB_H) + #include + #elif defined(HAVE_LIBUSBHID_H) + #include + #endif + ],[ + report_desc_t d; + hid_start_parse(d, 1, 1); + ],[ + have_usbhid_new=yes + ]) + if test x$have_usbhid_new = xyes; then + CFLAGS="$CFLAGS -DUSBHID_NEW" + fi + AC_MSG_RESULT($have_usbhid_new) JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd" JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la" diff -r 9916da315b0d -r 173909e17b7f src/joystick/bsd/SDL_sysjoystick.c --- a/src/joystick/bsd/SDL_sysjoystick.c Wed Jun 12 03:30:58 2002 +0000 +++ b/src/joystick/bsd/SDL_sysjoystick.c Wed Jun 12 03:32:01 2002 +0000 @@ -29,7 +29,7 @@ #ifdef SAVE_RCSID static char rcsid = - "@(#) $Id $"; + "@(#) $Id$"; #endif #include @@ -210,7 +210,11 @@ goto usberr; } +#ifdef USBHID_NEW + hdata = hid_start_parse(hw->repdesc, 1 << hid_input, rep->rid); +#else hdata = hid_start_parse(hw->repdesc, 1 << hid_input); +#endif if (hdata == NULL) { SDL_SetError("%s: Cannot start HID parser", hw->path); goto usberr; @@ -296,7 +300,11 @@ if (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) != rep->size) { return; } +#ifdef USBHID_NEW + hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input, rep->rid); +#else hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input); +#endif if (hdata == NULL) { fprintf(stderr, "%s: Cannot start HID parser\n", joy->hwdata->path); @@ -400,7 +408,11 @@ { int len; +#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 if (len < 0) { SDL_SetError("Negative HID report size"); return (-1);