NetBSD/share/man/man9/usbdi.9

192 lines
9.0 KiB
Groff

.\" $NetBSD: usbdi.9,v 1.7 2008/04/30 13:10:59 martin Exp $
.\"
.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Lennart Augustsson.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 3, 1999
.Dt USBDI 9
.Os
.Sh NAME
.Nm usbdi
.Nd USB device drivers interface
.Sh SYNOPSIS
.Cd "#include \*[Lt]dev/usb/usb.h\*[Gt]"
.Cd "#include \*[Lt]dev/usb/usbdi.h\*[Gt]"
.Sh DESCRIPTION
Device driver access to the USB bus centers around transfers.
A transfer describes a communication with a USB device.
A transfer is an abstract concept that can result in several
physical packets being transferred to or from a device.
A transfer is described by a
.Va usbd_xfer_handle .
It is allocated by
.Va usbd_alloc_xfer
and the data describing the transfer is filled by
.Va usbd_setup_default_xfer
for control pipe transfers, by
.Va usbd_setup_xfer
for bulk and interrupt transfers, and by
.Va usbd_setup_isoc_xfer
for isochronous transfers.
.Pp
describe
.Va usbd_do_request
.Pp
describe pipes
.Pp
describe
usbd_status
.Ss Functions offered by usbdi
.Bl -tag -width indent
.It Dv usbd_status usbd_open_pipe(usbd_interface_handle iface, uint8_t address,
uint8_t flags,
usbd_pipe_handle *pipe)
.It Dv usbd_status usbd_close_pipe(usbd_pipe_handle pipe)
.It Dv usbd_status usbd_transfer(usbd_xfer_handle req)
.It Dv usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle)
.It Dv usbd_status usbd_free_xfer(usbd_xfer_handle xfer)
.It Dv void usbd_setup_xfer(usbd_xfer_handle xfer, usbd_pipe_handle pipe,
usbd_private_handle priv, void *buffer,
uint32_t length, uint16_t flags, uint32_t timeout,
usbd_callback)
.It Dv void usbd_setup_default_xfer(usbd_xfer_handle xfer,
usbd_device_handle dev,
usbd_private_handle priv, uint32_t timeout,
usb_device_request_t *req, void *buffer,
uint32_t length, uint16_t flags, usbd_callback)
.It Dv void usbd_setup_isoc_xfer(usbd_xfer_handle xfer, usbd_pipe_handle pipe,
usbd_private_handle priv, uint16_t *frlengths,
uint32_t nframes, uint16_t flags, usbd_callback)
.It Dv void usbd_get_xfer_status(usbd_xfer_handle xfer, usbd_private_handle *priv,
void **buffer, uint32_t *count, usbd_status *status)
.It Dv usb_endpoint_descriptor_t *usbd_interface2endpoint_descriptor(usbd_interface_handle iface, uint8_t address)
.It Dv usbd_status usbd_abort_pipe(usbd_pipe_handle pipe)
.It Dv usbd_status usbd_clear_endpoint_stall(usbd_pipe_handle pipe)
.It Dv usbd_status usbd_clear_endpoint_stall_async(usbd_pipe_handle pipe)
.It Dv usbd_status usbd_endpoint_count(usbd_interface_handle dev, uint8_t *count)
.It Dv usbd_status usbd_interface_count(usbd_device_handle dev, uint8_t *count)
.It Dv usbd_status usbd_interface2device_handle(usbd_interface_handle iface, usbd_device_handle *dev)
.It Dv usbd_status usbd_device2interface_handle(usbd_device_handle dev, uint8_t ifaceno, usbd_interface_handle *iface)
.Pp
.It Dv usbd_device_handle usbd_pipe2device_handle(usbd_pipe_handle)
.It Dv void *usbd_alloc_buffer(usbd_xfer_handle req, uint32_t size)
.It Dv void usbd_free_buffer(usbd_xfer_handle req)
.It Dv void *usbd_get_buffer(usbd_xfer_handle xfer)
.It Dv usbd_status usbd_sync_transfer(usbd_xfer_handle req)
.It Dv usbd_status usbd_open_pipe_intr(usbd_interface_handle iface, uint8_t address,
uint8_t flags, usbd_pipe_handle *pipe,
usbd_private_handle priv, void *buffer,
uint32_t length, usbd_callback)
.It Dv usbd_status usbd_do_request(usbd_device_handle pipe, usb_device_request_t *req, void *data)
.It Dv usbd_status usbd_do_request_async(usbd_device_handle pipe, usb_device_request_t *req, void *data)
.It Dv usbd_status usbd_do_request_flags(usbd_device_handle pipe, usb_device_request_t *req,
void *data, uint16_t flags, int *)
.It Dv usb_interface_descriptor_t *usbd_get_interface_descriptor(usbd_interface_handle iface)
.It Dv usb_config_descriptor_t *usbd_get_config_descriptor(usbd_device_handle dev)
.It Dv usb_device_descriptor_t *usbd_get_device_descriptor(usbd_device_handle dev)
.It Dv usbd_status usbd_set_interface(usbd_interface_handle, int)
.It Dv int usbd_get_no_alts(usb_config_descriptor_t *, int)
.It Dv usbd_status usbd_get_interface(usbd_interface_handle iface, uint8_t *aiface)
.It Dv void usbd_fill_deviceinfo (usbd_device_handle dev, struct usb_device_info *di)
.It Dv int usbd_get_interface_altindex(usbd_interface_handle iface)
.It Dv usb_interface_descriptor_t *usbd_find_idesc(usb_config_descriptor_t *cd, int iindex, int ano)
.It Dv usb_endpoint_descriptor_t *usbd_find_edesc(usb_config_descriptor_t *cd, int ifaceidx, int altidx,
int endptidx)
.It Dv const char *usbd_errstr(usbd_status err)
.El
.Ss Utilities from usbdi_util.h
Based on the routines in
.Dv "usbdi.h"
a number of utility functions have been defined that are accessible
through
.Dv "usbdi_util.h"
.Bl -tag -width indent
.It Dv usbd_status usbd_get_desc(usbd_device_handle dev, int type,
int index, int len, void *desc)
.It Dv usbd_status usbd_get_config_desc(usbd_device_handle, int,
usb_config_descriptor_t *)
.It Dv usbd_status usbd_get_config_desc_full(usbd_device_handle, int,
void *, int)
.It Dv usbd_status usbd_get_device_desc(usbd_device_handle dev,
usb_device_descriptor_t *d)
.It Dv usbd_status usbd_set_address(usbd_device_handle dev, int addr)
.It Dv usbd_status usbd_get_port_status(usbd_device_handle,
int, usb_port_status_t *)
.It Dv usbd_status usbd_set_hub_feature(usbd_device_handle dev, int)
.It Dv usbd_status usbd_clear_hub_feature(usbd_device_handle, int)
.It Dv usbd_status usbd_set_port_feature(usbd_device_handle dev, int, int)
.It Dv usbd_status usbd_clear_port_feature(usbd_device_handle, int, int)
.It Dv usbd_status usbd_get_device_status(usbd_device_handle,usb_status_t*)
.It Dv usbd_status usbd_get_hub_status(usbd_device_handle dev,
usb_hub_status_t *st)
.It Dv usbd_status usbd_set_protocol(usbd_interface_handle dev, int report)
.It Dv usbd_status usbd_get_report_descriptor
(usbd_device_handle dev, int ifcno, int repid, int size, void *d)
.It Dv struct usb_hid_descriptor *usbd_get_hid_descriptor
(usbd_interface_handle ifc)
.It Dv usbd_status usbd_set_report
(usbd_interface_handle iface,int type,int id,void *data,int len)
.It Dv usbd_status usbd_set_report_async
(usbd_interface_handle iface,int type,int id,void *data,int len)
.It Dv usbd_status usbd_get_report
(usbd_interface_handle iface,int type,int id,void *data,int len)
.It Dv usbd_status usbd_set_idle
(usbd_interface_handle iface, int duration, int id)
.It Dv usbd_status usbd_alloc_report_desc
(usbd_interface_handle ifc, void **descp, int *sizep, int mem)
.It Dv usbd_status usbd_get_config
(usbd_device_handle dev, uint8_t *conf)
.It Dv usbd_status usbd_get_string_desc
(usbd_device_handle dev, int sindex, int langid,
usb_string_descriptor_t *sdesc)
.It Dv void usbd_delay_ms(usbd_device_handle, u_int)
.It Dv usbd_status usbd_set_config_no
(usbd_device_handle dev, int no, int msg)
.It Dv usbd_status usbd_set_config_index
(usbd_device_handle dev, int index, int msg)
.It Dv usbd_status usbd_bulk_transfer
(usbd_xfer_handle xfer, usbd_pipe_handle pipe, uint16_t flags,
uint32_t timeout, void *buf, uint32_t *size, char *lbl)
.It Dv void usb_detach_wait(device_ptr_t)
.It Dv void usb_detach_wakeup(device_ptr_t)
.El
.Sh SEE ALSO
.Xr usb 4
.Sh HISTORY
This
.Nm
interface first appeared in
.Nx 1.4 .
The interface is based on an early definition from the OpenUSBDI group
within the USB organisation.
Right after this definition the OpenUSBDI development got closed for open
source developers, so this interface has not followed the further changes.
The OpenUSBDI specification is now available again, but looks different.
.Sh BUGS
This man page is under development, so its biggest shortcoming is
incompleteness.