最終更新:2014-06-03 (火) 18:35:22 (3608d)  

kernel.org/doc/htmldocs/gadget
Top / kernel.org / doc / htmldocs / gadget

USB Gadget API for Linux

https://www.kernel.org/doc/htmldocs/gadget/index.html

1ページ

Table of Contents

1. Introduction

2. Structure of Gadget Drivers

3. Kernel Mode Gadget API

Driver Life Cycle

USB 2.0 Chapter 9 Types and Constants

  • usb_speed_string? — Returns human readable-name of the speed.
  • usb_state_string? — Returns human readable name for the state.

Core Objects and Methods

  • 構造体
    • usb_request — describes one i/o request
    • usb_ep — device side representation of USB endpoint
    • usb_gadget — represents a usb slave device
    • usb_gadget_driver — driver for usb 'slave' devices
    • usb_string — wraps a C string and its USB id
    • usb_gadget_strings? — a set of USB strings in a given language
  • 関数
    • usb_ep_set_maxpacket_limit? — set maximum packet size limit for endpoint
    • usb_ep_enable? — configure endpoint, making it usable
    • usb_ep_disable? — endpoint is no longer usable
    • usb_ep_alloc_request — allocate a request object to use with this endpoint
    • usb_ep_free_request? — frees a request object
    • usb_ep_queue — queues (submits) an I/O request to an endpoint.
    • usb_ep_dequeue? — dequeues (cancels, unlinks) an I/O request from an endpoint
    • usb_ep_set_halt? — sets the endpoint halt feature.
    • usb_ep_clear_halt? — clears endpoint halt, and resets toggle
    • usb_ep_set_wedge? — sets the halt feature and ignores clear requests
    • usb_ep_fifo_status? — returns number of bytes in fifo, or error
    • usb_ep_fifo_flush? — flushes contents of a fifo
    • usb_ep_align_maybe? — returns len aligned to ep's maxpacketsize if gadget requires quirk_ep_out_aligned_size, otherwise reguens len.
    • gadget_is_dualspeed? — return true iff the hardware handles high speed
    • gadget_is_superspeed? — return true if the hardware handles superspeed
    • gadget_is_otg? — return true iff the hardware is OTG-ready
    • usb_gadget_frame_number? — returns the current frame number
    • usb_gadget_wakeup? — tries to wake up the host connected to this gadget
    • usb_gadget_set_selfpowered? — sets the device selfpowered feature.
    • usb_gadget_clear_selfpowered? — clear the device selfpowered feature.
    • usb_gadget_vbus_connect? — Notify controller that VBUS is powered
    • usb_gadget_vbus_draw? — constrain controller's VBUS power usage
    • usb_gadget_vbus_disconnect? — notify controller about VBUS session end
    • usb_gadget_connect? — software-controlled connect to USB host
    • usb_gadget_disconnect? — software-controlled disconnect from USB host
    • usb_gadget_probe_driver — probe a gadget driver
    • usb_gadget_unregister_driver? — unregister a gadget driver
    • usb_free_descriptors? — free descriptors returned by usb_copy_descriptors

Optional Utilities

  • usb_gadget_get_string? — fill out a string descriptor
  • usb_descriptor_fillbuf? — fill buffer with descriptors
  • usb_gadget_config_buf? — builts a complete configuration descriptor
  • usb_copy_descriptors? — copy a vector of USB descriptors

Composite Device Framework

  • 関数
    • config_ep_by_speed? — configures the given endpoint according to gadget speed.
    • usb_add_function — add a function to a configuration
    • usb_function_deactivate? — prevent function and gadget enumeration
    • usb_function_activate? — allow function and gadget enumeration
    • usb_interface_id? — allocate an unused interface ID
    • usb_add_config — add a configuration to a device.
    • usb_string_id? — allocate an unused string ID
    • usb_string_ids_tab? — allocate unused string IDs in batch
    • usb_gstrings_attach? — attach gadget strings to a cdev and assign ids
    • usb_string_ids_n? — allocate unused string IDs in batch
    • usb_composite_probe — register a composite driver
    • usb_composite_unregister? — unregister a composite driver
    • usb_composite_setup_continue? — Continue with the control transfer

Composite Device Functions

4. Peripheral Controller Drivers

5. Gadget Drivers

6. USB On-The-GO (OTG)

関連