From owner-freebsd-questions@FreeBSD.ORG Tue Dec 7 17:37:30 2010 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E48EF106566B for ; Tue, 7 Dec 2010 17:37:30 +0000 (UTC) (envelope-from mcgovern@spoon.beta.com) Received: from spoon.beta.com (spoon.beta.com [199.165.180.2]) by mx1.freebsd.org (Postfix) with ESMTP id 7A98F8FC12 for ; Tue, 7 Dec 2010 17:37:30 +0000 (UTC) Received: from spoon.beta.com (localhost [127.0.0.1]) by spoon.beta.com (8.14.4/8.14.4) with ESMTP id oB7H2FOQ002973 for ; Tue, 7 Dec 2010 12:02:15 -0500 (EST) (envelope-from mcgovern@spoon.beta.com) Received: (from mcgovern@localhost) by spoon.beta.com (8.14.4/8.14.4/Submit) id oB7H2F03002972 for questions@freebsd.org; Tue, 7 Dec 2010 12:02:15 -0500 (EST) (envelope-from mcgovern) Date: Tue, 7 Dec 2010 12:02:15 -0500 (EST) From: "Brian J. McGovern" Message-Id: <201012071702.oB7H2F03002972@spoon.beta.com> To: questions@freebsd.org X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on spoon.beta.com Cc: Subject: USB Stack/# of bytes to read? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Dec 2010 17:37:31 -0000 All, I have a couple of quick questions about the USB stack in 8.x that I'm hoping someone with a bit more experience than I can answer. I am currently working on a device driver for a Velleman K8055 board. Basically, it does digital and analog I/O under the control of a PC via USB. I've got the basic driver working fine, and I'm moving data back and forth without issue. What I'd like to be able to do, however, is poll the driver to see how much data is sitting in the input buffer, or at least see how many packet/buffers are waiting. Looking through the control structures, it appears that something like sc->fifo.fp[USB_FIFO_TX]->used_q.ifq_len would be the right field, but it never appears to be set anywhere (and is always 0). Using something like USB_IF_POLL() on the used_q suggests there is something to write, but not how much. On a similar line of thinking, how about flushing the queue entirely? Should I call usb_fifo_reset() directly? Or should I just reimplement the logic? -B