diff options
author | thompsa <thompsa@FreeBSD.org> | 2009-06-02 17:27:51 +0000 |
---|---|---|
committer | thompsa <thompsa@FreeBSD.org> | 2009-06-02 17:27:51 +0000 |
commit | 6425a0a49f1c41f6590ed3c281f8909459863927 (patch) | |
tree | 9a8dbac22593d47246fb93f64ff59fe60e46010f /lib/libusb | |
parent | 879660c80273fd40883038a11364bbc0ec9798ae (diff) | |
download | FreeBSD-src-6425a0a49f1c41f6590ed3c281f8909459863927.zip FreeBSD-src-6425a0a49f1c41f6590ed3c281f8909459863927.tar.gz |
Add libusb20_tr_get_length to get the transfer length.
Submitted by: Hans Petter Selasky
Diffstat (limited to 'lib/libusb')
-rw-r--r-- | lib/libusb/libusb.3 | 36 | ||||
-rw-r--r-- | lib/libusb/libusb20.c | 6 | ||||
-rw-r--r-- | lib/libusb/libusb20.h | 1 |
3 files changed, 39 insertions, 4 deletions
diff --git a/lib/libusb/libusb.3 b/lib/libusb/libusb.3 index 2fb717f..90f0c14 100644 --- a/lib/libusb/libusb.3 +++ b/lib/libusb/libusb.3 @@ -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 LIBUSB20_ERROR value. .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 the transfer. . .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 transfer has completed on 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 diff --git a/lib/libusb/libusb20.c b/lib/libusb/libusb20.c index 0c80c8b..f684bef 100644 --- a/lib/libusb/libusb20.c +++ b/lib/libusb/libusb20.c @@ -319,6 +319,12 @@ libusb20_tr_set_flags(struct libusb20_transfer *xfer, uint8_t flags) 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) { diff --git a/lib/libusb/libusb20.h b/lib/libusb/libusb20.h index 8a46feb..1614111 100644 --- a/lib/libusb/libusb20.h +++ b/lib/libusb/libusb20.h @@ -216,6 +216,7 @@ void libusb20_tr_drain(struct libusb20_transfer *xfer); 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); |