src/joystick/bsd/SDL_sysjoystick.c
changeset 3385 45d7f0f70b27
parent 3367 7a7a61a1484d
child 3697 f7b03b6838cb
     1.1 --- a/src/joystick/bsd/SDL_sysjoystick.c	Mon Oct 12 08:21:43 2009 +0000
     1.2 +++ b/src/joystick/bsd/SDL_sysjoystick.c	Mon Oct 12 09:42:50 2009 +0000
     1.3 @@ -78,6 +78,13 @@
     1.4  #define MAX_JOY_JOYS	2
     1.5  #define MAX_JOYS	(MAX_UHID_JOYS + MAX_JOY_JOYS)
     1.6  
     1.7 +#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)
     1.8 +struct usb_ctl_report {
     1.9 +    int     ucr_report;
    1.10 +    u_char  ucr_data[1024]; /* filled data size will vary */
    1.11 +};
    1.12 +#endif
    1.13 +
    1.14  struct report
    1.15  {
    1.16      struct usb_ctl_report *buf; /* Buffer */
    1.17 @@ -142,7 +149,7 @@
    1.18  static int report_alloc(struct report *, struct report_desc *, int);
    1.19  static void report_free(struct report *);
    1.20  
    1.21 -#ifdef USBHID_UCR_DATA
    1.22 +#if defined(USBHID_UCR_DATA) || (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063))
    1.23  #define REP_BUF_DATA(rep) ((rep)->buf->ucr_data)
    1.24  #else
    1.25  #define REP_BUF_DATA(rep) ((rep)->buf->data)
    1.26 @@ -300,9 +307,13 @@
    1.27                       strerror(errno));
    1.28          goto usberr;
    1.29      }
    1.30 -
    1.31 +#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)
    1.32 +    rep->rid = hid_get_report_id(fd);
    1.33 +    if (rep->rid < 0) {
    1.34 +#else
    1.35      rep = &hw->inreport;
    1.36      if (ioctl(fd, USB_GET_REPORT_ID, &rep->rid) < 0) {
    1.37 +#endif
    1.38          rep->rid = -1;          /* XXX */
    1.39      }
    1.40      if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) {