libusb.3 (f1b5fa6e496ae0eb2a3a60ecd613ff92d432e5b9) libusb.3 (698e791af5804cd81e429c07e5901d5c52864068)
1.\"
2.\" Copyright (c) 2009 Sylvestre Gallon
3.\"
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:

--- 12 unchanged lines hidden (view full) ---

21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.\" $FreeBSD$
28.\"
1.\"
2.\" Copyright (c) 2009 Sylvestre Gallon
3.\"
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:

--- 12 unchanged lines hidden (view full) ---

21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.\" $FreeBSD$
28.\"
29.Dd June 22, 2009
29.Dd October 14, 2010
30.Dt LIBUSB 3
31.Os
32.Sh NAME
33.Nm libusb
34.
35.Nd "USB access library"
36.
37.

--- 29 unchanged lines hidden (view full) ---

67.Pp
68.
69.Ft void
70.Fn libusb_exit "libusb_context *ctx"
71Deinitialise libusb. Must be called at the end of the application.
72.
73.Pp
74.
30.Dt LIBUSB 3
31.Os
32.Sh NAME
33.Nm libusb
34.
35.Nd "USB access library"
36.
37.

--- 29 unchanged lines hidden (view full) ---

67.Pp
68.
69.Ft void
70.Fn libusb_exit "libusb_context *ctx"
71Deinitialise libusb. Must be called at the end of the application.
72.
73.Pp
74.
75.Ft const char *
76.Fn libusb_strerror "int code"
77Get ASCII representation of the error given by the
78.Fa code
79argument.
80.
81.
82.Pp
83.
75.Ft void
76.Fn libusb_set_debug "libusb_context *ctx" "int level"
77Set debug to the
78.Fa level
79level.
80.
81.Pp
82.

--- 159 unchanged lines hidden (view full) ---

242.Fn libusb_kernel_driver_active "libusb_device_handle *devh" "int interface"
243Determine if a driver is active on a interface. Returns 0 if no kernel driver
244is active, returns 1 if a kernel driver is active, returns LIBUSB_ERROR_NO_DEVICE
245if the device has been disconnected and return a LIBUSB_ERROR code on failure.
246.
247.Pp
248.
249.Ft int
84.Ft void
85.Fn libusb_set_debug "libusb_context *ctx" "int level"
86Set debug to the
87.Fa level
88level.
89.
90.Pp
91.

--- 159 unchanged lines hidden (view full) ---

251.Fn libusb_kernel_driver_active "libusb_device_handle *devh" "int interface"
252Determine if a driver is active on a interface. Returns 0 if no kernel driver
253is active, returns 1 if a kernel driver is active, returns LIBUSB_ERROR_NO_DEVICE
254if the device has been disconnected and return a LIBUSB_ERROR code on failure.
255.
256.Pp
257.
258.Ft int
259.Fn libusb_get_driver "libusb_device_handle *devh" "int interface" "char *name" "int namelen"
260or
261.Ft int
262.Fn libusb_get_driver_np "libusb_device_handle *devh" "int interface" "char *name" "int namelen"
263Gets the name of the driver attached to the given
264.Fa device
265and
266.Fa interface
267into the buffer given by
268.Fa name
269and
270.Fa namelen .
271Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver is attached
272to the given interface and LIBUSB_ERROR_INVALID_PARAM if the interface does
273not exist.
274This function is non-portable.
275The buffer pointed to by
276.Fa name
277is only zero terminated on success.
278.
279.Pp
280.
281.Ft int
250.Fn libusb_detach_kernel_driver "libusb_device_handle *devh" "int interface"
282.Fn libusb_detach_kernel_driver "libusb_device_handle *devh" "int interface"
251Detach a kernel driver from an interface. This is needed to claim an interface
252required by a kernel driver. Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if
253no kernel driver was active, LIBUSB_ERROR_INVALID_PARAM if the interface does not
254exist, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a
255LIBUSB_ERROR code on failure.
283or
284.Ft int
285.Fn libusb_detach_kernel_driver_np "libusb_device_handle *devh" "int interface"
286Detach a kernel driver from an interface.
287This is needed to claim an interface required by a kernel driver.
288Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver was active,
289LIBUSB_ERROR_INVALID_PARAM if the interface does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on failure. This function is non-portable.
256.
257.Pp
258.
259.Ft int
260.Fn libusb_attach_kernel_driver "libusb_device_handle *devh" "int interface"
261Re-attach an interface kernel driver previously detached. Returns 0 on success,
262LIBUSB_ERROR_INVALID_PARAM if the interface does not exist, LIBUSB_ERROR_NO_DEVICE
263if the device has been disconnect, LIBUSB_ERROR_BUSY if the driver cannot be

--- 10 unchanged lines hidden (view full) ---

274.Fn libusb_get_device_descriptor "libusb_device *dev" "libusb_device_descriptor *desc"
275Get the USB device descriptor for the device
276.Fa dev.
277This is a non-blocking function. Returns 0 on success and a LIBUSB_ERROR code on
278failure.
279.
280.Pp
281.Ft int
290.
291.Pp
292.
293.Ft int
294.Fn libusb_attach_kernel_driver "libusb_device_handle *devh" "int interface"
295Re-attach an interface kernel driver previously detached. Returns 0 on success,
296LIBUSB_ERROR_INVALID_PARAM if the interface does not exist, LIBUSB_ERROR_NO_DEVICE
297if the device has been disconnect, LIBUSB_ERROR_BUSY if the driver cannot be

--- 10 unchanged lines hidden (view full) ---

308.Fn libusb_get_device_descriptor "libusb_device *dev" "libusb_device_descriptor *desc"
309Get the USB device descriptor for the device
310.Fa dev.
311This is a non-blocking function. Returns 0 on success and a LIBUSB_ERROR code on
312failure.
313.
314.Pp
315.Ft int
282.Fn libsub_get_active_config_descriptor "libusb_device *dev" "libusb_device_descriptor **config"
316.Fn libsub_get_active_config_descriptor "libusb_device *dev" "struct libusb_config_descriptor **config"
283Get the USB configuration descriptor for the active configuration. Returns 0 on
284success, returns LIBUSB_ERROR_NOT_FOUND if the device is in unconfigured state
285and return another LIBUSB_ERROR code on error.
286.
287.Pp
288.Ft int
289.Fn libusb_get_config_descriptor "libusb_device *dev" "uint8_t config_index" "libusb_config_descriptor **config"
290Get USB configuration descriptor based on its index

--- 49 unchanged lines hidden (view full) ---

340This function asynchronously cancel a transfer. Returns 0 on success and
341LIBUSB_ERROR code on failure.
342.
343.Pp
344.Sh USB SYNCHRONOUS I/O
345.
346.Pp
347.Ft int
317Get the USB configuration descriptor for the active configuration. Returns 0 on
318success, returns LIBUSB_ERROR_NOT_FOUND if the device is in unconfigured state
319and return another LIBUSB_ERROR code on error.
320.
321.Pp
322.Ft int
323.Fn libusb_get_config_descriptor "libusb_device *dev" "uint8_t config_index" "libusb_config_descriptor **config"
324Get USB configuration descriptor based on its index

--- 49 unchanged lines hidden (view full) ---

374This function asynchronously cancel a transfer. Returns 0 on success and
375LIBUSB_ERROR code on failure.
376.
377.Pp
378.Sh USB SYNCHRONOUS I/O
379.
380.Pp
381.Ft int
348.Fn libusb_control_transfer "libusb_device_handle *devh" "uint8_t bmRequestType" "uint16_t wIndex" "unsigned char *data" "uint16_t wLength" "unsigned int timeout"
382.Fn libusb_control_transfer "libusb_device_handle *devh" "uint8_t bmRequestType" "uint8_t bRequest" "uint16_t wValue" "uint16_t wIndex" "unsigned char *data" "uint16_t wLength" "unsigned int timeout"
349Perform a USB control transfer. Returns 0 on success, LIBUSB_ERROR_TIMEOUT
350if the transfer timeout, LIBUSB_ERROR_PIPE if the control request was not
351supported, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and
352LIBUSB_ERROR code on other failure.
353.
354.Pp
355.Ft int
356.Fn libusb_bulk_transfer "struct libusb_device_handle *devh" "unsigned char endpoint" "unsigned char *data" "int length" "int *transferred" "unsigned int timeout"

--- 156 unchanged lines hidden ---
383Perform a USB control transfer. Returns 0 on success, LIBUSB_ERROR_TIMEOUT
384if the transfer timeout, LIBUSB_ERROR_PIPE if the control request was not
385supported, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and
386LIBUSB_ERROR code on other failure.
387.
388.Pp
389.Ft int
390.Fn libusb_bulk_transfer "struct libusb_device_handle *devh" "unsigned char endpoint" "unsigned char *data" "int length" "int *transferred" "unsigned int timeout"

--- 156 unchanged lines hidden ---