diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 43e345d94..a9434c85a 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -973,8 +973,8 @@ macro(CheckUSBHID) #include #endif #ifdef __DragonFly__ - # include - # include + # include + # include #else # include # include @@ -999,8 +999,8 @@ macro(CheckUSBHID) #include #endif #ifdef __DragonFly__ - # include - # include + # include + # include #else # include # include @@ -1027,8 +1027,8 @@ macro(CheckUSBHID) #include #endif #ifdef __DragonFly__ - #include - #include + #include + #include #else #include #include diff --git a/configure b/configure index 0edf785b0..cdb12bd02 100755 --- a/configure +++ b/configure @@ -24036,7 +24036,7 @@ $as_echo "#define SDL_LOADSO_DLOPEN 1" >>confdefs.h CheckUSBHID() { case "$host" in - *-*-*bsd*) + *-*-*bsd*|*-*-dragonfly*) if test x$enable_joystick = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusbhid" >&5 $as_echo_n "checking for hid_init in -lusbhid... " >&6; } @@ -24161,8 +24161,8 @@ $as_echo_n "checking for usbhid... " >&6; } #include #endif #ifdef __DragonFly__ - # include - # include + # include + # include #else # include # include @@ -24208,8 +24208,8 @@ $as_echo_n "checking for ucr_data member of usb_ctl_report... " >&6; } #include #endif #ifdef __DragonFly__ - # include - # include + # include + # include #else # include # include @@ -24256,8 +24256,8 @@ $as_echo_n "checking for new usbhid API... " >&6; } #include #endif #ifdef __DragonFly__ - #include - #include + #include + #include #else #include #include diff --git a/configure.ac b/configure.ac index 80863e523..b7e519b8f 100644 --- a/configure.ac +++ b/configure.ac @@ -3198,7 +3198,7 @@ dnl Check for the usbhid(3) library on *BSD CheckUSBHID() { case "$host" in - *-*-*bsd*) + *-*-*bsd*|*-*-dragonfly*) if test x$enable_joystick = xyes; then AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes) if test x$have_libusbhid = xyes; then @@ -3222,8 +3222,8 @@ CheckUSBHID() #include #endif #ifdef __DragonFly__ - # include - # include + # include + # include #else # include # include @@ -3253,8 +3253,8 @@ CheckUSBHID() #include #endif #ifdef __DragonFly__ - # include - # include + # include + # include #else # include # include @@ -3285,8 +3285,8 @@ CheckUSBHID() #include #endif #ifdef __DragonFly__ - #include - #include + #include + #include #else #include #include diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index a1cc86d4d..b529a6d1d 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -894,7 +894,7 @@ SDL_GetSystemRAM(void) #endif #ifdef HAVE_SYSCTLBYNAME if (SDL_SystemRAM <= 0) { -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__DragonFly__) #ifdef HW_REALMEM int mib[2] = {CTL_HW, HW_REALMEM}; #else diff --git a/src/joystick/bsd/SDL_bsdjoystick.c b/src/joystick/bsd/SDL_bsdjoystick.c index 1595acf3c..60d779938 100644 --- a/src/joystick/bsd/SDL_bsdjoystick.c +++ b/src/joystick/bsd/SDL_bsdjoystick.c @@ -43,8 +43,8 @@ #include #endif #ifdef __DragonFly__ -#include -#include +#include +#include #else #include #include @@ -59,13 +59,14 @@ #endif #if defined(__FREEBSD__) || defined(__FreeBSD_kernel__) -#ifndef __DragonFly__ #include -#endif #if __FreeBSD_kernel_version > 800063 #include #endif #include +#elif defined(__DragonFly__) +#include +#include #endif #if SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H @@ -126,7 +127,8 @@ dpad_to_sdl(Sint32 *dpad) struct report { -#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000) +#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000) || \ + defined(__DragonFly__) void *buf; /* Buffer */ #elif defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) struct usb_gen_descriptor *buf; /* Buffer */ @@ -196,7 +198,8 @@ static void report_free(struct report *); #if defined(USBHID_UCR_DATA) || (defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version <= 800063) #define REP_BUF_DATA(rep) ((rep)->buf->ucr_data) -#elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000)) +#elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000)) || \ + defined(__DragonFly__) #define REP_BUF_DATA(rep) ((rep)->buf) #elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)) #define REP_BUF_DATA(rep) ((rep)->buf->ugd_data) @@ -393,7 +396,7 @@ BSD_JoystickOpen(SDL_Joystick *joy, int device_index) goto usberr; } rep = &hw->inreport; -#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) || defined(__FreeBSD_kernel__) +#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) rep->rid = hid_get_report_id(fd); if (rep->rid < 0) { #else @@ -439,7 +442,7 @@ desc_failed: hw->path); goto usberr; } -#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__) +#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) hdata = hid_start_parse(hw->repdesc, 1 << hid_input, rep->rid); #else hdata = hid_start_parse(hw->repdesc, 1 << hid_input); @@ -543,7 +546,7 @@ BSD_JoystickUpdate(SDL_Joystick *joy) Sint32 dpad[4] = {0, 0, 0, 0}; #endif -#if defined(__FREEBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H || defined(__FreeBSD_kernel__) +#if defined(__FREEBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H || defined(__FreeBSD_kernel__) || defined(__DragonFly_) struct joystick gameport; static int x, y, xmin = 0xffff, ymin = 0xffff, xmax = 0, ymax = 0; @@ -593,7 +596,7 @@ BSD_JoystickUpdate(SDL_Joystick *joy) rep = &joy->hwdata->inreport; while (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) == rep->size) { -#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__) +#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input, rep->rid); #else hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input); @@ -707,7 +710,7 @@ report_alloc(struct report *r, struct report_desc *rd, int repind) int len; #ifdef __DragonFly__ - len = hid_report_size(rd, r->rid, repinfo[repind].kind); + len = hid_report_size(rd, repinfo[repind].kind, r->rid); #elif __FREEBSD__ # if (__FreeBSD_kernel_version >= 460000) || defined(__FreeBSD_kernel__) # if (__FreeBSD_kernel_version <= 500111) @@ -732,7 +735,7 @@ report_alloc(struct report *r, struct report_desc *rd, int repind) r->size = len; if (r->size > 0) { -#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000) +#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000) || defined(__DragonFly__) r->buf = SDL_malloc(r->size); #else r->buf = SDL_malloc(sizeof(*r->buf) - sizeof(REP_BUF_DATA(r)) +