From owner-freebsd-usb@FreeBSD.ORG Sun Jan 22 15:02:37 2006 Return-Path: X-Original-To: freebsd-usb@freebsd.org Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0C47E16A41F for ; Sun, 22 Jan 2006 15:02:37 +0000 (GMT) (envelope-from rab@mall.freebsdmall.com) Received: from mail.freebsdmall.com (ns1.freebsdmall.com [69.50.233.146]) by mx1.FreeBSD.org (Postfix) with ESMTP id DA44543D45 for ; Sun, 22 Jan 2006 15:02:36 +0000 (GMT) (envelope-from rab@mall.freebsdmall.com) Received: from mall.freebsdmall.com (localhost [127.0.0.1]) by mail.freebsdmall.com (Postfix) with ESMTP id CF2A11CDCF; Sun, 22 Jan 2006 07:02:36 -0800 (PST) To: freebsd-usb@freebsd.org Date: Sun, 22 Jan 2006 07:02:36 -0800 From: Robert Bruce Message-Id: <20060122150236.CF2A11CDCF@mail.freebsdmall.com> Cc: Subject: Non-blocking I/O on bulk endpoints 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: Sun, 22 Jan 2006 15:02:37 -0000 If I open a USB endpoint with the O_NONBLOCK bit set, it works okay if it is an "interrupt" endpoint, and will return EWOULDBLOCK for a read() if there is no data. But if it is a "bulk" endpoint, the read() will block. So I tried using select() to find out if there was data available before trying to read it. But select() seems to work properly only for "interrupt" endpoints. On a "bulk" endpoint, select() always reports that there is data ready to be read, even when there is not. Is there any way to do non-blocking I/O on a bulk endpoint? I looked at sys/dev/usb/ugen.c, and it looks like non-blocking I/O is intentionally left out for bulk endpoints. So maybe there is something that makes it difficult to implement. I am running FreeBSD 6.0, on an AMD64, if that makes any difference. -bob