The Linux-USB Host Side API

Legal Notice
Table of Contents
Introduction to USB on Linux
USB Host-Side API Model
USB-Standard Types
struct usb_ctrlrequest --  SETUP data for a USB device control request
Host-Side Data Types and Macros
struct usb_interface --  what usb device drivers talk to
struct usb_interface_cache --  long-term representation of a device interface
struct usb_host_config --  representation of a device's configuration
usb_interface_claimed --  returns true iff an interface is claimed
usb_make_path --  returns stable device path in the usb tree
USB_DEVICE --  macro used to describe a specific usb device
USB_DEVICE_VER --  macro used to describe a specific usb device with a version range
USB_DEVICE_INFO --  macro used to describe a class of usb devices
USB_INTERFACE_INFO --  macro used to describe a class of usb interfaces
struct usb_driver --  identifies USB driver to usbcore
struct usb_class_driver --  identifies a USB driver that wants to use the USB major number
struct urb --  USB Request Block
usb_fill_control_urb --  initializes a control urb
usb_fill_bulk_urb --  macro to help initialize a bulk urb
usb_fill_int_urb --  macro to help initialize a interrupt urb
struct usb_sg_request --  support for scatter/gather I/O
USB Core APIs
usb_init_urb --  initializes a urb so that it can be used by a USB driver
usb_alloc_urb --  creates a new urb for a USB driver to use
usb_free_urb --  frees the memory used by a urb when all users of it are finished
usb_get_urb --  increments the reference count of the urb
usb_submit_urb --  issue an asynchronous transfer request for an endpoint
usb_unlink_urb --  abort/cancel a transfer request for an endpoint
usb_kill_urb --  cancel a transfer request and wait for it to finish
usb_control_msg --  Builds a control urb, sends it off and waits for completion
usb_bulk_msg --  Builds a bulk urb, sends it off and waits for completion
usb_sg_init --  initializes scatterlist-based bulk/interrupt I/O request
usb_sg_wait --  synchronously execute scatter/gather request
usb_sg_cancel --  stop scatter/gather i/o issued by usb_sg_wait
usb_get_descriptor --  issues a generic GET_DESCRIPTOR request
usb_get_string --  gets a string descriptor
usb_string --  returns ISO 8859-1 version of a string descriptor
usb_get_status --  issues a GET_STATUS call
usb_clear_halt --  tells device to clear endpoint halt/stall condition
usb_set_interface --  Makes a particular alternate setting be current
usb_reset_configuration --  lightweight device reset
usb_register_dev --  register a USB device, and ask for a minor number
usb_deregister_dev --  deregister a USB device's dynamic minor.
usb_register --  register a USB driver
usb_deregister --  unregister a USB driver
usb_ifnum_to_if --  get the interface object with a given interface number
usb_altnum_to_altsetting --  get the altsetting structure with a given
usb_epnum_to_ep_desc --  get the endpoint object with a given endpoint number
usb_driver_claim_interface --  bind a driver to an interface
usb_driver_release_interface --  unbind a driver from an interface
usb_match_id --  find first usb_device_id matching device or interface
usb_find_interface --  find usb_interface pointer for driver and device
usb_alloc_dev --  usb device constructor (usbcore-internal)
usb_get_dev --  increments the reference count of the usb device structure
usb_put_dev --  release a use of the usb device structure
usb_find_device --  find a specific usb device in the system
usb_get_current_frame_number --  return current bus frame number
usb_buffer_alloc --  allocate dma-consistent buffer for URB_NO_xxx_DMA_MAP
usb_buffer_free --  free memory allocated with usb_buffer_alloc
usb_buffer_map --  create DMA mapping(s) for an urb
usb_buffer_dmasync --  synchronize DMA and CPU view of buffer(s)
usb_buffer_unmap --  free DMA mapping(s) for an urb
usb_buffer_map_sg --  create scatterlist DMA mapping(s) for an endpoint
usb_buffer_dmasync_sg --  synchronize DMA and CPU view of scatterlist buffer(s)
usb_buffer_unmap_sg --  free DMA mapping(s) for a scatterlist
Host Controller APIs
usb_bus_init --  shared initialization code
usb_alloc_bus --  creates a new USB host controller structure
usb_register_bus --  registers the USB host controller with the usb core
usb_deregister_bus --  deregisters the USB host controller
usb_register_root_hub --  called by HCD to register its root hub
usb_calc_bus_time --  approximate periodic transaction time in nanoseconds
usb_claim_bandwidth --  records bandwidth for a periodic transfer
usb_release_bandwidth --  reverses effect of usb_claim_bandwidth
usb_hcd_giveback_urb --  return URB from HCD to device driver
usb_hcd_irq --  hook IRQs to HCD framework (bus glue)
usb_hc_died --  report abnormal shutdown of a host controller (bus glue)
usb_hcd_pci_probe --  initialize PCI-based HCDs
usb_hcd_pci_remove --  shutdown processing for PCI-based HCDs
usb_hcd_pci_suspend --  power management suspend of a PCI-based HCD
usb_hcd_pci_resume --  power management resume of a PCI-based HCD
hcd_buffer_create --  initialize buffer pools
hcd_buffer_destroy --  deallocate buffer pools
The USB Filesystem (usbfs)
What files are in "usbfs"?
Mounting and Access Control
/proc/bus/usb/devices
/proc/bus/usb/BBB/DDD
Life Cycle of User Mode Drivers
The ioctl() Requests
Management/Status Requests
Synchronous I/O Support
Asynchronous I/O Support