ports/136973: sdl12 dumps core on 8-current when joystick is used
Wes Morgan
morganw at chemikals.org
Wed Jul 22 01:50:01 UTC 2009
>Number: 136973
>Category: ports
>Synopsis: sdl12 dumps core on 8-current when joystick is used
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Jul 22 01:50:00 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Wes Morgan
>Release: 8.0-current
>Organization:
>Environment:
FreeBSD catalyst 8.0-BETA2 FreeBSD 8.0-BETA2 #7: Mon Jul 20 17:46:59 CDT 2009 root at catalyst:/usr/obj/usr/src/sys/CATALYST i386
>Description:
When attempting to use a joystick in an SDL application (such as dosbox), the program crashes. This seems to be due to an incorrect patch that leaves the "struct report" pointer uninitialized.
>How-To-Repeat:
Build and install dosbox on 8-current, attempt to use a (usb) joystick.
>Fix:
Correctly initialize the "rep" variable.
Patch attached with submission follows:
--- SDL_sysjoystick.c.orig 2007-12-30 22:47:55.000000000 -0600
+++ SDL_sysjoystick.c 2009-07-21 20:38:05.362267174 -0500
@@ -74,6 +74,13 @@
#define MAX_JOY_JOYS 2
#define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS)
+#if defined(__FREEBSD__) && (__FreeBSD_version > 800063)
+struct usb_ctl_report {
+ int ucr_report;
+ u_char ucr_data[1024]; /* filled data size will vary */
+};
+#endif
+
struct report {
struct usb_ctl_report *buf; /* Buffer */
size_t size; /* Buffer size */
@@ -137,7 +144,7 @@
static int report_alloc(struct report *, struct report_desc *, int);
static void report_free(struct report *);
-#ifdef USBHID_UCR_DATA
+#if defined(USBHID_UCR_DATA) || (defined(__FREEBSD__) && (__FreeBSD_version > 800063))
#define REP_BUF_DATA(rep) ((rep)->buf->ucr_data)
#else
#define REP_BUF_DATA(rep) ((rep)->buf->data)
@@ -292,9 +299,13 @@
strerror(errno));
goto usberr;
}
-
rep = &hw->inreport;
+#if defined(__FREEBSD__) && (__FreeBSD_version > 800063)
+ rep->rid = hid_get_report_id(fd);
+ if (rep->rid < 0) {
+#else
if (ioctl(fd, USB_GET_REPORT_ID, &rep->rid) < 0) {
+#endif
rep->rid = -1; /* XXX */
}
if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) {
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list