Skip site navigation (1)Skip section navigation (2)
Date:      Sun,  1 Mar 2009 22:15:10 -0900 (AKST)
From:      Mel Flynn <mel@rachie.is-a-geek.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        MAINTAINER <rene@FreeBSD.org>
Subject:   ports/132246: [PATCH] Make devel/libusb play nice with new usb2
Message-ID:  <20090302071510.3ADBB84443@smoochies.rachie.is-a-geek.net>
Resent-Message-ID: <200903020720.n227K1X7055141@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         132246
>Category:       ports
>Synopsis:       [PATCH] Make devel/libusb play nice with new usb2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 02 07:20:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Mel Flynn
>Release:        FreeBSD 8.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD smoochies.wlan.rachie.is-a-geek.net 8.0-CURRENT FreeBSD 8.0-CURRENT #1: Sat Feb 28 17:05:35 AKST 2009 mel@smoochies.wlan.rachie.is-a-geek.net:/usr/obj/usr/src/sys/SMOOCHIES i386


	
>Description:
Real fix is upstream, but for the time being, make this compile again.

>How-To-Repeat:
On -CURRENT with libusb2 imported, make -C /usr/ports/devel/libusb build.

NOTE: The __FreeBSD_version is a guess, since /usr/src/UPDATING doesn't
      mention it.
NOTE2: The #undef is necessary as configure will set this, proper fix lies
       probably in configure
>Fix:

	

--- patch-devel%usb%files%patch-bsd.c begins here ---
--- files/patch-bsd.c.orig	2008-11-14 00:52:21.000000000 -0900
+++ files/patch-bsd.c	2009-03-01 22:02:27.000000000 -0900
@@ -1,6 +1,28 @@
---- bsd.c.orig	2006-03-04 03:52:46.000000000 +0100
-+++ bsd.c	2008-11-03 00:08:15.000000000 +0100
-@@ -408,7 +408,7 @@
+--- bsd.c.orig	2006-03-03 17:52:46.000000000 -0900
++++ bsd.c	2009-03-01 21:58:46.000000000 -0900
+@@ -39,13 +39,21 @@
+ #include <sys/time.h>
+ #include <sys/ioctl.h>
+ 
++#include <sys/param.h>
++#if __FreeBSD_version+0 >= 800061
++#include <legacy/dev/usb/usb.h>
++#else
+ #include <dev/usb/usb.h>
++#endif
+ 
+ #include "usbi.h"
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+ 
++#if __FreeBSD_version+0 >= 800061 && defined(HAVE_OLD_DEV_USB_USB_H)
++#undef HAVE_OLD_DEV_USB_USB_H
++#endif
+ #ifdef HAVE_OLD_DEV_USB_USB_H
+ /*
+  * It appears some of the BSD's (OpenBSD atleast) have switched over to a
+@@ -408,7 +416,7 @@
    /* Ensure the endpoint address is correct */
    ep |= USB_ENDPOINT_IN;
  
@@ -9,7 +31,7 @@
    if (fd < 0) {
      if (usb_debug >= 2) {
  #ifdef __FreeBSD_kernel__
-@@ -477,7 +477,7 @@
+@@ -477,7 +485,7 @@
      USB_ERROR_STR(-errno, "error sending control message: %s",
                    strerror(errno));
  
@@ -18,7 +40,7 @@
  }
  
  int usb_os_find_busses(struct usb_bus **busses)
-@@ -623,9 +623,21 @@
+@@ -623,9 +631,21 @@
  
  int usb_clear_halt(usb_dev_handle *dev, unsigned int ep)
  {
@@ -33,11 +55,11 @@
 +  USETW(ctl_req.ucr_request.wIndex, ep);
 +  USETW(ctl_req.ucr_request.wLength, 0);
 +  ctl_req.ucr_flags = 0;
-+
-+  if ((ret = ioctl(dev->fd, USB_DO_REQUEST, &ctl_req)) < 0)
-+      USB_ERROR_STR(-errno, "clear_halt:  failed for %d", ep);
  
 -  USB_ERROR_STR(-ENOSYS, "usb_clear_halt called, unimplemented on BSD");
++  if ((ret = ioctl(dev->fd, USB_DO_REQUEST, &ctl_req)) < 0)
++      USB_ERROR_STR(-errno, "clear_halt:  failed for %d", ep);
++
 +  return ret;
  }
  
--- patch-devel%usb%files%patch-bsd.c ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



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