/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * This file holds USB constants and structures that are needed for * USB device APIs. These are used by the USB device model, which is * defined in chapter 9 of the USB 2.0 specification and in the * Wireless USB 1.0 spec (now defunct). Linux has several APIs in C that * need these: * * - the master/host side Linux-USB kernel driver API; * - the "usbfs" user space API; and * - the Linux "gadget" slave/device/peripheral side driver API. * * USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems * act either as a USB master/host or as a USB slave/device. That means * the master and slave side APIs benefit from working well together. * * Note all descriptors are declared '__attribute__((packed))' so that: * * [a] they never get padded, either internally (USB spec writers * probably handled that) or externally; * * [b] so that accessing bigger-than-a-bytes fields will never * generate bus errors on any platform, even when the location of * its descriptor inside a bundle isn't "naturally aligned", and * * [c] for consistency, removing all doubt even when it appears to * someone that the two other points are non-issues for that * particular descriptor type. */ #ifndef _UAPI__LINUX_USB_CH9_H #define _UAPI__LINUX_USB_CH9_H #include <linux/types.h> /* __u8 etc */ #include <asm/byteorder.h> /* le16_to_cpu */ /*-------------------------------------------------------------------------*/ /* CONTROL REQUEST SUPPORT */ /* * USB directions * * This bit flag is used in endpoint descriptors' bEndpointAddress field. * It's also one of three fields in control requests bRequestType. */ #define USB_DIR_OUT … #define USB_DIR_IN … /* * USB types, the second of three bRequestType fields */ #define USB_TYPE_MASK … #define USB_TYPE_STANDARD … #define USB_TYPE_CLASS … #define USB_TYPE_VENDOR … #define USB_TYPE_RESERVED … /* * USB recipients, the third of three bRequestType fields */ #define USB_RECIP_MASK … #define USB_RECIP_DEVICE … #define USB_RECIP_INTERFACE … #define USB_RECIP_ENDPOINT … #define USB_RECIP_OTHER … /* From Wireless USB 1.0 */ #define USB_RECIP_PORT … #define USB_RECIP_RPIPE … /* * Standard requests, for the bRequest field of a SETUP packet. * * These are qualified by the bRequestType field, so that for example * TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved * by a GET_STATUS request. */ #define USB_REQ_GET_STATUS … #define USB_REQ_CLEAR_FEATURE … #define USB_REQ_SET_FEATURE … #define USB_REQ_SET_ADDRESS … #define USB_REQ_GET_DESCRIPTOR … #define USB_REQ_SET_DESCRIPTOR … #define USB_REQ_GET_CONFIGURATION … #define USB_REQ_SET_CONFIGURATION … #define USB_REQ_GET_INTERFACE … #define USB_REQ_SET_INTERFACE … #define USB_REQ_SYNCH_FRAME … #define USB_REQ_SET_SEL … #define USB_REQ_SET_ISOCH_DELAY … #define USB_REQ_SET_ENCRYPTION … #define USB_REQ_GET_ENCRYPTION … #define USB_REQ_RPIPE_ABORT … #define USB_REQ_SET_HANDSHAKE … #define USB_REQ_RPIPE_RESET … #define USB_REQ_GET_HANDSHAKE … #define USB_REQ_SET_CONNECTION … #define USB_REQ_SET_SECURITY_DATA … #define USB_REQ_GET_SECURITY_DATA … #define USB_REQ_SET_WUSB_DATA … #define USB_REQ_LOOPBACK_DATA_WRITE … #define USB_REQ_LOOPBACK_DATA_READ … #define USB_REQ_SET_INTERFACE_DS … /* specific requests for USB Power Delivery */ #define USB_REQ_GET_PARTNER_PDO … #define USB_REQ_GET_BATTERY_STATUS … #define USB_REQ_SET_PDO … #define USB_REQ_GET_VDM … #define USB_REQ_SEND_VDM … /* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command, * used by hubs to put ports into a new L1 suspend state, except that it * forgot to define its number ... */ /* * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and * are read as a bit array returned by USB_REQ_GET_STATUS. (So there * are at most sixteen features of each type.) Hubs may also support a * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend. */ #define USB_DEVICE_SELF_POWERED … #define USB_DEVICE_REMOTE_WAKEUP … #define USB_DEVICE_TEST_MODE … #define USB_DEVICE_BATTERY … #define USB_DEVICE_B_HNP_ENABLE … #define USB_DEVICE_WUSB_DEVICE … #define USB_DEVICE_A_HNP_SUPPORT … #define USB_DEVICE_A_ALT_HNP_SUPPORT … #define USB_DEVICE_DEBUG_MODE … /* * Test Mode Selectors * See USB 2.0 spec Table 9-7 */ #define USB_TEST_J … #define USB_TEST_K … #define USB_TEST_SE0_NAK … #define USB_TEST_PACKET … #define USB_TEST_FORCE_ENABLE … /* Status Type */ #define USB_STATUS_TYPE_STANDARD … #define USB_STATUS_TYPE_PTM … /* * New Feature Selectors as added by USB 3.0 * See USB 3.0 spec Table 9-7 */ #define USB_DEVICE_U1_ENABLE … #define USB_DEVICE_U2_ENABLE … #define USB_DEVICE_LTM_ENABLE … #define USB_INTRF_FUNC_SUSPEND … #define USB_INTR_FUNC_SUSPEND_OPT_MASK … /* * Suspend Options, Table 9-8 USB 3.0 spec */ #define USB_INTRF_FUNC_SUSPEND_LP … #define USB_INTRF_FUNC_SUSPEND_RW … /* * Interface status, Figure 9-5 USB 3.0 spec */ #define USB_INTRF_STAT_FUNC_RW_CAP … #define USB_INTRF_STAT_FUNC_RW … #define USB_ENDPOINT_HALT … /* Bit array elements as returned by the USB_REQ_GET_STATUS request. */ #define USB_DEV_STAT_U1_ENABLED … #define USB_DEV_STAT_U2_ENABLED … #define USB_DEV_STAT_LTM_ENABLED … /* * Feature selectors from Table 9-8 USB Power Delivery spec */ #define USB_DEVICE_BATTERY_WAKE_MASK … #define USB_DEVICE_OS_IS_PD_AWARE … #define USB_DEVICE_POLICY_MODE … #define USB_PORT_PR_SWAP … #define USB_PORT_GOTO_MIN … #define USB_PORT_RETURN_POWER … #define USB_PORT_ACCEPT_PD_REQUEST … #define USB_PORT_REJECT_PD_REQUEST … #define USB_PORT_PORT_PD_RESET … #define USB_PORT_C_PORT_PD_CHANGE … #define USB_PORT_CABLE_PD_RESET … #define USB_DEVICE_CHARGING_POLICY … /** * struct usb_ctrlrequest - SETUP data for a USB device control request * @bRequestType: matches the USB bmRequestType field * @bRequest: matches the USB bRequest field * @wValue: matches the USB wValue field (le16 byte order) * @wIndex: matches the USB wIndex field (le16 byte order) * @wLength: matches the USB wLength field (le16 byte order) * * This structure is used to send control requests to a USB device. It matches * the different fields of the USB 2.0 Spec section 9.3, table 9-2. See the * USB spec for a fuller description of the different fields, and what they are * used for. * * Note that the driver for any interface can issue control requests. * For most devices, interfaces don't coordinate with each other, so * such requests may be made at any time. */ struct usb_ctrlrequest { … } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ /* * STANDARD DESCRIPTORS ... as returned by GET_DESCRIPTOR, or * (rarely) accepted by SET_DESCRIPTOR. * * Note that all multi-byte values here are encoded in little endian * byte order "on the wire". Within the kernel and when exposed * through the Linux-USB APIs, they are not converted to cpu byte * order; it is the responsibility of the client code to do this. * The single exception is when device and configuration descriptors (but * not other descriptors) are read from character devices * (i.e. /dev/bus/usb/BBB/DDD); * in this case the fields are converted to host endianness by the kernel. */ /* * Descriptor types ... USB 2.0 spec table 9.5 */ #define USB_DT_DEVICE … #define USB_DT_CONFIG … #define USB_DT_STRING … #define USB_DT_INTERFACE … #define USB_DT_ENDPOINT … #define USB_DT_DEVICE_QUALIFIER … #define USB_DT_OTHER_SPEED_CONFIG … #define USB_DT_INTERFACE_POWER … /* these are from a minor usb 2.0 revision (ECN) */ #define USB_DT_OTG … #define USB_DT_DEBUG … #define USB_DT_INTERFACE_ASSOCIATION … /* these are from the Wireless USB spec */ #define USB_DT_SECURITY … #define USB_DT_KEY … #define USB_DT_ENCRYPTION_TYPE … #define USB_DT_BOS … #define USB_DT_DEVICE_CAPABILITY … #define USB_DT_WIRELESS_ENDPOINT_COMP … #define USB_DT_WIRE_ADAPTER … #define USB_DT_RPIPE … #define USB_DT_CS_RADIO_CONTROL … /* From the T10 UAS specification */ #define USB_DT_PIPE_USAGE … /* From the USB 3.0 spec */ #define USB_DT_SS_ENDPOINT_COMP … /* From the USB 3.1 spec */ #define USB_DT_SSP_ISOC_ENDPOINT_COMP … /* Conventional codes for class-specific descriptors. The convention is * defined in the USB "Common Class" Spec (3.11). Individual class specs * are authoritative for their usage, not the "common class" writeup. */ #define USB_DT_CS_DEVICE … #define USB_DT_CS_CONFIG … #define USB_DT_CS_STRING … #define USB_DT_CS_INTERFACE … #define USB_DT_CS_ENDPOINT … /* All standard descriptors have these 2 fields at the beginning */ struct usb_descriptor_header { … } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_DEVICE: Device descriptor */ struct usb_device_descriptor { … } __attribute__ ((packed)); #define USB_DT_DEVICE_SIZE … /* * Device and/or Interface Class codes * as found in bDeviceClass or bInterfaceClass * and defined by www.usb.org documents */ #define USB_CLASS_PER_INTERFACE … #define USB_CLASS_AUDIO … #define USB_CLASS_COMM … #define USB_CLASS_HID … #define USB_CLASS_PHYSICAL … #define USB_CLASS_STILL_IMAGE … #define USB_CLASS_PRINTER … #define USB_CLASS_MASS_STORAGE … #define USB_CLASS_HUB … #define USB_CLASS_CDC_DATA … #define USB_CLASS_CSCID … #define USB_CLASS_CONTENT_SEC … #define USB_CLASS_VIDEO … #define USB_CLASS_WIRELESS_CONTROLLER … #define USB_CLASS_PERSONAL_HEALTHCARE … #define USB_CLASS_AUDIO_VIDEO … #define USB_CLASS_BILLBOARD … #define USB_CLASS_USB_TYPE_C_BRIDGE … #define USB_CLASS_MISC … #define USB_CLASS_APP_SPEC … #define USB_CLASS_VENDOR_SPEC … #define USB_SUBCLASS_VENDOR_SPEC … /*-------------------------------------------------------------------------*/ /* USB_DT_CONFIG: Configuration descriptor information. * * USB_DT_OTHER_SPEED_CONFIG is the same descriptor, except that the * descriptor type is different. Highspeed-capable devices can look * different depending on what speed they're currently running. Only * devices with a USB_DT_DEVICE_QUALIFIER have any OTHER_SPEED_CONFIG * descriptors. */ struct usb_config_descriptor { … } __attribute__ ((packed)); #define USB_DT_CONFIG_SIZE … /* from config descriptor bmAttributes */ #define USB_CONFIG_ATT_ONE … #define USB_CONFIG_ATT_SELFPOWER … #define USB_CONFIG_ATT_WAKEUP … #define USB_CONFIG_ATT_BATTERY … /*-------------------------------------------------------------------------*/ /* USB String descriptors can contain at most 126 characters. */ #define USB_MAX_STRING_LEN … /* USB_DT_STRING: String descriptor */ struct usb_string_descriptor { … } __attribute__ ((packed)); /* note that "string" zero is special, it holds language codes that * the device supports, not Unicode characters. */ /*-------------------------------------------------------------------------*/ /* USB_DT_INTERFACE: Interface descriptor */ struct usb_interface_descriptor { … } __attribute__ ((packed)); #define USB_DT_INTERFACE_SIZE … /*-------------------------------------------------------------------------*/ /* USB_DT_ENDPOINT: Endpoint descriptor */ struct usb_endpoint_descriptor { … } __attribute__ ((packed)); #define USB_DT_ENDPOINT_SIZE … #define USB_DT_ENDPOINT_AUDIO_SIZE … /* * Endpoints */ #define USB_ENDPOINT_NUMBER_MASK … #define USB_ENDPOINT_DIR_MASK … #define USB_ENDPOINT_XFERTYPE_MASK … #define USB_ENDPOINT_XFER_CONTROL … #define USB_ENDPOINT_XFER_ISOC … #define USB_ENDPOINT_XFER_BULK … #define USB_ENDPOINT_XFER_INT … #define USB_ENDPOINT_MAX_ADJUSTABLE … #define USB_ENDPOINT_MAXP_MASK … #define USB_EP_MAXP_MULT_SHIFT … #define USB_EP_MAXP_MULT_MASK … #define USB_EP_MAXP_MULT(m) … /* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep type. */ #define USB_ENDPOINT_INTRTYPE … #define USB_ENDPOINT_INTR_PERIODIC … #define USB_ENDPOINT_INTR_NOTIFICATION … #define USB_ENDPOINT_SYNCTYPE … #define USB_ENDPOINT_SYNC_NONE … #define USB_ENDPOINT_SYNC_ASYNC … #define USB_ENDPOINT_SYNC_ADAPTIVE … #define USB_ENDPOINT_SYNC_SYNC … #define USB_ENDPOINT_USAGE_MASK … #define USB_ENDPOINT_USAGE_DATA … #define USB_ENDPOINT_USAGE_FEEDBACK … #define USB_ENDPOINT_USAGE_IMPLICIT_FB … /*-------------------------------------------------------------------------*/ /** * usb_endpoint_num - get the endpoint's number * @epd: endpoint to be checked * * Returns @epd's number: 0 to 15. */ static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd) { … } /** * usb_endpoint_type - get the endpoint's transfer type * @epd: endpoint to be checked * * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according * to @epd's transfer type. */ static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd) { … } /** * usb_endpoint_dir_in - check if the endpoint has IN direction * @epd: endpoint to be checked * * Returns true if the endpoint is of type IN, otherwise it returns false. */ static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd) { … } /** * usb_endpoint_dir_out - check if the endpoint has OUT direction * @epd: endpoint to be checked * * Returns true if the endpoint is of type OUT, otherwise it returns false. */ static inline int usb_endpoint_dir_out( const struct usb_endpoint_descriptor *epd) { … } /** * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type * @epd: endpoint to be checked * * Returns true if the endpoint is of type bulk, otherwise it returns false. */ static inline int usb_endpoint_xfer_bulk( const struct usb_endpoint_descriptor *epd) { … } /** * usb_endpoint_xfer_control - check if the endpoint has control transfer type * @epd: endpoint to be checked * * Returns true if the endpoint is of type control, otherwise it returns false. */ static inline int usb_endpoint_xfer_control( const struct usb_endpoint_descriptor *epd) { … } /** * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type * @epd: endpoint to be checked * * Returns true if the endpoint is of type interrupt, otherwise it returns * false. */ static inline int usb_endpoint_xfer_int( const struct usb_endpoint_descriptor *epd) { … } /** * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type * @epd: endpoint to be checked * * Returns true if the endpoint is of type isochronous, otherwise it returns * false. */ static inline int usb_endpoint_xfer_isoc( const struct usb_endpoint_descriptor *epd) { … } /** * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN * @epd: endpoint to be checked * * Returns true if the endpoint has bulk transfer type and IN direction, * otherwise it returns false. */ static inline int usb_endpoint_is_bulk_in( const struct usb_endpoint_descriptor *epd) { … } /** * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT * @epd: endpoint to be checked * * Returns true if the endpoint has bulk transfer type and OUT direction, * otherwise it returns false. */ static inline int usb_endpoint_is_bulk_out( const struct usb_endpoint_descriptor *epd) { … } /** * usb_endpoint_is_int_in - check if the endpoint is interrupt IN * @epd: endpoint to be checked * * Returns true if the endpoint has interrupt transfer type and IN direction, * otherwise it returns false. */ static inline int usb_endpoint_is_int_in( const struct usb_endpoint_descriptor *epd) { … } /** * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT * @epd: endpoint to be checked * * Returns true if the endpoint has interrupt transfer type and OUT direction, * otherwise it returns false. */ static inline int usb_endpoint_is_int_out( const struct usb_endpoint_descriptor *epd) { … } /** * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN * @epd: endpoint to be checked * * Returns true if the endpoint has isochronous transfer type and IN direction, * otherwise it returns false. */ static inline int usb_endpoint_is_isoc_in( const struct usb_endpoint_descriptor *epd) { … } /** * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT * @epd: endpoint to be checked * * Returns true if the endpoint has isochronous transfer type and OUT direction, * otherwise it returns false. */ static inline int usb_endpoint_is_isoc_out( const struct usb_endpoint_descriptor *epd) { … } /** * usb_endpoint_maxp - get endpoint's max packet size * @epd: endpoint to be checked * * Returns @epd's max packet bits [10:0] */ static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd) { … } /** * usb_endpoint_maxp_mult - get endpoint's transactional opportunities * @epd: endpoint to be checked * * Return @epd's wMaxPacketSize[12:11] + 1 */ static inline int usb_endpoint_maxp_mult(const struct usb_endpoint_descriptor *epd) { … } static inline int usb_endpoint_interrupt_type( const struct usb_endpoint_descriptor *epd) { … } /*-------------------------------------------------------------------------*/ /* USB_DT_SSP_ISOC_ENDPOINT_COMP: SuperSpeedPlus Isochronous Endpoint Companion * descriptor */ struct usb_ssp_isoc_ep_comp_descriptor { … } __attribute__ ((packed)); #define USB_DT_SSP_ISOC_EP_COMP_SIZE … /*-------------------------------------------------------------------------*/ /* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */ struct usb_ss_ep_comp_descriptor { … } __attribute__ ((packed)); #define USB_DT_SS_EP_COMP_SIZE … /* Bits 4:0 of bmAttributes if this is a bulk endpoint */ static inline int usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp) { … } /* Bits 1:0 of bmAttributes if this is an isoc endpoint */ #define USB_SS_MULT(p) … /* Bit 7 of bmAttributes if a SSP isoc endpoint companion descriptor exists */ #define USB_SS_SSP_ISOC_COMP(p) … /*-------------------------------------------------------------------------*/ /* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */ struct usb_qualifier_descriptor { … } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_OTG (from OTG 1.0a supplement) */ struct usb_otg_descriptor { … } __attribute__ ((packed)); /* USB_DT_OTG (from OTG 2.0 supplement) */ struct usb_otg20_descriptor { … } __attribute__ ((packed)); /* from usb_otg_descriptor.bmAttributes */ #define USB_OTG_SRP … #define USB_OTG_HNP … #define USB_OTG_ADP … /* OTG 3.0 */ #define USB_OTG_RSP … #define OTG_STS_SELECTOR … /*-------------------------------------------------------------------------*/ /* USB_DT_DEBUG: for special highspeed devices, replacing serial console */ struct usb_debug_descriptor { … } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */ struct usb_interface_assoc_descriptor { … } __attribute__ ((packed)); #define USB_DT_INTERFACE_ASSOCIATION_SIZE … /*-------------------------------------------------------------------------*/ /* USB_DT_SECURITY: group of wireless security descriptors, including * encryption types available for setting up a CC/association. */ struct usb_security_descriptor { … } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_KEY: used with {GET,SET}_SECURITY_DATA; only public keys * may be retrieved. */ struct usb_key_descriptor { … } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_ENCRYPTION_TYPE: bundled in DT_SECURITY groups */ struct usb_encryption_descriptor { … } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_BOS: group of device-level capabilities */ struct usb_bos_descriptor { … } __attribute__((packed)); #define USB_DT_BOS_SIZE … /*-------------------------------------------------------------------------*/ /* USB_DT_DEVICE_CAPABILITY: grouped with BOS */ struct usb_dev_cap_header { … } __attribute__((packed)); #define USB_CAP_TYPE_WIRELESS_USB … struct usb_wireless_cap_descriptor { … } __attribute__((packed)); #define USB_DT_USB_WIRELESS_CAP_SIZE … /* USB 2.0 Extension descriptor */ #define USB_CAP_TYPE_EXT … struct usb_ext_cap_descriptor { … } __attribute__((packed)); #define USB_DT_USB_EXT_CAP_SIZE … /* * SuperSpeed USB Capability descriptor: Defines the set of SuperSpeed USB * specific device level capabilities */ #define USB_SS_CAP_TYPE … struct usb_ss_cap_descriptor { … } __attribute__((packed)); #define USB_DT_USB_SS_CAP_SIZE … /* * Container ID Capability descriptor: Defines the instance unique ID used to * identify the instance across all operating modes */ #define CONTAINER_ID_TYPE … struct usb_ss_container_id_descriptor { … } __attribute__((packed)); #define USB_DT_USB_SS_CONTN_ID_SIZE … /* * Platform Device Capability descriptor: Defines platform specific device * capabilities */ #define USB_PLAT_DEV_CAP_TYPE … struct usb_plat_dev_cap_descriptor { … } __attribute__((packed)); #define USB_DT_USB_PLAT_DEV_CAP_SIZE(capability_data_size) … /* * SuperSpeed Plus USB Capability descriptor: Defines the set of * SuperSpeed Plus USB specific device level capabilities */ #define USB_SSP_CAP_TYPE … struct usb_ssp_cap_descriptor { … } __attribute__((packed)); /* * USB Power Delivery Capability Descriptor: * Defines capabilities for PD */ /* Defines the various PD Capabilities of this device */ #define USB_PD_POWER_DELIVERY_CAPABILITY … /* Provides information on each battery supported by the device */ #define USB_PD_BATTERY_INFO_CAPABILITY … /* The Consumer characteristics of a Port on the device */ #define USB_PD_PD_CONSUMER_PORT_CAPABILITY … /* The provider characteristics of a Port on the device */ #define USB_PD_PD_PROVIDER_PORT_CAPABILITY … struct usb_pd_cap_descriptor { … } __attribute__((packed)); struct usb_pd_cap_battery_info_descriptor { … } __attribute__((packed)); struct usb_pd_cap_consumer_port_descriptor { … } __attribute__((packed)); struct usb_pd_cap_provider_port_descriptor { … } __attribute__((packed)); /* * Precision time measurement capability descriptor: advertised by devices and * hubs that support PTM */ #define USB_PTM_CAP_TYPE … struct usb_ptm_cap_descriptor { … } __attribute__((packed)); #define USB_DT_USB_PTM_ID_SIZE … /* * The size of the descriptor for the Sublink Speed Attribute Count * (SSAC) specified in bmAttributes[4:0]. SSAC is zero-based */ #define USB_DT_USB_SSP_CAP_SIZE(ssac) … /*-------------------------------------------------------------------------*/ /* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with * each endpoint descriptor for a wireless device */ struct usb_wireless_ep_comp_descriptor { … } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_REQ_SET_HANDSHAKE is a four-way handshake used between a wireless * host and a device for connection set up, mutual authentication, and * exchanging short lived session keys. The handshake depends on a CC. */ struct usb_handshake { … } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_REQ_SET_CONNECTION modifies or revokes a connection context (CC). * A CC may also be set up using non-wireless secure channels (including * wired USB!), and some devices may support CCs with multiple hosts. */ struct usb_connection_context { … } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB 2.0 defines three speeds, here's how Linux identifies them */ enum usb_device_speed { … }; enum usb_device_state { … }; enum usb3_link_state { … }; /* * A U1 timeout of 0x0 means the parent hub will reject any transitions to U1. * 0xff means the parent hub will accept transitions to U1, but will not * initiate a transition. * * A U1 timeout of 0x1 to 0x7F also causes the hub to initiate a transition to * U1 after that many microseconds. Timeouts of 0x80 to 0xFE are reserved * values. * * A U2 timeout of 0x0 means the parent hub will reject any transitions to U2. * 0xff means the parent hub will accept transitions to U2, but will not * initiate a transition. * * A U2 timeout of 0x1 to 0xFE also causes the hub to initiate a transition to * U2 after N*256 microseconds. Therefore a U2 timeout value of 0x1 means a U2 * idle timer of 256 microseconds, 0x2 means 512 microseconds, 0xFE means * 65.024ms. */ #define USB3_LPM_DISABLED … #define USB3_LPM_U1_MAX_TIMEOUT … #define USB3_LPM_U2_MAX_TIMEOUT … #define USB3_LPM_DEVICE_INITIATED … struct usb_set_sel_req { … } __attribute__ ((packed)); /* * The Set System Exit Latency control transfer provides one byte each for * U1 SEL and U1 PEL, so the max exit latency is 0xFF. U2 SEL and U2 PEL each * are two bytes long. */ #define USB3_LPM_MAX_U1_SEL_PEL … #define USB3_LPM_MAX_U2_SEL_PEL … /*-------------------------------------------------------------------------*/ /* * As per USB compliance update, a device that is actively drawing * more than 100mA from USB must report itself as bus-powered in * the GetStatus(DEVICE) call. * https://compliance.usb.org/index.asp?UpdateFile=Electrical&Format=Standard#34 */ #define USB_SELF_POWER_VBUS_MAX_DRAW … #endif /* _UAPI__LINUX_USB_CH9_H */