From owner-svn-src-all@FreeBSD.ORG Tue Jun 2 17:27:52 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 210DF106566B; Tue, 2 Jun 2009 17:27:52 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E94B8FC17; Tue, 2 Jun 2009 17:27:52 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n52HRp2r022011; Tue, 2 Jun 2009 17:27:51 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n52HRpwa022008; Tue, 2 Jun 2009 17:27:51 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200906021727.n52HRpwa022008@svn.freebsd.org> From: Andrew Thompson Date: Tue, 2 Jun 2009 17:27:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193313 - head/lib/libusb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jun 2009 17:27:52 -0000 Author: thompsa Date: Tue Jun 2 17:27:51 2009 New Revision: 193313 URL: http://svn.freebsd.org/changeset/base/193313 Log: Add libusb20_tr_get_length to get the transfer length. Submitted by: Hans Petter Selasky Modified: head/lib/libusb/libusb.3 head/lib/libusb/libusb20.c head/lib/libusb/libusb20.h Modified: head/lib/libusb/libusb.3 ============================================================================== --- head/lib/libusb/libusb.3 Tue Jun 2 16:57:27 2009 (r193312) +++ head/lib/libusb/libusb.3 Tue Jun 2 17:27:51 2009 (r193313) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 21, 2009 +.Dd May 28, 2009 .Dt LIBUSB 3 .Os .Sh NAME @@ -78,6 +78,8 @@ USB access library (libusb -lusb) .Fn libusb20_tr_set_callback "struct libusb20_transfer *xfer" "libusb20_tr_callback_t *cb" .Ft void .Fn libusb20_tr_set_flags "struct libusb20_transfer *xfer" "uint8_t flags" +.Ft uint32_t +.Fn libusb20_tr_get_length "struct libusb20_transfer *xfer" "uint16_t fr_index" .Ft void .Fn libusb20_tr_set_length "struct libusb20_transfer *xfer" "uint32_t length" "uint16_t fr_index" .Ft void @@ -183,6 +185,10 @@ USB access library (libusb -lusb) .Ft int .Fn libusb20_be_remove_dev_quirk "struct libusb20_backend *pbe" "struct libusb20_quirk *pq" .Ft struct libusb20_backend * +.Fn libusb20_be_alloc_default "void" +.Ft struct libusb20_backend * +.Fn libusb20_be_alloc_freebsd "void" +.Ft struct libusb20_backend * .Fn libusb20_be_alloc_linux "void" .Ft struct libusb20_device * .Fn libusb20_be_device_foreach "struct libusb20_backend *pbe" "struct libusb20_device *pdev" @@ -227,7 +233,7 @@ Non-zero return values indicate a LIBUSB .Pp . .Fn libusb20_tr_open -will allocate kernel resources like +will allocate kernel buffer resources according to .Fa max_buf_size and .Fa max_frame_count @@ -235,6 +241,18 @@ associated with an USB .Fa pxfer and bind the transfer to the specified .Fa ep_no . +.Fa max_buf_size +is the minimum buffer size which the data transport layer has to support. +If +.Fa max_buf_size +is zero, the +.Nm +library will use wMaxPacketSize to compute the buffer size. +This can be useful for isochronous transfers. +The actual buffer size can be greater than +.Fa max_buf_size +and is returned by +.Fn libusb20_tr_get_max_total_length . . This function returns zero upon success. . @@ -367,8 +385,14 @@ Will do a clear-stall before starting th . .Pp . +.Fn libusb20_tr_get_length +returns the length of the given USB frame by index. +After an USB transfer is complete the USB frame length will get updated to the actual transferred length. +. +.Pp +. .Fn libusb20_tr_set_length -sets the length of a given USB transfer and frame index. +sets the length of the given USB frame by index. . .Pp . @@ -750,7 +774,7 @@ function will wait until a pending USB t the given USB device. . A timeout value can be specified which is passed on to the -.Xr 2 poll +.Xr poll 2 function. . .Sh USB BACKEND OPERATIONS @@ -829,6 +853,10 @@ returned. If the given quirk does not exist LIBUSB20_ERROR_NOT_FOUND is returned. . +.Pp +. +.Fn libusb20_be_alloc_default +.Fn libusb20_be_alloc_freebsd .Fn libusb20_be_alloc_linux These functions are used to allocate a specific USB backend or the operating system default USB backend. Allocating a backend is a way to Modified: head/lib/libusb/libusb20.c ============================================================================== --- head/lib/libusb/libusb20.c Tue Jun 2 16:57:27 2009 (r193312) +++ head/lib/libusb/libusb20.c Tue Jun 2 17:27:51 2009 (r193313) @@ -319,6 +319,12 @@ libusb20_tr_set_flags(struct libusb20_tr return; } +uint32_t +libusb20_tr_get_length(struct libusb20_transfer *xfer, uint16_t frIndex) +{ + return (xfer->pLength[frIndex]); +} + void libusb20_tr_set_length(struct libusb20_transfer *xfer, uint32_t length, uint16_t frIndex) { Modified: head/lib/libusb/libusb20.h ============================================================================== --- head/lib/libusb/libusb20.h Tue Jun 2 16:57:27 2009 (r193312) +++ head/lib/libusb/libusb20.h Tue Jun 2 17:27:51 2009 (r193313) @@ -216,6 +216,7 @@ void libusb20_tr_drain(struct libusb20_t void libusb20_tr_set_buffer(struct libusb20_transfer *xfer, void *buffer, uint16_t fr_index); void libusb20_tr_set_callback(struct libusb20_transfer *xfer, libusb20_tr_callback_t *cb); void libusb20_tr_set_flags(struct libusb20_transfer *xfer, uint8_t flags); +uint32_t libusb20_tr_get_length(struct libusb20_transfer *xfer, uint16_t fr_index); void libusb20_tr_set_length(struct libusb20_transfer *xfer, uint32_t length, uint16_t fr_index); void libusb20_tr_set_priv_sc0(struct libusb20_transfer *xfer, void *sc0); void libusb20_tr_set_priv_sc1(struct libusb20_transfer *xfer, void *sc1);