Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Mar 2009 19:43:46 +0100
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        Mark Linimon <linimon@lonesome.com>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: list of ports broken by USB switchover?
Message-ID:  <200903011943.47410.hselasky@c2i.net>
In-Reply-To: <20090227171257.GA8408@lonesome.com>
References:  <20090227014400.GA27047@lonesome.com> <20090227100813.14l6mfo7tws04sw0@0x20.net> <20090227171257.GA8408@lonesome.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--Boundary-00=_jdtqJjIuCaEYJhA
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Friday 27 February 2009, Mark Linimon wrote:
> On Fri, Feb 27, 2009 at 10:08:13AM +0100, Lars Engels wrote:
> > multimedia/pwcbsd is broken. If I can find the new FreeBSD version I
> > will mark it broken for USB2.
>
> 800064
>
> mcl

Quick and dirty patch for "/usr/ports/devel/sdl12" is attached.

Here's one more:

.libs/SDL_sysjoystick.o
./src/joystick/bsd/SDL_sysjoystick.c: In function 'SDL_SYS_JoystickOpen':
./src/joystick/bsd/SDL_sysjoystick.c:297: error: 'USB_GET_REPORT_ID' 
undeclared 
(first use in this function)
./src/joystick/bsd/SDL_sysjoystick.c:297: error: (Each undeclared identifier 
is 
reported only once
./src/joystick/bsd/SDL_sysjoystick.c:297: error: for each function it appears 
in
.)
./src/joystick/bsd/SDL_sysjoystick.c: In function 'SDL_SYS_JoystickUpdate':
./src/joystick/bsd/SDL_sysjoystick.c:445: error: dereferencing pointer to 
incomp
lete type
./src/joystick/bsd/SDL_sysjoystick.c:469: error: dereferencing pointer to 
incomp
lete type
./src/joystick/bsd/SDL_sysjoystick.c:477: error: dereferencing pointer to 
incomp
lete type
./src/joystick/bsd/SDL_sysjoystick.c:485: error: dereferencing pointer to 
incomp


Solution:

Use new functions from libusbhid. See "man libusbhid" !

--HPS

--Boundary-00=_jdtqJjIuCaEYJhA
Content-Type: text/x-diff; charset="iso-8859-1"; name="SDL_sysjoystick.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="SDL_sysjoystick.c.diff"

--- work/SDL-1.2.13/./src/joystick/bsd/SDL_sysjoystick.c	2007-12-31 05:47:55.000000000 +0100
+++ ./SDL_sysjoystick.c	2009-03-01 19:06:23.000000000 +0100
@@ -36,24 +36,8 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#if defined(HAVE_USB_H)
-#include <usb.h>
-#endif
-#ifdef __DragonFly__
-#include <bus/usb/usb.h>
-#include <bus/usb/usbhid.h>
-#else
-#include <dev/usb/usb.h>
-#include <dev/usb/usbhid.h>
-#endif
-
-#if defined(HAVE_USBHID_H)
 #include <usbhid.h>
-#elif defined(HAVE_LIBUSB_H)
-#include <libusb.h>
-#elif defined(HAVE_LIBUSBHID_H)
-#include <libusbhid.h>
-#endif
+#include <dev/usb/usbhid.h>
 
 #ifdef __FREEBSD__
 #ifndef __DragonFly__
@@ -74,6 +58,11 @@
 #define MAX_JOY_JOYS	2
 #define MAX_JOYS	(MAX_UHID_JOYS + MAX_JOY_JOYS)
 
+struct usb_ctl_report {
+        int     ucr_report;
+        u_char  ucr_data[1024]; /* filled data size will vary */
+};
+
 struct report {
 	struct	usb_ctl_report *buf;	/* Buffer */
 	size_t	size;			/* Buffer size */
@@ -137,11 +126,7 @@
 static int	report_alloc(struct report *, struct report_desc *, int);
 static void	report_free(struct report *);
 
-#ifdef USBHID_UCR_DATA
 #define REP_BUF_DATA(rep) ((rep)->buf->ucr_data)
-#else
-#define REP_BUF_DATA(rep) ((rep)->buf->data)
-#endif
 
 int
 SDL_SYS_JoystickInit(void)
@@ -294,7 +279,8 @@
 	}
 
 	rep = &hw->inreport;
-	if (ioctl(fd, USB_GET_REPORT_ID, &rep->rid) < 0) {
+	rep->rid = hid_get_report_id(fd);
+	if (rep->rid < 0) {
 		rep->rid = -1; /* XXX */
 	}
 	if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) {
@@ -306,11 +292,7 @@
 		goto usberr;
 	}
 
-#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_version >= 500111)
 	hdata = hid_start_parse(hw->repdesc, 1 << hid_input, rep->rid);
-#else
-	hdata = hid_start_parse(hw->repdesc, 1 << hid_input);
-#endif
 	if (hdata == NULL) {
 		SDL_SetError("%s: Cannot start HID parser", hw->path);
 		goto usberr;
@@ -390,7 +372,7 @@
 	int nbutton, naxe = -1;
 	Sint32 v;
 
-#if defined(__FREEBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
+#if defined(__FreeBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
 	struct joystick gameport;
  
 	if (joy->hwdata->type == BSDJOY_JOY) {
@@ -445,11 +427,7 @@
 	if (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) != rep->size) {
 		return;
 	}
-#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_version >= 500111)
 	hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input, rep->rid);
-#else
-	hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input);
-#endif
 	if (hdata == NULL) {
 		fprintf(stderr, "%s: Cannot start HID parser\n",
 		    joy->hwdata->path);
@@ -538,25 +516,7 @@
 {
 	int len;
 
-#ifdef __DragonFly__
-	len = hid_report_size(rd, r->rid, repinfo[repind].kind);
-#elif __FREEBSD__
-# if (__FreeBSD_version >= 460000)
-#  if (__FreeBSD_version <= 500111)
-	len = hid_report_size(rd, r->rid, repinfo[repind].kind);
-#  else
-	len = hid_report_size(rd, repinfo[repind].kind, r->rid);
-#  endif
-# else
-	len = hid_report_size(rd, repinfo[repind].kind, &r->rid);
-# endif
-#else
-# ifdef USBHID_NEW
 	len = hid_report_size(rd, repinfo[repind].kind, r->rid);
-# else
-	len = hid_report_size(rd, repinfo[repind].kind, &r->rid);
-# endif
-#endif
 
 	if (len < 0) {
 		SDL_SetError("Negative HID report size");

--Boundary-00=_jdtqJjIuCaEYJhA--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903011943.47410.hselasky>