From owner-freebsd-ports-bugs@FreeBSD.ORG  Sun Jan  9 08:50:03 2011
Return-Path: <owner-freebsd-ports-bugs@FreeBSD.ORG>
Delivered-To: freebsd-ports-bugs@hub.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A0CC2106566B
	for <freebsd-ports-bugs@hub.freebsd.org>;
	Sun,  9 Jan 2011 08:50:03 +0000 (UTC)
	(envelope-from gnats@FreeBSD.org)
Received: from freefall.freebsd.org (freefall.freebsd.org
	[IPv6:2001:4f8:fff6::28])
	by mx1.freebsd.org (Postfix) with ESMTP id 625888FC15
	for <freebsd-ports-bugs@hub.freebsd.org>;
	Sun,  9 Jan 2011 08:50:03 +0000 (UTC)
Received: from freefall.freebsd.org (localhost [127.0.0.1])
	by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p098o36r070604
	for <freebsd-ports-bugs@freefall.freebsd.org>;
	Sun, 9 Jan 2011 08:50:03 GMT
	(envelope-from gnats@freefall.freebsd.org)
Received: (from gnats@localhost)
	by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p098o3sF070603;
	Sun, 9 Jan 2011 08:50:03 GMT (envelope-from gnats)
Resent-Date: Sun, 9 Jan 2011 08:50:03 GMT
Resent-Message-Id: <201101090850.p098o3sF070603@freefall.freebsd.org>
Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer)
Resent-To: freebsd-ports-bugs@FreeBSD.org
Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org,
	Simon Walton <simonw@matteworld.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 12EA91065673
	for <freebsd-gnats-submit@FreeBSD.org>;
	Sun,  9 Jan 2011 08:43:03 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (unknown [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 02CE98FC14
	for <freebsd-gnats-submit@FreeBSD.org>;
	Sun,  9 Jan 2011 08:43:03 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p098h2jG018255
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 9 Jan 2011 08:43:02 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p098h2Dt018254;
	Sun, 9 Jan 2011 08:43:02 GMT (envelope-from nobody)
Message-Id: <201101090843.p098h2Dt018254@red.freebsd.org>
Date: Sun, 9 Jan 2011 08:43:02 GMT
From: Simon Walton <simonw@matteworld.com>
To: freebsd-gnats-submit@FreeBSD.org
X-Send-Pr-Version: www-3.1
Cc: 
Subject: ports/153810: [PATCH] Fix usb_interrupt_read() in libusb for fbsd 7
X-BeenThere: freebsd-ports-bugs@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Ports bug reports <freebsd-ports-bugs.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs>, 
	<mailto:freebsd-ports-bugs-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-ports-bugs>
List-Post: <mailto:freebsd-ports-bugs@freebsd.org>
List-Help: <mailto:freebsd-ports-bugs-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs>, 
	<mailto:freebsd-ports-bugs-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 09 Jan 2011 08:50:03 -0000


>Number:         153810
>Category:       ports
>Synopsis:       [PATCH] Fix usb_interrupt_read() in libusb for fbsd 7
>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:   Sun Jan 09 08:50:03 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Simon Walton
>Release:        7.2
>Organization:
Matte World Digital
>Environment:
FreeBSD stepney 7.2-RELEASE FreeBSD 7.2-RELEASE #4: Sun Aug 22 22:37:09 PDT 2010     simonw@stepney:/usr/src/sys/i386/compile/STEPNEY  i386

>Description:
Current libusb 0.1 in ports opens the interrupt endpoint with the NONBLOCK
flag in usb_interrupt_read(). In freebsd 7.2 reads will always fail with
EAGAIN (aka EWOULDBLOCK).
>How-To-Repeat:
An app that attempts to read a USB device's interrupt channel will
always fail. In my case the app was Argyll CMS controlling a USB
monitor probe.
>Fix:
Apply patch. Note that this just reverts an existing patch to libusb. The
original patch was indicated for fixing communication with a UPS. It
may have been necessary when timeouts for interrupt reads were broken.

Patch attached with submission follows:

--- libusb/files/patch-bsd.c.orig	2011-01-09 00:19:17.000000000 -0800
+++ libusb/files/patch-bsd.c	2011-01-09 00:20:29.000000000 -0800
@@ -1,14 +1,5 @@
 --- 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 @@
-   /* Ensure the endpoint address is correct */
-   ep |= USB_ENDPOINT_IN;
- 
--  fd = ensure_ep_open(dev, ep, O_RDONLY);
-+  fd = ensure_ep_open(dev, ep, O_RDONLY | O_NONBLOCK);
-   if (fd < 0) {
-     if (usb_debug >= 2) {
- #ifdef __FreeBSD_kernel__
 @@ -477,7 +477,7 @@
      USB_ERROR_STR(-errno, "error sending control message: %s",
                    strerror(errno));


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