Fixed bug 5406 - Upstreaming DragonFlyBSD changes from DeltaPorts (patch from David Carlier)
parent
22275b35e4
commit
ee180efda7
|
@ -973,8 +973,8 @@ macro(CheckUSBHID)
|
||||||
#include <usb.h>
|
#include <usb.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __DragonFly__
|
#ifdef __DragonFly__
|
||||||
# include <bus/usb/usb.h>
|
# include <bus/u4b/usb.h>
|
||||||
# include <bus/usb/usbhid.h>
|
# include <bus/u4b/usbhid.h>
|
||||||
#else
|
#else
|
||||||
# include <dev/usb/usb.h>
|
# include <dev/usb/usb.h>
|
||||||
# include <dev/usb/usbhid.h>
|
# include <dev/usb/usbhid.h>
|
||||||
|
@ -999,8 +999,8 @@ macro(CheckUSBHID)
|
||||||
#include <usb.h>
|
#include <usb.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __DragonFly__
|
#ifdef __DragonFly__
|
||||||
# include <bus/usb/usb.h>
|
# include <bus/u4b/usb.h>
|
||||||
# include <bus/usb/usbhid.h>
|
# include <bus/u4b/usbhid.h>
|
||||||
#else
|
#else
|
||||||
# include <dev/usb/usb.h>
|
# include <dev/usb/usb.h>
|
||||||
# include <dev/usb/usbhid.h>
|
# include <dev/usb/usbhid.h>
|
||||||
|
@ -1027,8 +1027,8 @@ macro(CheckUSBHID)
|
||||||
#include <usb.h>
|
#include <usb.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __DragonFly__
|
#ifdef __DragonFly__
|
||||||
#include <bus/usb/usb.h>
|
#include <bus/u4b/usb.h>
|
||||||
#include <bus/usb/usbhid.h>
|
#include <bus/u4b/usbhid.h>
|
||||||
#else
|
#else
|
||||||
#include <dev/usb/usb.h>
|
#include <dev/usb/usb.h>
|
||||||
#include <dev/usb/usbhid.h>
|
#include <dev/usb/usbhid.h>
|
||||||
|
|
|
@ -24036,7 +24036,7 @@ $as_echo "#define SDL_LOADSO_DLOPEN 1" >>confdefs.h
|
||||||
CheckUSBHID()
|
CheckUSBHID()
|
||||||
{
|
{
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-*bsd*)
|
*-*-*bsd*|*-*-dragonfly*)
|
||||||
if test x$enable_joystick = xyes; then
|
if test x$enable_joystick = xyes; then
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusbhid" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusbhid" >&5
|
||||||
$as_echo_n "checking for hid_init in -lusbhid... " >&6; }
|
$as_echo_n "checking for hid_init in -lusbhid... " >&6; }
|
||||||
|
@ -24161,8 +24161,8 @@ $as_echo_n "checking for usbhid... " >&6; }
|
||||||
#include <usb.h>
|
#include <usb.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __DragonFly__
|
#ifdef __DragonFly__
|
||||||
# include <bus/usb/usb.h>
|
# include <bus/u4b/usb.h>
|
||||||
# include <bus/usb/usbhid.h>
|
# include <bus/u4b/usbhid.h>
|
||||||
#else
|
#else
|
||||||
# include <dev/usb/usb.h>
|
# include <dev/usb/usb.h>
|
||||||
# include <dev/usb/usbhid.h>
|
# include <dev/usb/usbhid.h>
|
||||||
|
@ -24208,8 +24208,8 @@ $as_echo_n "checking for ucr_data member of usb_ctl_report... " >&6; }
|
||||||
#include <usb.h>
|
#include <usb.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __DragonFly__
|
#ifdef __DragonFly__
|
||||||
# include <bus/usb/usb.h>
|
# include <bus/u4b/usb.h>
|
||||||
# include <bus/usb/usbhid.h>
|
# include <bus/u4b/usbhid.h>
|
||||||
#else
|
#else
|
||||||
# include <dev/usb/usb.h>
|
# include <dev/usb/usb.h>
|
||||||
# include <dev/usb/usbhid.h>
|
# include <dev/usb/usbhid.h>
|
||||||
|
@ -24256,8 +24256,8 @@ $as_echo_n "checking for new usbhid API... " >&6; }
|
||||||
#include <usb.h>
|
#include <usb.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __DragonFly__
|
#ifdef __DragonFly__
|
||||||
#include <bus/usb/usb.h>
|
#include <bus/u4b/usb.h>
|
||||||
#include <bus/usb/usbhid.h>
|
#include <bus/u4b/usbhid.h>
|
||||||
#else
|
#else
|
||||||
#include <dev/usb/usb.h>
|
#include <dev/usb/usb.h>
|
||||||
#include <dev/usb/usbhid.h>
|
#include <dev/usb/usbhid.h>
|
||||||
|
|
14
configure.ac
14
configure.ac
|
@ -3198,7 +3198,7 @@ dnl Check for the usbhid(3) library on *BSD
|
||||||
CheckUSBHID()
|
CheckUSBHID()
|
||||||
{
|
{
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-*bsd*)
|
*-*-*bsd*|*-*-dragonfly*)
|
||||||
if test x$enable_joystick = xyes; then
|
if test x$enable_joystick = xyes; then
|
||||||
AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
|
AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
|
||||||
if test x$have_libusbhid = xyes; then
|
if test x$have_libusbhid = xyes; then
|
||||||
|
@ -3222,8 +3222,8 @@ CheckUSBHID()
|
||||||
#include <usb.h>
|
#include <usb.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __DragonFly__
|
#ifdef __DragonFly__
|
||||||
# include <bus/usb/usb.h>
|
# include <bus/u4b/usb.h>
|
||||||
# include <bus/usb/usbhid.h>
|
# include <bus/u4b/usbhid.h>
|
||||||
#else
|
#else
|
||||||
# include <dev/usb/usb.h>
|
# include <dev/usb/usb.h>
|
||||||
# include <dev/usb/usbhid.h>
|
# include <dev/usb/usbhid.h>
|
||||||
|
@ -3253,8 +3253,8 @@ CheckUSBHID()
|
||||||
#include <usb.h>
|
#include <usb.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __DragonFly__
|
#ifdef __DragonFly__
|
||||||
# include <bus/usb/usb.h>
|
# include <bus/u4b/usb.h>
|
||||||
# include <bus/usb/usbhid.h>
|
# include <bus/u4b/usbhid.h>
|
||||||
#else
|
#else
|
||||||
# include <dev/usb/usb.h>
|
# include <dev/usb/usb.h>
|
||||||
# include <dev/usb/usbhid.h>
|
# include <dev/usb/usbhid.h>
|
||||||
|
@ -3285,8 +3285,8 @@ CheckUSBHID()
|
||||||
#include <usb.h>
|
#include <usb.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __DragonFly__
|
#ifdef __DragonFly__
|
||||||
#include <bus/usb/usb.h>
|
#include <bus/u4b/usb.h>
|
||||||
#include <bus/usb/usbhid.h>
|
#include <bus/u4b/usbhid.h>
|
||||||
#else
|
#else
|
||||||
#include <dev/usb/usb.h>
|
#include <dev/usb/usb.h>
|
||||||
#include <dev/usb/usbhid.h>
|
#include <dev/usb/usbhid.h>
|
||||||
|
|
|
@ -894,7 +894,7 @@ SDL_GetSystemRAM(void)
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SYSCTLBYNAME
|
#ifdef HAVE_SYSCTLBYNAME
|
||||||
if (SDL_SystemRAM <= 0) {
|
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
|
#ifdef HW_REALMEM
|
||||||
int mib[2] = {CTL_HW, HW_REALMEM};
|
int mib[2] = {CTL_HW, HW_REALMEM};
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -43,8 +43,8 @@
|
||||||
#include <usb.h>
|
#include <usb.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __DragonFly__
|
#ifdef __DragonFly__
|
||||||
#include <bus/usb/usb.h>
|
#include <bus/u4b/usb.h>
|
||||||
#include <bus/usb/usbhid.h>
|
#include <bus/u4b/usbhid.h>
|
||||||
#else
|
#else
|
||||||
#include <dev/usb/usb.h>
|
#include <dev/usb/usb.h>
|
||||||
#include <dev/usb/usbhid.h>
|
#include <dev/usb/usbhid.h>
|
||||||
|
@ -59,13 +59,14 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__FREEBSD__) || defined(__FreeBSD_kernel__)
|
#if defined(__FREEBSD__) || defined(__FreeBSD_kernel__)
|
||||||
#ifndef __DragonFly__
|
|
||||||
#include <osreldate.h>
|
#include <osreldate.h>
|
||||||
#endif
|
|
||||||
#if __FreeBSD_kernel_version > 800063
|
#if __FreeBSD_kernel_version > 800063
|
||||||
#include <dev/usb/usb_ioctl.h>
|
#include <dev/usb/usb_ioctl.h>
|
||||||
#endif
|
#endif
|
||||||
#include <sys/joystick.h>
|
#include <sys/joystick.h>
|
||||||
|
#elif defined(__DragonFly__)
|
||||||
|
#include <bus/u4b/usb_ioctl.h>
|
||||||
|
#include <sys/joystick.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
|
#if SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
|
||||||
|
@ -126,7 +127,8 @@ dpad_to_sdl(Sint32 *dpad)
|
||||||
|
|
||||||
struct report
|
struct report
|
||||||
{
|
{
|
||||||
#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000)
|
#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000) || \
|
||||||
|
defined(__DragonFly__)
|
||||||
void *buf; /* Buffer */
|
void *buf; /* Buffer */
|
||||||
#elif defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)
|
#elif defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)
|
||||||
struct usb_gen_descriptor *buf; /* Buffer */
|
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)
|
#if defined(USBHID_UCR_DATA) || (defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version <= 800063)
|
||||||
#define REP_BUF_DATA(rep) ((rep)->buf->ucr_data)
|
#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)
|
#define REP_BUF_DATA(rep) ((rep)->buf)
|
||||||
#elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063))
|
#elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063))
|
||||||
#define REP_BUF_DATA(rep) ((rep)->buf->ugd_data)
|
#define REP_BUF_DATA(rep) ((rep)->buf->ugd_data)
|
||||||
|
@ -393,7 +396,7 @@ BSD_JoystickOpen(SDL_Joystick *joy, int device_index)
|
||||||
goto usberr;
|
goto usberr;
|
||||||
}
|
}
|
||||||
rep = &hw->inreport;
|
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);
|
rep->rid = hid_get_report_id(fd);
|
||||||
if (rep->rid < 0) {
|
if (rep->rid < 0) {
|
||||||
#else
|
#else
|
||||||
|
@ -439,7 +442,7 @@ desc_failed:
|
||||||
hw->path);
|
hw->path);
|
||||||
goto usberr;
|
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);
|
hdata = hid_start_parse(hw->repdesc, 1 << hid_input, rep->rid);
|
||||||
#else
|
#else
|
||||||
hdata = hid_start_parse(hw->repdesc, 1 << hid_input);
|
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};
|
Sint32 dpad[4] = {0, 0, 0, 0};
|
||||||
#endif
|
#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;
|
struct joystick gameport;
|
||||||
static int x, y, xmin = 0xffff, ymin = 0xffff, xmax = 0, ymax = 0;
|
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;
|
rep = &joy->hwdata->inreport;
|
||||||
|
|
||||||
while (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) == rep->size) {
|
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);
|
hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input, rep->rid);
|
||||||
#else
|
#else
|
||||||
hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input);
|
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;
|
int len;
|
||||||
|
|
||||||
#ifdef __DragonFly__
|
#ifdef __DragonFly__
|
||||||
len = hid_report_size(rd, r->rid, repinfo[repind].kind);
|
len = hid_report_size(rd, repinfo[repind].kind, r->rid);
|
||||||
#elif __FREEBSD__
|
#elif __FREEBSD__
|
||||||
# if (__FreeBSD_kernel_version >= 460000) || defined(__FreeBSD_kernel__)
|
# if (__FreeBSD_kernel_version >= 460000) || defined(__FreeBSD_kernel__)
|
||||||
# if (__FreeBSD_kernel_version <= 500111)
|
# if (__FreeBSD_kernel_version <= 500111)
|
||||||
|
@ -732,7 +735,7 @@ report_alloc(struct report *r, struct report_desc *rd, int repind)
|
||||||
r->size = len;
|
r->size = len;
|
||||||
|
|
||||||
if (r->size > 0) {
|
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);
|
r->buf = SDL_malloc(r->size);
|
||||||
#else
|
#else
|
||||||
r->buf = SDL_malloc(sizeof(*r->buf) - sizeof(REP_BUF_DATA(r)) +
|
r->buf = SDL_malloc(sizeof(*r->buf) - sizeof(REP_BUF_DATA(r)) +
|
||||||
|
|
Loading…
Reference in New Issue