1STRUCT USB_GADGET(9)        Kernel Mode Gadget API        STRUCT USB_GADGET(9)
2
3
4

NAME

6       struct_usb_gadget - represents a usb slave device
7

SYNOPSIS

9       struct usb_gadget {
10         const struct usb_gadget_ops * ops;
11         struct usb_ep * ep0;
12         struct list_head ep_list;
13         enum usb_device_speed speed;
14         enum usb_device_speed max_speed;
15         enum usb_device_state state;
16         unsigned sg_supported:1;
17         unsigned is_otg:1;
18         unsigned is_a_peripheral:1;
19         unsigned b_hnp_enable:1;
20         unsigned a_hnp_support:1;
21         unsigned a_alt_hnp_support:1;
22         const char * name;
23         struct device dev;
24         unsigned out_epnum;
25         unsigned in_epnum;
26       };
27

MEMBERS

29       ops
30           Function pointers used to access hardware-specific operations.
31
32       ep0
33           Endpoint zero, used when reading or writing responses to driver
34           setup requests
35
36       ep_list
37           List of other endpoints supported by the device.
38
39       speed
40           Speed of current connection to USB host.
41
42       max_speed
43           Maximal speed the UDC can handle. UDC must support this and all
44           slower speeds.
45
46       state
47           the state we are now (attached, suspended, configured, etc)
48
49       sg_supported
50           true if we can handle scatter-gather
51
52       is_otg
53           True if the USB device port uses a Mini-AB jack, so that the gadget
54           driver must provide a USB OTG descriptor.
55
56       is_a_peripheral
57           False unless is_otg, the “A” end of a USB cable is in the Mini-AB
58           jack, and HNP has been used to switch roles so that the “A” device
59           currently acts as A-Peripheral, not A-Host.
60
61       b_hnp_enable
62           OTG device feature flag, indicating that the A-Host enabled HNP
63           support.
64
65       a_hnp_support
66           OTG device feature flag, indicating that the A-Host supports HNP at
67           this port.
68
69       a_alt_hnp_support
70           OTG device feature flag, indicating that the A-Host only supports
71           HNP on a different root port.
72
73       name
74           Identifies the controller hardware type. Used in diagnostics and
75           sometimes configuration.
76
77       dev
78           Driver model state for this abstract device.
79
80       out_epnum
81           last used out ep number
82
83       in_epnum
84           last used in ep number
85

DESCRIPTION

87       Gadgets have a mostly-portable “gadget driver” implementing device
88       functions, handling all usb configurations and interfaces. Gadget
89       drivers talk to hardware-specific code indirectly, through ops vectors.
90       That insulates the gadget driver from hardware details, and packages
91       the hardware endpoints through generic i/o queues. The “usb_gadget” and
92       “usb_ep” interfaces provide that insulation from the hardware.
93
94       Except for the driver data, all fields in this structure are read-only
95       to the gadget driver. That driver data is part of the “driver model”
96       infrastructure in 2.6 (and later) kernels, and for earlier systems is
97       grouped in a similar structure that's not known to the rest of the
98       kernel.
99
100       Values of the three OTG device feature flags are updated before the
101       setup call corresponding to USB_REQ_SET_CONFIGURATION, and before
102       driver suspend calls. They are valid only when is_otg, and when the
103       device is acting as a B-Peripheral (so is_a_peripheral is false).
104

AUTHOR

106       David Brownell <dbrownell@users.sourceforge.net>
107           Author.
108
110Kernel Hackers Manual 3.10         June 2019              STRUCT USB_GADGET(9)
Impressum