Module Name: src Committed By: skrll Date: Sun Apr 24 15:03:18 UTC 2016
Modified Files: src/share/man/man9: usbdi.9 Log Message: Update after nick-nhusb merge To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/share/man/man9/usbdi.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/share/man/man9/usbdi.9 diff -u src/share/man/man9/usbdi.9:1.30 src/share/man/man9/usbdi.9:1.31 --- src/share/man/man9/usbdi.9:1.30 Mon Jun 29 16:20:14 2015 +++ src/share/man/man9/usbdi.9 Sun Apr 24 15:03:18 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: usbdi.9,v 1.30 2015/06/29 16:20:14 skrll Exp $ +.\" $NetBSD: usbdi.9,v 1.31 2016/04/24 15:03:18 skrll Exp $ .\" .\" Copyright (c) 2012 Matthew R. Green .\" All rights reserved. @@ -27,11 +27,11 @@ .\" SUCH DAMAGE. .\" .\" -.\" Copyright (c) 1999 The NetBSD Foundation, Inc. +.\" Copyright (c) 1999, 2016 The NetBSD Foundation, Inc. .\" All rights reserved. .\" .\" This code is derived from software contributed to The NetBSD Foundation -.\" by Lennart Augustsson. +.\" by Lennart Augustsson and Nick Hudson. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -54,7 +54,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd June 29, 2015 +.Dd April 24, 2016 .Dt USBDI 9 .Os .Sh NAME @@ -66,144 +66,148 @@ .In dev/usb/usbdi_util.h .Ss Functions offered by usbdi.h .Ft usbd_status -.Fn usbd_open_pipe "usbd_interface_handle iface" "uint8_t address" \ - "uint8_t flags" "usbd_pipe_handle *pipe" +.Fn usbd_open_pipe "struct usbd_interface *iface" "uint8_t address" \ + "uint8_t flags" "struct usbd_pipe **pipe" .Ft usbd_status -.Fn usbd_close_pipe "usbd_pipe_handle pipe" +.Fn usbd_close_pipe "struct usbd_pipe *pipe" .Ft usbd_status -.Fn usbd_transfer "usbd_xfer_handle xfer" -.Ft usbd_xfer_handle -.Fn usbd_alloc_xfer "usbd_device_handle dev" -.Ft usbd_status -.Fn usbd_free_xfer "usbd_xfer_handle xfer" -.Ft void -.Fn usbd_setup_xfer "usbd_xfer_handle xfer" "usbd_pipe_handle pipe" \ - "usbd_private_handle priv" "void *buffer" "uint32_t length" \ +.Fn usbd_transfer "struct usbd_xfer *xfer" +.Ft struct usbd_xfer * +.Fn usbd_setup_xfer "struct usbd_xfer *xfer" \ + "void *priv" "void *buffer" "uint32_t length" \ "uint16_t flags" "uint32_t timeout" "usbd_callback" .Ft void -.Fn usbd_setup_default_xfer "usbd_xfer_handle xfer" \ - "usbd_device_handle dev" "usbd_private_handle priv" \ +.Fn usbd_setup_default_xfer "struct usbd_xfer *xfer" \ + "struct usbd_device *dev" "void *priv" \ "uint32_t timeout" "usb_device_request_t *req" " void *buffer" \ "uint32_t length" "uint16_t flags" "usbd_callback" .Ft void -.Fn usbd_setup_isoc_xfer "usbd_xfer_handle xfer" "usbd_pipe_handle pipe" \ - "usbd_private_handle priv" "uint16_t *frlengths" \ +.Fn usbd_setup_isoc_xfer "struct usbd_xfer *xfer" \ + "void *priv" "uint16_t *frlengths" \ "uint32_t nframes" "uint16_t flags" "usbd_callback" .Ft void -.Fn usbd_get_xfer_status "usbd_xfer_handle xfer" "usbd_private_handle *priv" \ +.Fn usbd_get_xfer_status "struct usbd_xfer *xfer" "void **priv" \ "void **buffer" "uint32_t *count" "usbd_status *status" .Ft usb_endpoint_descriptor_t * -.Fn usbd_interface2endpoint_descriptor "usbd_interface_handle iface" \ +.Fn usbd_interface2endpoint_descriptor "struct usbd_interface *iface" \ "uint8_t address" .Ft usbd_status -.Fn usbd_abort_pipe "usbd_pipe_handle pipe" +.Fn usbd_abort_pipe "struct usbd_pipe *pipe" .Ft usbd_status -.Fn usbd_abort_default_pipe "usbd_device_handle dev" +.Fn usbd_abort_default_pipe "struct usbd_device *dev" .Ft usbd_status -.Fn usbd_clear_endpoint_stall "usbd_pipe_handle pipe" +.Fn usbd_clear_endpoint_stall "struct usbd_pipe *pipe" .Ft usbd_status -.Fn usbd_clear_endpoint_stall_async "usbd_pipe_handle pipe" +.Fn usbd_clear_endpoint_stall_async "struct usbd_pipe *pipe" .Ft void -.Fn usbd_clear_endpoint_toggle "usbd_pipe_handle pipe" +.Fn usbd_clear_endpoint_toggle "struct usbd_pipe *pipe" .Ft usbd_status -.Fn usbd_endpoint_count "usbd_interface_handle dev" "uint8_t *count" +.Fn usbd_endpoint_count "struct usbd_interface *dev" "uint8_t *count" .Ft usbd_status -.Fn usbd_interface_count "usbd_device_handle dev" "uint8_t *count" +.Fn usbd_interface_count "struct usbd_device *dev" "uint8_t *count" .Ft usbd_status -.Fn usbd_interface2device_handle "usbd_interface_handle iface" "usbd_device_handle *dev" +.Fn usbd_interface2device_handle "struct usbd_interface *iface" "struct usbd_device **dev" .Ft usbd_status -.Fn usbd_device2interface_handle "usbd_device_handle dev" "uint8_t ifaceno" "usbd_interface_handle *iface" +.Fn usbd_device2interface_handle "struct usbd_device *dev" "uint8_t ifaceno" "struct usbd_interface **iface" .Pp -.Ft usbd_device_handle -.Fn usbd_pipe2device_handle "usbd_pipe_handle pipe" -.Ft void * -.Fn usbd_alloc_buffer "usbd_xfer_handle req" "uint32_t size" +.Ft struct usbd_device * +.Fn usbd_pipe2device_handle "struct usbd_pipe *pipe" +.Ft int +.Fn usbd_create_xfer "struct usbd_pipe *pipe" "size_t len" \ +"unsigned int flags" "unsigned int nframes" "struct usbd_xfer **xp" .Ft void -.Fn usbd_free_buffer "usbd_xfer_handle req" +.Fn usbd_destroy_xfer "struct usbd_xfer *xfer" .Ft void * -.Fn usbd_get_buffer "usbd_xfer_handle xfer" +.Fn usbd_get_buffer "struct usbd_xfer *xfer" .Ft usbd_status -.Fn usbd_sync_transfer "usbd_xfer_handle req" +.Fn usbd_sync_transfer "struct usbd_xfer *req" .Ft usbd_status -.Fn usbd_sync_transfer_sig "usbd_xfer_handle req" +.Fn usbd_sync_transfer_sig "struct usbd_xfer *req" .Ft usbd_status -.Fn usbd_open_pipe_intr "usbd_interface_handle iface" "uint8_t address" \ - "uint8_t flags" "usbd_pipe_handle *pipe" \ - "usbd_private_handle priv" "void *buffer" \ +.Fn usbd_open_pipe_intr "struct usbd_interface *iface" "uint8_t address" \ + "uint8_t flags" "struct usbd_pipe **pipe" \ + "void *priv" "void *buffer" \ "uint32_t length" "usbd_callback callback" "int interval" .Ft usbd_status -.Fn usbd_do_request "usbd_device_handle dev" "usb_device_request_t *req" \ +.Fn usbd_do_request "struct usbd_device *dev" "usb_device_request_t *req" \ "void *data" .Ft usbd_status -.Fn usbd_do_request_flags "usbd_device_handle dev" \ +.Fn usbd_do_request_flags "struct usbd_device *dev" \ "usb_device_request_t *req" "void *data" "uint16_t flags" "int *actlen" \ - "u_int32_t timo" + "uint32_t timo" .\" usbd_do_request_async() not used outside of usbdi* .Ft usb_interface_descriptor_t * -.Fn usbd_get_interface_descriptor "usbd_interface_handle iface" +.Fn usbd_get_interface_descriptor "struct usbd_interface *iface" .Ft usb_config_descriptor_t * -.Fn usbd_get_config_descriptor "usbd_device_handle dev" +.Fn usbd_get_config_descriptor "struct usbd_device *dev" .Ft usb_device_descriptor_t * -.Fn usbd_get_device_descriptor "usbd_device_handle dev" +.Fn usbd_get_device_descriptor "struct usbd_device *dev" .Ft usbd_status -.Fn usbd_set_interface "usbd_interface_handle iface" "int altidx" +.Fn usbd_set_interface "struct usbd_interface *iface" "int altidx" .Ft int .Fn usbd_get_no_alts "usb_config_descriptor_t *iface" "int ifaceno" .Ft usbd_status .\" unused, delete? -.\" .Fn usbd_get_interface "usbd_interface_handle iface" "uint8_t *aiface" +.\" .Fn usbd_get_interface "struct usbd_interface *iface" "uint8_t *aiface" .\" .Ft void -.Fn usbd_fill_deviceinfo "usbd_device_handle dev" "struct usb_device_info *di" +.Fn usbd_fill_deviceinfo "struct usbd_device *dev" "struct usb_device_info *di" .Ft int -.Fn usbd_get_interface_altindex "usbd_interface_handle iface" +.Fn usbd_get_interface_altindex "struct usbd_interface *iface" .Ft usb_endpoint_descriptor_t * -.Fn usbd_get_endpoint_descriptor "usbd_interface_handle dev" \ - "u_int8_t address" +.Fn usbd_get_endpoint_descriptor "struct usbd_interface *dev" \ + "uint8_t address" .Ft usb_interface_descriptor_t * .Fn usbd_find_idesc "usb_config_descriptor_t *cd" "int iindex" "int ano" .Ft usb_endpoint_descriptor_t * .Fn usbd_find_edesc "usb_config_descriptor_t *cd" "int ifaceidx" "int altidx" \ "int endptidx" .Ft void -.Fn usbd_dopoll "usbd_interface_handle iface" +.Fn usbd_dopoll "struct usbd_interface *iface" .Ft void -.Fn usbd_set_polling "usbd_device_handle iface" "int val" +.Fn usbd_set_polling "struct usbd_device *iface" "int val" .Ft const char * .Fn usbd_errstr "usbd_status err" .Ft void -.Fn usbd_add_dev_event "int type" "usbd_device_handle iface" +.Fn usbd_add_dev_event "int type" "struct usbd_device *iface" .Ft void -.Fn usbd_add_drv_event "int type" "usbd_device_handle iface" "device_t dv" +.Fn usbd_add_drv_event "int type" "struct usbd_device *iface" "device_t dv" .Ft char * -.Fn usbd_devinfo_alloc "usbd_device_handle iface" "int showclass" +.Fn usbd_devinfo_alloc "struct usbd_device *iface" "int showclass" .Ft void .Fn usbd_devinfo_free "char *str" .Ft const struct usbd_quirks * -.Fn usbd_get_quirks "usbd_device_handle iface" +.Fn usbd_get_quirks "struct usbd_device *iface" .Ft usbd_status -.Fn usbd_reload_device_desc "usbd_device_handle iface" +.Fn usbd_reload_device_desc "struct usbd_device *iface" .Ft int .Fn usbd_ratecheck "struct timeval *tv" .Ft usbd_status -.Fn usbd_get_string "usbd_device_handle iface" "int si" "char *buf" +.Fn usbd_get_string "struct usbd_device *iface" "int si" "char *buf" .Ft usbd_status -.Fn usbd_get_string0 "usbd_device_handle iface" "int si" "char *buf" \ +.Fn usbd_get_string0 "struct usbd_device *iface" "int si" "char *buf" \ "int unicode" .Ft void -.Fn usb_desc_iter_init "usbd_device_handle iface" "usbd_desc_iter_t *iter" +.Fn usb_desc_iter_init "struct usbd_device *iface" "usbd_desc_iter_t *iter" .Ft const usb_descriptor_t * .Fn usb_desc_iter_next "usbd_desc_iter_t *iter" .Ft void -.Fn usb_add_task "usbd_device_handle iface" "struct usb_task *task" \ +.Fn usb_add_task "struct usbd_device *iface" "struct usb_task *task" \ "int queue" .Ft void -.Fn usb_rem_task "usbd_device_handle iface" "struct usb_task *task" +.Fn usb_rem_task "struct usbd_device *iface" "struct usb_task *task" .Ft void .Fn usb_init_task "struct usb_task *task" "void (*func)(void *)" \ "void *arg" uint8_t flags .Ft const struct usb_devno * .Fn usb_lookup "const struct usb_devno *tbl" \ - "u_int16_t vendor" "u_int16_t product" + "uint16_t vendor" "uint16_t product" +.Ss Obsolete functions +The following functions have been obsoleted from +.Dv usbdi.h . +.Ft void * +.Fn usbd_alloc_buffer "struct usbd_xfer *xfer" "uint32_t size" +.Ft void +.Fn usbd_free_buffer "struct usbd_xfer *xfer" .Ss Utilities from usbdi_util.h Based on the routines in .Dv usbdi.h @@ -211,67 +215,67 @@ a number of utility functions have been through .Dv usbdi_util.h . .Ft usbd_status -.Fn usbd_get_desc "usbd_device_handle dev" "int type" "int index" \ +.Fn usbd_get_desc "struct usbd_device *dev" "int type" "int index" \ "int len" "void *desc" .Ft usbd_status -.Fn usbd_get_config_desc "usbd_device_handle dev" "int confidx" \ +.Fn usbd_get_config_desc "struct usbd_device *dev" "int confidx" \ "usb_config_descriptor_t *d" .Ft usbd_status -.Fn usbd_get_config_desc_full "usbd_device_handle" "int dev" "void *d" "int size" +.Fn usbd_get_config_desc_full "struct usbd_device *" "int dev" "void *d" "int size" .Ft usbd_status -.Fn usbd_get_device_desc "usbd_device_handle dev" \ +.Fn usbd_get_device_desc "struct usbd_device *dev" \ "usb_device_descriptor_t *d" .Ft usbd_status -.Fn usbd_set_address "usbd_device_handle dev" "int addr" +.Fn usbd_set_address "struct usbd_device *dev" "int addr" .Ft usbd_status -.Fn usbd_get_port_status "usbd_device_handle dev" "int port" "usb_port_status_t *ps" +.Fn usbd_get_port_status "struct usbd_device *dev" "int port" "usb_port_status_t *ps" .Ft usbd_status -.Fn usbd_set_hub_feature "usbd_device_handle dev" "int sel" +.Fn usbd_set_hub_feature "struct usbd_device *dev" "int sel" .Ft usbd_status -.Fn usbd_clear_hub_feature "usbd_device_handle dev" "int sel" +.Fn usbd_clear_hub_feature "struct usbd_device *dev" "int sel" .Ft usbd_status -.Fn usbd_set_port_feature "usbd_device_handle dev" "int port" "int sel" +.Fn usbd_set_port_feature "struct usbd_device *dev" "int port" "int sel" .Ft usbd_status -.Fn usbd_clear_port_feature "usbd_device_handle dev" "int port" "int sel" +.Fn usbd_clear_port_feature "struct usbd_device *dev" "int port" "int sel" .Ft usbd_status -.Fn usbd_get_device_status "usbd_device_handle dev" "usb_status_t *st" +.Fn usbd_get_device_status "struct usbd_device *dev" "usb_status_t *st" .Ft usbd_status -.Fn usbd_get_hub_status "usbd_device_handle dev" "usb_hub_status_t *st" +.Fn usbd_get_hub_status "struct usbd_device *dev" "usb_hub_status_t *st" .Ft usbd_status -.Fn usbd_set_protocol "usbd_interface_handle dev" "int report" +.Fn usbd_set_protocol "struct usbd_interface *dev" "int report" .Ft usbd_status -.Fn usbd_get_report_descriptor "usbd_device_handle dev" "int ifcno" "int repid" "int size" "void *d" +.Fn usbd_get_report_descriptor "struct usbd_device *dev" "int ifcno" "int repid" "int size" "void *d" .Ft struct usb_hid_descriptor * -.Fn usbd_get_hid_descriptor "usbd_interface_handle ifc" +.Fn usbd_get_hid_descriptor "struct usbd_interface *ifc" .Ft usbd_status -.Fn usbd_set_report "usbd_interface_handle iface" "int type" "int id" "void *data" "int len" +.Fn usbd_set_report "struct usbd_interface *iface" "int type" "int id" "void *data" "int len" .Ft usbd_status -.Fn usbd_set_report_async "usbd_interface_handle iface" "int type" "int id" "void *data" "int len" +.Fn usbd_set_report_async "struct usbd_interface *iface" "int type" "int id" "void *data" "int len" .Ft usbd_status -.Fn usbd_get_report "usbd_interface_handle iface" "int type" "int id" "void *data" "int len" +.Fn usbd_get_report "struct usbd_interface *iface" "int type" "int id" "void *data" "int len" .Ft usbd_status -.Fn usbd_set_idle "usbd_interface_handle iface" "int duration" "int id" +.Fn usbd_set_idle "struct usbd_interface *iface" "int duration" "int id" .Ft usbd_status -.Fn usbd_alloc_report_desc "usbd_interface_handle ifc" "void **descp" \ +.Fn usbd_alloc_report_desc "struct usbd_interface *ifc" "void **descp" \ "int *sizep" "int mem" .\" private API between ugen(4) and usbdi(9) .\" .Ft usbd_status -.\" .Fn usbd_get_config "usbd_device_handle dev" "uint8_t *conf" +.\" .Fn usbd_get_config "struct usbd_device *dev" "uint8_t *conf" .Ft usbd_status -.Fn usbd_get_string_desc "usbd_device_handle dev" "int sindex" "int langid" \ +.Fn usbd_get_string_desc "struct usbd_device *dev" "int sindex" "int langid" \ "usb_string_descriptor_t *sdesc" .Ft void -.Fn usbd_delay_ms "usbd_device_handle dev" "u_int ms" +.Fn usbd_delay_ms "struct usbd_device *dev" "u_int ms" .Ft usbd_status -.Fn usbd_set_config_no "usbd_device_handle dev" "int no" "int msg" +.Fn usbd_set_config_no "struct usbd_device *dev" "int no" "int msg" .Ft usbd_status -.Fn usbd_set_config_index "usbd_device_handle dev" "int index" "int msg" +.Fn usbd_set_config_index "struct usbd_device *dev" "int index" "int msg" .Ft usbd_status -.Fn usbd_bulk_transfer "usbd_xfer_handle xfer" "usbd_pipe_handle pipe" \ - "uint16_t flags" "uint32_t timeout" "void *buf" "uint32_t *size" "char *lbl" +.Fn usbd_bulk_transfer "struct usbd_xfer *xfer" "struct usbd_pipe *pipe" \ + "uint16_t flags" "uint32_t timeout" "void *buf" "uint32_t *size" .Ft usbd_status -.Fn usbd_intr_transfer "usbd_xfer_handle xfer" "usbd_pipe_handle pipe" \ - "uint16_t flags" "uint32_t timeout" "void *buf" "uint32_t *size" "char *lbl" +.Fn usbd_intr_transfer "struct usbd_xfer *xfer" "struct usbd_pipe *pipe" \ + "uint16_t flags" "uint32_t timeout" "void *buf" "uint32_t *size" .Ft void .Fn usb_detach_waitold "device_t dv" .Ft void @@ -286,11 +290,11 @@ A transfer describes a communication wit 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 the -.Va usbd_xfer_handle +.Va struct usbd_xfer * cookie. A pipe is a logical connection to a USB device. It is described by the -.Va usbd_pipe_handle +.Va struct usbd_pipe * cookie. See the .Sx TRANSFERS @@ -305,7 +309,7 @@ of resource count: Fills in .Fa iface with the -.Ft usbd_interface_handle +.Ft struct usbd_interface * for the USB device .Fa dev on interface number @@ -314,13 +318,13 @@ on interface number Fills in .Fa dev with the -.Ft usbd_device_handle +.Ft struct usbd_device * pointer for interface .Fa iface . .\" usbd_pipe2device_handle is unused; remove from usbdi? .It Fn usbd_pipe2device_handle pipe Returns the -.Ft usbd_device_handle +.Ft struct usbd_device * associated with .Fa pipe . .It Fn usbd_interface2endpoint_descriptor iface address @@ -376,9 +380,9 @@ The returned pointer has these members: .Bl -item -offset offset -compact .It -.Vt u_int16_t ud_vendor ; +.Vt uint16_t ud_vendor ; .It -.Vt u_int16_t ud_product ; +.Vt uint16_t ud_product ; .El The .Dv USB_PRODUCT_ANY @@ -387,94 +391,94 @@ macro can be used to match any USB produ .\" .\" XXX functions missing descriptions in usbdi.h XXX .\" -.\" .Fn usbd_get_interface_descriptor "usbd_interface_handle iface" -.\" .Fn usbd_get_config_descriptor "usbd_device_handle dev" -.\" .Fn usbd_get_device_descriptor "usbd_device_handle dev" +.\" .Fn usbd_get_interface_descriptor "struct usbd_interface *iface" +.\" .Fn usbd_get_config_descriptor "struct usbd_device *dev" +.\" .Fn usbd_get_device_descriptor "struct usbd_device *dev" .\" .Fn usbd_get_no_alts "usb_config_descriptor_t *iface" "int ifaceno" .\" unused, delete? -.\" .Fn usbd_get_interface "usbd_interface_handle iface" "uint8_t *aiface" -.\" .Fn usbd_fill_deviceinfo "usbd_device_handle dev" "struct usb_device_info *di" -.\" .Fn usbd_get_interface_altindex "usbd_interface_handle iface" -.\" .Fn usbd_get_endpoint_descriptor "usbd_interface_handle dev" \ -.\" "u_int8_t address" +.\" .Fn usbd_get_interface "struct usbd_interface *iface" "uint8_t *aiface" +.\" .Fn usbd_fill_deviceinfo "struct usbd_device *dev" "struct usb_device_info *di" +.\" .Fn usbd_get_interface_altindex "struct usbd_interface *iface" +.\" .Fn usbd_get_endpoint_descriptor "struct usbd_interface *dev" \ +.\" "uint8_t address" .\" .Fn usbd_find_idesc "usb_config_descriptor_t *cd" "int iindex" "int ano" .\" .Fn usbd_find_edesc "usb_config_descriptor_t *cd" "int ifaceidx" "int altidx" \ .\" "int endptidx" -.\" .Fn usbd_dopoll "usbd_interface_handle iface" -.\" .Fn usbd_set_polling" usbd_device_handle iface" "int val" +.\" .Fn usbd_dopoll "struct usbd_interface *iface" +.\" .Fn usbd_set_polling" struct usbd_device *iface" "int val" .\" -.\" .Fn usbd_add_dev_event "int type" "usbd_device_handle iface" -.\" .Fn usbd_add_drv_event "int type" "usbd_device_handle iface" "device_t dv" +.\" .Fn usbd_add_dev_event "int type" "struct usbd_device *iface" +.\" .Fn usbd_add_drv_event "int type" "struct usbd_device *iface" "device_t dv" .\" -.\" .Fn usbd_devinfo_alloc "usbd_device_handle iface" "int showclass" +.\" .Fn usbd_devinfo_alloc "struct usbd_device *iface" "int showclass" .\" .Fn usbd_devinfo_free "char *str" .\" -.\" .Fn usbd_get_quirks "usbd_device_handle iface" -.\" .Fn usbd_reload_device_desc "usbd_device_handle iface" +.\" .Fn usbd_get_quirks "struct usbd_device *iface" +.\" .Fn usbd_reload_device_desc "struct usbd_device *iface" .\" .Fn usbd_ratecheck "struct timeval *tv" -.\" .Fn usbd_get_string "usbd_device_handle iface" "int si" "char *buf" -.\" .Fn usbd_get_string0 "usbd_device_handle iface" "int" si "char *buf" \ +.\" .Fn usbd_get_string "struct usbd_device *iface" "int si" "char *buf" +.\" .Fn usbd_get_string0 "struct usbd_device *iface" "int" si "char *buf" \ .\" "int unicode" .\" -.\" .Fn usb_desc_iter_init "usbd_device_handle iface" "usbd_desc_iter_t *iter" +.\" .Fn usb_desc_iter_init "struct usbd_device *iface" "usbd_desc_iter_t *iter" .\" .Fn usb_desc_iter_next "usbd_desc_iter_t *iter" .\" .\" XXX functions missing descriptions in usbdi.h XXX .\" .\" .Dv usbdi_util.h . .\" .Ft usbd_status -.\" .Fn usbd_get_desc "usbd_device_handle dev" "int type" "int index" \ +.\" .Fn usbd_get_desc "struct usbd_device *dev" "int type" "int index" \ .\" "int len" "void *desc" .\" .Ft usbd_status -.\" .Fn usbd_get_config_desc "usbd_device_handle dev" "int confidx" \ +.\" .Fn usbd_get_config_desc "struct usbd_device *dev" "int confidx" \ .\" "usb_config_descriptor_t *d" .\" .Ft usbd_status -.\" .Fn usbd_get_config_desc_full "usbd_device_handle" "int dev" "void *d" "int size" +.\" .Fn usbd_get_config_desc_full "struct usbd_device *" "int dev" "void *d" "int size" .\" .Ft usbd_status -.\" .Fn usbd_get_device_desc "usbd_device_handle dev" \ +.\" .Fn usbd_get_device_desc "struct usbd_device *dev" \ .\" "usb_device_descriptor_t *d" .\" .Ft usbd_status -.\" .Fn usbd_set_address "usbd_device_handle dev" "int addr" +.\" .Fn usbd_set_address "struct usbd_device *dev" "int addr" .\" .Ft usbd_status -.\" .Fn usbd_get_port_status "usbd_device_handle dev" "intp ort" "usb_port_status_t *ps" +.\" .Fn usbd_get_port_status "struct usbd_device *dev" "intp ort" "usb_port_status_t *ps" .\" .Ft usbd_status -.\" .Fn usbd_set_hub_feature "usbd_device_handle dev" "int sel" +.\" .Fn usbd_set_hub_feature "struct usbd_device *dev" "int sel" .\" .Ft usbd_status -.\" .Fn usbd_clear_hub_feature "usbd_device_handle dev" "int sel" +.\" .Fn usbd_clear_hub_feature "struct usbd_device *dev" "int sel" .\" .Ft usbd_status -.\" .Fn usbd_set_port_feature "usbd_device_handle dev" "int port" "int sel" +.\" .Fn usbd_set_port_feature "struct usbd_device *dev" "int port" "int sel" .\" .Ft usbd_status -.\" .Fn usbd_clear_port_feature "usbd_device_handle dev" "int port" "int sel" +.\" .Fn usbd_clear_port_feature "struct usbd_device *dev" "int port" "int sel" .\" .Ft usbd_status -.\" .Fn usbd_get_device_status "usbd_device_handle dev" "usb_status_t *st" +.\" .Fn usbd_get_device_status "struct usbd_device *dev" "usb_status_t *st" .\" .Ft usbd_status -.\" .Fn usbd_get_hub_status "usbd_device_handle dev" "usb_hub_status_t *st" +.\" .Fn usbd_get_hub_status "struct usbd_device *dev" "usb_hub_status_t *st" .\" .Ft usbd_status -.\" .Fn usbd_set_protocol "usbd_interface_handle dev" "int report" +.\" .Fn usbd_set_protocol "struct usbd_interface *dev" "int report" .\" .Ft usbd_status -.\" .Fn usbd_get_report_descriptor "usbd_device_handle dev" "int ifcno" "int repid" "int size" "void *d" +.\" .Fn usbd_get_report_descriptor "struct usbd_device *dev" "int ifcno" "int repid" "int size" "void *d" .\" .Ft struct usb_hid_descriptor * -.\" .Fn usbd_get_hid_descriptor "usbd_interface_handle ifc" +.\" .Fn usbd_get_hid_descriptor "struct usbd_interface *ifc" .\" .Ft usbd_status -.\" .Fn usbd_set_report "usbd_interface_handle iface" "nt type" "int id" "void *data" "int len" +.\" .Fn usbd_set_report "struct usbd_interface *iface" "nt type" "int id" "void *data" "int len" .\" .Ft usbd_status -.\" .Fn usbd_set_report_async "usbd_interface_handle iface" "int type" "int id" "void *data" "int len" +.\" .Fn usbd_set_report_async "struct usbd_interface *iface" "int type" "int id" "void *data" "int len" .\" .Ft usbd_status -.\" .Fn usbd_get_report "usbd_interface_handle iface" "int type" "int id" "void *data" "int len" +.\" .Fn usbd_get_report "struct usbd_interface *iface" "int type" "int id" "void *data" "int len" .\" .Ft usbd_status -.\" .Fn usbd_set_idle "usbd_interface_handle iface" "int duration" "int id" +.\" .Fn usbd_set_idle "struct usbd_interface *iface" "int duration" "int id" .\" .Ft usbd_status -.\" .Fn usbd_alloc_report_desc "usbd_interface_handle ifc" "void **descp" \ +.\" .Fn usbd_alloc_report_desc "struct usbd_interface *ifc" "void **descp" \ .\" "int *sizep" "int mem" .\" .Ft usbd_status -.\" .Fn usbd_get_string_desc "usbd_device_handle dev" "int sindex" "int langid" \ +.\" .Fn usbd_get_string_desc "struct usbd_device *dev" "int sindex" "int langid" \ .\" "usb_string_descriptor_t *sdesc" .\" .Ft void -.\" .Fn usbd_delay_ms "usbd_device_handle dev" "u_int ms" +.\" .Fn usbd_delay_ms "struct usbd_device *dev" "u_int ms" .\" .Ft usbd_status -.\" .Fn usbd_set_config_no "usbd_device_handle dev" "int no" "int msg" +.\" .Fn usbd_set_config_no "struct usbd_device *dev" "int no" "int msg" .\" .Ft usbd_status -.\" .Fn usbd_set_config_index "usbd_device_handle dev" "int index" "int msg" +.\" .Fn usbd_set_config_index "struct usbd_device *dev" "int index" "int msg" .\" .Ft usbd_status .\" .Sh PIPES @@ -516,11 +520,19 @@ may be set to use the default interval, specified by the ep. description. It is common to have more than one pipe per device. .Sh TRANSFERS -Transfers are allocated and deallocated with -.Fn usbd_alloc_xfer +Transfers are created and destroyed with +.Fn usbd_create_xfer and -.Fn usbd_free_xfer , +.Fn usbd_destroy_xfer , respectively, and are associated with a pipe at their creation time. +The create function takes the pipe handle +.Fa pipe , +the length of the largest transfer possible +.Fa len , +possible transfer flags +.Fa flags , +the number of isochronous frames (or 0) in +.Fa nframes . .Pp The data describing the transfer is filled by either .Fn usbd_setup_default_xfer @@ -531,14 +543,11 @@ for bulk and interrupt transfers, and by for isochronous transfers. Private data may be passed between setup and completion or status calls using the -.Ft usbd_private_handle priv -argument, which must be an integral type. +.Ft void *priv +argument. .Pp Arguments to the setup functions include the newly allocated .Fa xfer , -the -.Fa pipe -to associate this transfer with, the private data .Fa priv , the @@ -563,8 +572,6 @@ The transfer specific .Fa flags that can be set are: .Bl -tag -width 10n -.It Dv USBD_NO_COPY -Do not copy data to DMA buffer .It Dv USBD_SYNCHRONOUS Wait for completion .It Dv USBD_SYNCHRONOUS_SIG @@ -575,22 +582,21 @@ Short reads are not an error Force last short packet on write .El .Pp -To allocate buffers suitable for USB tranfers (i.e., DMA capable), the -.Fn usbd_alloc_buffer -function should be used on the specified -.Fa xfer -for -.Fa size -bytes of space. -The -.Fn usbd_free_buffer -function can be used to free the buffer after use. The .Fn usbd_get_buffer -function returns the current kernel address for the DMA-capable buffer -in +function returns the current kernel address for the buffer suitable for +transfer in .Fa xfer . .Pp +The +.Fn usbd_open_pipe , +.Fn usbd_open_pipe_intr , +.Fn usbd_close_pipe , +.Fn usbd_alloc_xfer , +and +.Fn usbd_free_xfer +can all sleep and should not be called from interrupt context as a result. +.Pp Upon completion the .Fa callback function is called, which takes the completed @@ -627,9 +633,6 @@ and .Fn usbd_get_xfer_status , as well as associated error handling. The -.Fa lbl -option is deprecated and will be removed. -The .Fn usbd_sync_transfer is identical to .Fn usbd_transfer