From yuri.pankov@gmail.com  Fri Feb 27 03:49:35 2009
Return-Path: <yuri.pankov@gmail.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0C0811065670
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 27 Feb 2009 03:49:35 +0000 (UTC)
	(envelope-from yuri.pankov@gmail.com)
Received: from mail-ew0-f166.google.com (mail-ew0-f166.google.com [209.85.219.166])
	by mx1.freebsd.org (Postfix) with ESMTP id 3AD988FC08
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 27 Feb 2009 03:49:34 +0000 (UTC)
	(envelope-from yuri.pankov@gmail.com)
Received: by ewy10 with SMTP id 10so1002873ewy.43
        for <multiple recipients>; Thu, 26 Feb 2009 19:49:33 -0800 (PST)
Received: by 10.210.21.13 with SMTP id 13mr75702ebu.43.1235706573348;
        Thu, 26 Feb 2009 19:49:33 -0800 (PST)
Received: from darklight.homeunix.org ([85.175.25.104])
        by mx.google.com with ESMTPS id 35sm1074981nfu.7.2009.02.26.19.49.32
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Thu, 26 Feb 2009 19:49:32 -0800 (PST)
Received: from darklight.homeunix.org (darklight.homeunix.org [127.0.0.1])
	by darklight.homeunix.org (8.14.3/8.14.3) with ESMTP id n1R3nTw7028082;
	Fri, 27 Feb 2009 06:49:30 +0300 (MSK)
	(envelope-from yuri.pankov@gmail.com)
Received: (from yuri@localhost)
	by darklight.homeunix.org (8.14.3/8.14.3/Submit) id n1R3nTh1028081;
	Fri, 27 Feb 2009 06:49:29 +0300 (MSK)
	(envelope-from yuri.pankov@gmail.com)
Message-Id: <200902270349.n1R3nTh1028081@darklight.homeunix.org>
Date: Fri, 27 Feb 2009 06:49:29 +0300 (MSK)
From: Yuri Pankov <yuri.pankov@gmail.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: mva@freebsd.org
Subject: [PATCH] devel/sdl: fix build with new usb stack
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         132150
>Category:       ports
>Synopsis:       [PATCH] devel/sdl: fix build with new usb stack
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    mva
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 27 03:50:01 UTC 2009
>Closed-Date:    Fri Mar 13 16:36:41 UTC 2009
>Last-Modified:  Fri Mar 13 16:40:01 UTC 2009
>Originator:     Yuri Pankov
>Release:        FreeBSD 8.0-CURRENT amd64
>Organization:
>Environment:
System: FreeBSD darklight.homeunix.org 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Wed Feb 25 13:03:56 MSK 2009
>Description:
Fix build with new usb stack.

Added file(s):
- files/usb2

Port maintainer (mva@FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.77
>How-To-Repeat:
>Fix:

--- sdl-1.2.13_3,2.patch begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/devel/sdl12/Makefile,v
retrieving revision 1.115
diff -u -r1.115 Makefile
--- Makefile	19 Feb 2009 21:45:39 -0000	1.115
+++ Makefile	27 Feb 2009 03:44:45 -0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	sdl
 PORTVERSION=	1.2.13
-PORTREVISION=	2
+PORTREVISION=	3
 PORTEPOCH=	2
 CATEGORIES=	devel
 MASTER_SITES=	http://www.libsdl.org/release/
@@ -62,6 +62,11 @@
 
 .include <bsd.port.pre.mk>
 
+.if ${OSVERSION} >= 800064
+CFLAGS+=	-DUSBHID_UCR_DATA
+EXTRA_PATCHES+=	${FILESDIR}/usb2
+.endif
+
 MAN3!=		${CAT} ${FILESDIR}/man3
 
 .if defined(WITHOUT_AALIB)
Index: files/usb2
===================================================================
RCS file: files/usb2
diff -N files/usb2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/usb2	27 Feb 2009 03:44:45 -0000
@@ -0,0 +1,22 @@
+--- src/joystick/bsd/SDL_sysjoystick.c.orig	2007-12-31 07:47:55.000000000 +0300
++++ src/joystick/bsd/SDL_sysjoystick.c	2009-02-27 06:12:54.503954886 +0300
+@@ -45,6 +45,7 @@
+ #else
+ #include <dev/usb/usb.h>
+ #include <dev/usb/usbhid.h>
++#include <dev/usb/usb_ioctl.h>
+ #endif
+ 
+ #if defined(HAVE_USBHID_H)
+@@ -74,6 +75,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 */
--- sdl-1.2.13_3,2.patch ends here ---

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->mva 
Responsible-Changed-By: mva 
Responsible-Changed-When: Fri Feb 27 18:43:57 UTC 2009 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=132150 

From: Mark Linimon <linimon@lonesome.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/132150: [PATCH] devel/sdl: fix build with new usb stack
Date: Sun, 1 Mar 2009 19:08:03 -0600

 Here's an alternative patch posted to the mailing lists by hps.
 
 mcl
 
 ----- Forwarded message from Hans Petter Selasky <hselasky@c2i.net> -----
 
 From: Hans Petter Selasky <hselasky@c2i.net>
 To: Mark Linimon <linimon@lonesome.com>
 Subject: Re: list of ports broken by USB switchover?
 Cc: freebsd-ports@freebsd.org
 
 Quick and dirty patch for "/usr/ports/devel/sdl12" is attached.
 
 .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
 
 --- 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");
 
 
 ----- End forwarded message -----

From: Yuri Pankov <yuri.pankov@gmail.com>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: ports/132150: [PATCH] devel/sdl: fix build with new usb stack
Date: Wed, 4 Mar 2009 04:53:22 +0300

 Please close this PR, another fix was already comitted.

From: Stanislav Sedov <stas@FreeBSD.org>
To: Yuri Pankov <yuri.pankov@gmail.com>
Cc: mva@FreeBSD.org, bug-followup@FreeBSD.org
Subject: Re: ports/132150: [PATCH] devel/sdl: fix build with new usb stack
Date: Sun, 8 Mar 2009 12:19:38 +0300

 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 Hi!
 
 I think the patch proposed by hps should be commited, as
 it fixes joysticks with SDL, while the current solution
 is to disable it, which is a regression.
 
 - -- 
 Stanislav Sedov
 ST4096-RIPE
 -----BEGIN PGP SIGNATURE-----
 
 iEYEARECAAYFAkmzjaoACgkQK/VZk+smlYHAfgCcD6rPPuGI3veRBsLhp2Kta5I3
 /T8AnAlRmMS/knfWMNG5RzhMUj3TI8LN
 =dUt0
 -----END PGP SIGNATURE-----
 
 !DSPAM:49b38d92967001875713468!
 
 

From: Marcus von Appen <mva@FreeBSD.org>
To: Stanislav Sedov <stas@FreeBSD.org>
Cc: Yuri Pankov <yuri.pankov@gmail.com>, bug-followup@FreeBSD.org
Subject: Re: ports/132150: [PATCH] devel/sdl: fix build with new usb stack
Date: Sun, 8 Mar 2009 23:25:46 +0100

 --sdtB3X0nJg68CQEu
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 On, Sun Mar 08, 2009, Stanislav Sedov wrote:
 
 > Hi!
 >=20
 > I think the patch proposed by hps should be commited, as
 > it fixes joysticks with SDL, while the current solution
 > is to disable it, which is a regression.
 
 Unfortunately hps' patch is untested, which is why I'm currently working
 on a proper tested version that should be ready soon. Until then I'll
 leave this open for reference.
 
 Regards
 Marcus
 
 --sdtB3X0nJg68CQEu
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.9 (FreeBSD)
 
 iEYEARECAAYFAkm0ReoACgkQi68/ErJnpkf69wCfbICwU9cVKcxd/ksDZiO3q2BZ
 CDgAoKkcLpDI88CpTURRpvs0qjA+HXuv
 =TwMF
 -----END PGP SIGNATURE-----
 
 --sdtB3X0nJg68CQEu--
State-Changed-From-To: open->closed 
State-Changed-By: mva 
State-Changed-When: Fri Mar 13 16:36:40 UTC 2009 
State-Changed-Why:  
Committed, with minor changes. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=132150 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/132150: commit references a PR
Date: Fri, 13 Mar 2009 16:33:16 +0000 (UTC)

 mva         2009-03-13 16:32:58 UTC
 
   FreeBSD ports repository
 
   Modified files:
     devel/sdl12          Makefile 
   Added files:
     devel/sdl12/files    patch-src_joystick_bsd_SDL_sysjoystick.c 
   Log:
   Reactivate USB joystick support on -CURRENT.
   
   PR:     ports/132150
   Submitted by:   hps
   Approved by:    miwi (mentor)
   
   Revision  Changes    Path
   1.118     +1 -5      ports/devel/sdl12/Makefile
   1.1       +40 -0     ports/devel/sdl12/files/patch-src_joystick_bsd_SDL_sysjoystick.c (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
