include/linux/usb/composite.h
Source file repositories/reference/linux-study-clean/include/linux/usb/composite.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/usb/composite.h- Extension
.h- Size
- 25107 bytes
- Lines
- 636
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bcd.hlinux/version.hlinux/usb/ch9.hlinux/usb/gadget.hlinux/usb/webusb.hlinux/log2.hlinux/configfs.h
Detected Declarations
struct usb_configurationstruct usb_os_desc_ext_propstruct usb_os_descstruct usb_os_desc_tablestruct usb_functionstruct usb_configurationstruct usb_composite_driverstruct usb_composite_devstruct usb_composite_overwritestruct usb_function_driverstruct usb_function_instancefunction get_default_bcdDevice
Annotated Snippet
* module may only use this macro once, and calling it replaces module_init()
* and module_exit()
*/
#define module_usb_composite_driver(__usb_composite_driver) \
module_driver(__usb_composite_driver, usb_composite_probe, \
usb_composite_unregister)
extern void usb_composite_setup_continue(struct usb_composite_dev *cdev);
extern int composite_dev_prepare(struct usb_composite_driver *composite,
struct usb_composite_dev *cdev);
extern int composite_os_desc_req_prepare(struct usb_composite_dev *cdev,
struct usb_ep *ep0);
void composite_dev_cleanup(struct usb_composite_dev *cdev);
void check_remote_wakeup_config(struct usb_gadget *g,
struct usb_configuration *c);
static inline struct usb_composite_driver *to_cdriver(
struct usb_gadget_driver *gdrv)
{
return container_of(gdrv, struct usb_composite_driver, gadget_driver);
}
#define OS_STRING_QW_SIGN_LEN 14
#define OS_STRING_IDX 0xEE
/**
* struct usb_composite_dev - represents one composite usb gadget
* @gadget: read-only, abstracts the gadget's usb peripheral controller
* @req: used for control responses; buffer is pre-allocated
* @os_desc_req: used for OS descriptors responses; buffer is pre-allocated
* @config: the currently active configuration
* @qw_sign: qwSignature part of the OS string
* @b_vendor_code: bMS_VendorCode part of the OS string
* @use_os_string: false by default, interested gadgets set it
* @bcd_webusb_version: 0x0100 by default, WebUSB specification version
* @b_webusb_vendor_code: 0x0 by default, vendor code for WebUSB
* @landing_page: empty by default, landing page to announce in WebUSB
* @use_webusb: false by default, interested gadgets set it
* @os_desc_config: the configuration to be used with OS descriptors
* @setup_pending: true when setup request is queued but not completed
* @os_desc_pending: true when os_desc request is queued but not completed
*
* One of these devices is allocated and initialized before the
* associated device driver's bind() is called.
*/
struct usb_composite_dev {
struct usb_gadget *gadget;
struct usb_request *req;
struct usb_request *os_desc_req;
struct usb_configuration *config;
/* OS String is a custom (yet popular) extension to the USB standard. */
u8 qw_sign[OS_STRING_QW_SIGN_LEN];
u8 b_vendor_code;
struct usb_configuration *os_desc_config;
unsigned int use_os_string:1;
/* WebUSB */
u16 bcd_webusb_version;
u8 b_webusb_vendor_code;
char landing_page[WEBUSB_URL_RAW_MAX_LENGTH];
unsigned int use_webusb:1;
/* private: */
/* internals */
unsigned int suspended:1;
struct usb_device_descriptor desc;
struct list_head configs;
struct list_head gstrings;
struct usb_composite_driver *driver;
u8 next_string_id;
char *def_manufacturer;
struct usb_string *usb_strings;
/* the gadget driver won't enable the data pullup
* while the deactivation count is nonzero.
*/
unsigned deactivations;
/* the composite driver won't complete the control transfer's
* data/status stages till delayed_status is zero.
*/
int delayed_status;
/* protects deactivations and delayed_status counts*/
spinlock_t lock;
/* public: */
unsigned int setup_pending:1;
Annotation
- Immediate include surface: `linux/bcd.h`, `linux/version.h`, `linux/usb/ch9.h`, `linux/usb/gadget.h`, `linux/usb/webusb.h`, `linux/log2.h`, `linux/configfs.h`.
- Detected declarations: `struct usb_configuration`, `struct usb_os_desc_ext_prop`, `struct usb_os_desc`, `struct usb_os_desc_table`, `struct usb_function`, `struct usb_configuration`, `struct usb_composite_driver`, `struct usb_composite_dev`, `struct usb_composite_overwrite`, `struct usb_function_driver`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.