From owner-freebsd-usb@FreeBSD.ORG Fri Jul 23 18:59:42 2010 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 134CA106566C for ; Fri, 23 Jul 2010 18:59:42 +0000 (UTC) (envelope-from peerst@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 9CC2D8FC1E for ; Fri, 23 Jul 2010 18:59:41 +0000 (UTC) Received: by wyj26 with SMTP id 26so605772wyj.13 for ; Fri, 23 Jul 2010 11:59:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=AUyHGMwS/b8tyzSkLqXQCUJ9Ac+qN2dZhF/y9QkH3fA=; b=BlTlw5xQjI5J/VMR2KhJZxXFFL2+Q/+4weeVM6vIgs1hKvUPr5lhFoo8T5CxmVvEYI w1u3Uo7EuTEyVVLZpBUm/ONo12sC6BlYrCJTdKq+Ax/0RQ4emmrbR9S6nZz5MHgYZpZY gOpVYd//hoaxSj0sL/L2MD54BSpBD4BWJCaA0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=LCNy+gYQWNrTgIhAa58R/YGQE1eYhXI7/DpMjFio4mxzYzH2nm9w6ZLn4vTxxG3wEF oADRbMW3vbB0RJd4NlIoctd0FyKmdMSkzFSJlsg0e7Zu8idzCsFH9Rmkhw0rq7sElzEB BhaNyTkzf2SVwRU2+BUURwr+qzcq4SeneyWX8= MIME-Version: 1.0 Received: by 10.227.37.8 with SMTP id v8mr3930510wbd.37.1279911580515; Fri, 23 Jul 2010 11:59:40 -0700 (PDT) Received: by 10.227.1.225 with HTTP; Fri, 23 Jul 2010 11:59:40 -0700 (PDT) In-Reply-To: <201007231921.45803.hselasky@c2i.net> References: <201007231657.47682.hselasky@c2i.net> <201007231921.45803.hselasky@c2i.net> Date: Fri, 23 Jul 2010 20:59:40 +0200 Message-ID: From: Peer Stritzinger To: Hans Petter Selasky Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-usb@freebsd.org Subject: Re: FreeBSD 8: libusb async mode + select(2) = nogo? X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jul 2010 18:59:42 -0000 On Fri, Jul 23, 2010 at 7:21 PM, Hans Petter Selasky wrote: > Should work, but it might be that the second poll, when you try to process the > events, don't work like expected. After any event on the two fd's you should > call "libusb_handle_events_locked()" using a "tv = NULL". With libusb_handle_events_locked() instead of libusb_handle_events_timeout() there is no improvement ... It looks like if there is a IN alread pending on the bus when program runs the first select call returns the filedesc correctly but after this nothing triggers the second select. At least most of the time it looks like IN transfers that are received during the second select are somehow swallowed unhandled. If there is no IN pending on the bus the first select also returns but libusb_handle_events_locked() doesn't call a callback, then the second select also fails. Regards -- Peer Could it be that after the poll() in lib_usb_handle_events_*() libusb or the usb stack is somewhat in a corrupt state?