Joystick patch from FreeBSD ports system
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404061
This commit is contained in:
parent
d54f916cc3
commit
344d83f986
1 changed files with 13 additions and 2 deletions
|
@ -78,6 +78,13 @@
|
||||||
#define MAX_JOY_JOYS 2
|
#define MAX_JOY_JOYS 2
|
||||||
#define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS)
|
#define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS)
|
||||||
|
|
||||||
|
#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)
|
||||||
|
struct usb_ctl_report {
|
||||||
|
int ucr_report;
|
||||||
|
u_char ucr_data[1024]; /* filled data size will vary */
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
struct report
|
struct report
|
||||||
{
|
{
|
||||||
struct usb_ctl_report *buf; /* Buffer */
|
struct usb_ctl_report *buf; /* Buffer */
|
||||||
|
@ -142,7 +149,7 @@ static char *joydevnames[MAX_JOYS];
|
||||||
static int report_alloc(struct report *, struct report_desc *, int);
|
static int report_alloc(struct report *, struct report_desc *, int);
|
||||||
static void report_free(struct report *);
|
static void report_free(struct report *);
|
||||||
|
|
||||||
#ifdef USBHID_UCR_DATA
|
#if defined(USBHID_UCR_DATA) || (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063))
|
||||||
#define REP_BUF_DATA(rep) ((rep)->buf->ucr_data)
|
#define REP_BUF_DATA(rep) ((rep)->buf->ucr_data)
|
||||||
#else
|
#else
|
||||||
#define REP_BUF_DATA(rep) ((rep)->buf->data)
|
#define REP_BUF_DATA(rep) ((rep)->buf->data)
|
||||||
|
@ -300,9 +307,13 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joy)
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto usberr;
|
goto usberr;
|
||||||
}
|
}
|
||||||
|
#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)
|
||||||
|
rep->rid = hid_get_report_id(fd);
|
||||||
|
if (rep->rid < 0) {
|
||||||
|
#else
|
||||||
rep = &hw->inreport;
|
rep = &hw->inreport;
|
||||||
if (ioctl(fd, USB_GET_REPORT_ID, &rep->rid) < 0) {
|
if (ioctl(fd, USB_GET_REPORT_ID, &rep->rid) < 0) {
|
||||||
|
#endif
|
||||||
rep->rid = -1; /* XXX */
|
rep->rid = -1; /* XXX */
|
||||||
}
|
}
|
||||||
if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) {
|
if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue