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         unsigned is_dualspeed:1;
15         unsigned is_otg:1;
16         unsigned is_a_peripheral:1;
17         unsigned b_hnp_enable:1;
18         unsigned a_hnp_support:1;
19         unsigned a_alt_hnp_support:1;
20         const char * name;
21         struct device dev;
22       };
23

MEMBERS

25       ops
26           Function pointers used to access hardware-specific operations.
27
28       ep0
29           Endpoint zero, used when reading or writing responses to driver
30           setup requests
31
32       ep_list
33           List of other endpoints supported by the device.
34
35       speed
36           Speed of current connection to USB host.
37
38       is_dualspeed
39           True if the controller supports both high and full speed operation.
40           If it does, the gadget driver must also support both.
41
42       is_otg
43           True if the USB device port uses a Mini-AB jack, so that the gadget
44           driver must provide a USB OTG descriptor.
45
46       is_a_peripheral
47           False unless is_otg, the “A” end of a USB cable is in the Mini-AB
48           jack, and HNP has been used to switch roles so that the “A” device
49           currently acts as A-Peripheral, not A-Host.
50
51       b_hnp_enable
52           OTG device feature flag, indicating that the A-Host enabled HNP
53           support.
54
55       a_hnp_support
56           OTG device feature flag, indicating that the A-Host supports HNP at
57           this port.
58
59       a_alt_hnp_support
60           OTG device feature flag, indicating that the A-Host only supports
61           HNP on a different root port.
62
63       name
64           Identifies the controller hardware type. Used in diagnostics and
65           sometimes configuration.
66
67       dev
68           Driver model state for this abstract device.
69

DESCRIPTION

71       Gadgets have a mostly-portable “gadget driver” implementing device
72       functions, handling all usb configurations and interfaces. Gadget
73       drivers talk to hardware-specific code indirectly, through ops vectors.
74       That insulates the gadget driver from hardware details, and packages
75       the hardware endpoints through generic i/o queues. The “usb_gadget” and
76       “usb_ep” interfaces provide that insulation from the hardware.
77
78       Except for the driver data, all fields in this structure are read-only
79       to the gadget driver. That driver data is part of the “driver model”
80       infrastructure in 2.6 (and later) kernels, and for earlier systems is
81       grouped in a similar structure that´s not known to the rest of the
82       kernel.
83
84       Values of the three OTG device feature flags are updated before the
85       setup call corresponding to USB_REQ_SET_CONFIGURATION, and before
86       driver suspend calls. They are valid only when is_otg, and when the
87       device is acting as a B-Peripheral (so is_a_peripheral is false).
88

AUTHOR

90       David Brownell <dbrownell@users.sourceforge.net>
91           Author.
92
94Kernel Hackers Manual 2.6.         June 2019              STRUCT USB_GADGET(9)
Impressum