USBSpec.h Reference

Declared in
USBSpec.h

Overview

Constants

See the Overview section above for header-level documentation.

USB Descriptor and IORegistry constants

Constants and definitions of parameters that are used in communcating with USB devices and interfaces.

   
#define kUSB1284DeviceID "1284 Device ID"
#define kUSBAlternateSetting "bAlternateSetting"
#define kUSBConfigurationValue "bConfigurationValue"
#define kUSBDeviceClass "bDeviceClass"
#define kUSBDeviceMaxPacketSize "bMaxPacketSize0"
#define kUSBDeviceNumConfigs "bNumConfigurations"
#define kUSBDeviceProtocol "bDeviceProtocol"
#define kUSBDeviceReleaseNumber "bcdDevice"
#define kUSBDeviceSubClass "bDeviceSubClass"
#define kUSBInterfaceClass "bInterfaceClass"
#define kUSBInterfaceNumber "bInterfaceNumber"
#define kUSBInterfaceProtocol "bInterfaceProtocol"
#define kUSBInterfaceStringIndex "iInterface"
#define kUSBInterfaceSubClass "bInterfaceSubClass"
#define kUSBManufacturerStringIndex "iManufacturer"
#define kUSBNumEndpoints "bNumEndpoints"
#define kUSBProductID "idProduct" // good name
#define kUSBProductName "idProduct" /* good name \
   */ // bad name - keep for backward compatibility
#define kUSBProductString "USB Product Name"
#define kUSBProductStringIndex "iProduct"
#define kUSBSerialNumberString "USB Serial Number"
#define kUSBSerialNumberStringIndex "iSerialNumber"
#define kUSBVendorID "idVendor" // good name
#define kUSBVendorName "idVendor" /* good name \
   */ // bad name - keep for backward compatibility
#define kUSBVendorString "USB Vendor Name"
Constants
kUSB1284DeviceID

IORegistry key for the 1284 Device ID of a printer

Available in OS X v10.6 and later.

Declared in USBSpec.h.

kUSBAlternateSetting

The field in the USB Configuration Descriptor corresponding to the number of configurations

Available in OS X v10.0 and later.

Declared in USBSpec.h.

kUSBConfigurationValue

The field in the USB Interface Descriptor corresponding to the configuration

Available in OS X v10.0 and later.

Declared in USBSpec.h.

kUSBDeviceClass

The field in the USB Device Descriptor corresponding to the device class

Available in OS X v10.0 and later.

Declared in USBSpec.h.

kUSBDeviceMaxPacketSize

The field in the USB Device Descriptor corresponding to the maximum packet size for endpoint 0

Available in OS X v10.1 and later.

Declared in USBSpec.h.

kUSBDeviceNumConfigs

The field in the USB Configuration Descriptor corresponding to the number of configurations

Available in OS X v10.0 and later.

Declared in USBSpec.h.

kUSBDeviceProtocol

The field in the USB Device Descriptor corresponding to the device protocol

Available in OS X v10.0 and later.

Declared in USBSpec.h.

kUSBDeviceReleaseNumber

The field in the USB Device Descriptor corresponding to the device release version

Available in OS X v10.0 and later.

Declared in USBSpec.h.

kUSBDeviceSubClass

The field in the USB Device Descriptor corresponding to the device sub class

Available in OS X v10.0 and later.

Declared in USBSpec.h.

kUSBInterfaceClass

The field in the USB Interface Descriptor corresponding to the interface class

Available in OS X v10.0 and later.

Declared in USBSpec.h.

kUSBInterfaceNumber

The field in the USB Configuration Descriptor corresponding to the number of configurations

Available in OS X v10.0 and later.

Declared in USBSpec.h.

kUSBInterfaceProtocol

The field in the USB Interface Descriptor corresponding to the interface protocol

Available in OS X v10.0 and later.

Declared in USBSpec.h.

kUSBInterfaceStringIndex

The field in the USB Interface Descriptor corresponding to the index for the interface name's string

Available in OS X v10.1 and later.

Declared in USBSpec.h.

kUSBInterfaceSubClass

The field in the USB Interface Descriptor corresponding to the interface sub class

Available in OS X v10.0 and later.

Declared in USBSpec.h.

kUSBManufacturerStringIndex

The field in the USB Device Descriptor corresponding to the index for the manufacturer's string

Available in OS X v10.1 and later.

Declared in USBSpec.h.

kUSBNumEndpoints

The field in the USB Configuration Descriptor corresponding to the number of configurations

Available in OS X v10.0 and later.

Declared in USBSpec.h.

kUSBProductID

The field in the USB Device Descriptor corresponding to the device USB Product ID

Available in OS X v10.1 and later.

Declared in USBSpec.h.

kUSBProductName

Deprecated. Use kUSBProductID

Available in OS X v10.0 and later.

Declared in USBSpec.h.

kUSBProductString

IORegistry key for the device's USB Product string

Available in OS X v10.6 and later.

Declared in USBSpec.h.

kUSBProductStringIndex

The field in the USB Device Descriptor corresponding to the index for the product name's string

Available in OS X v10.1 and later.

Declared in USBSpec.h.

kUSBSerialNumberString

IORegistry key for the device's USB serial number string

Available in OS X v10.6 and later.

Declared in USBSpec.h.

kUSBSerialNumberStringIndex

The field in the USB Device Descriptor corresponding to the index for the serial number's string

Available in OS X v10.1 and later.

Declared in USBSpec.h.

kUSBVendorID

The field in the USB Device Descriptor corresponding to the device USB Vendor ID

Available in OS X v10.1 and later.

Declared in USBSpec.h.

kUSBVendorName

Deprecated. Use kUSBVendorID

Available in OS X v10.0 and later.

Declared in USBSpec.h.

kUSBVendorString

IORegistry key for the device's USB manufacturer string

Available in OS X v10.6 and later.

Declared in USBSpec.h.

Apple USB Vendor ID

enum {
   kAppleVendorID = 0x05AC
};
Discussion

Apple's vendor ID, assigned by the USB-IF

Device Capability Types

enum {
   kUSBDeviceCapabilityWirelessUSB = 1,
   kUSBDeviceCapabilityUSB20Extension = 2,
   kUSBDeviceCapabilitySuperSpeedUSB = 3,
   kUSBDeviceCapabilityContainerID = 4
};
Discussion

Used with decoding the Device Capability descriptor

Device Class Codes

enum {
   kUSBCompositeClass = 0,
   kUSBCommClass = 2, // Deprecated
   kUSBCommunicationClass = 2,
   kUSBHubClass = 9,
   kUSBDataClass = 10,
   kUSBPersonalHealthcareClass = 15,
   kUSBDiagnosticClass = 220,
   kUSBWirelessControllerClass = 224,
   kUSBMiscellaneousClass = 239,
   kUSBApplicationSpecificClass = 254,
   kUSBVendorSpecificClass = 255
};
Discussion

Constants for USB Device classes (bDeviceClass).

Device Request

enum {
   kUSBRqGetStatus = 0,
   kUSBRqClearFeature = 1,
   kUSBRqGetState = 2,
   kUSBRqSetFeature = 3,
   kUSBRqReserved2 = 4,
   kUSBRqSetAddress = 5,
   kUSBRqGetDescriptor = 6,
   kUSBRqSetDescriptor = 7,
   kUSBRqGetConfig = 8,
   kUSBRqSetConfig = 9,
   kUSBRqGetInterface = 10,
   kUSBRqSetInterface = 11,
   kUSBRqSyncFrame = 12,
   kUSBSetSel = 48,
   kUSBSetIsochDelay = 49
};
Discussion

Specifies values for the bRequest field of a Device Request.

Device Request Recipient

enum {
   kUSBDevice = 0,
   kUSBInterface = 1,
   kUSBEndpoint = 2,
   kUSBOther = 3
};
Discussion

This recipient is encoded in the bmRequestType field of a Device Request. It specifies the type of recipient for a request: the device, the interface, or an endpoint.

Device Request Type

enum {
   kUSBStandard = 0,
   kUSBClass = 1,
   kUSBVendor = 2
};
Discussion

This type is encoded in the bmRequestType field of a Device Request. It specifies the type of request: standard, class or vendor specific.

DFU Class Attributes

enum {
   kUSBDFUAttributesMask = 0x07,
   kUSBDFUCanDownloadBit = 0,
   kUSBDFUCanUploadBit = 1,
   kUSBDFUManifestationTolerantBit = 2
};

Endpoint Descriptor bits

enum {
   kUSBbEndpointAddressMask = 0x0f,
   kUSBbEndpointDirectionBit = 7,
   kUSBbEndpointDirectionMask = (
   1 << kUSBbEndpointDirectionBit ),
   kUSBEndpointDirectionOut = 0x00,
   kUSBEndpointDirectionIn = 0x80,
   kUSBEndpointbmAttributesTransferTypeMask = 0x03,
   kUSBEndpointbmAttributesSynchronizationTypeMask = 0x0c,
   kUSBEndpointbmAttributesSynchronizationTypeShift = 2,
   kUSBEndpointbmAttributesUsageTypeMask = 0x30,
   kUSBEndpointbmAttributesUsageTypeShift = 4,
   kUSBPeriodicInterruptUsageType = 0,
   kUSBNotificationInterruptUsageType = 1,
   kUSBNoSynchronizationIsocSyncType = 0,
   kUSBAsynchronousIsocSyncType = 1,
   kUSBAdaptiveIsocSyncType = 2,
   kUSBSynchronousIsocSyncType = 3,
   kUSBDataIsocUsageType = 0,
   kUSBFeedbackIsocUsageType = 1,
   kUSBImplicitFeedbackDataIsocUsageType = 2
};
Discussion

Bit definitions for endpoint descriptor fields

Endpoint direction

enum {
   kUSBOut = 0,
   kUSBIn = 1,
   kUSBNone = 2,
   kUSBAnyDirn = 3
};
Discussion

Used in IOUSBFindEndpointRequest's direction field

Endpoint type

enum {
   kUSBControl = 0,
   kUSBIsoc = 1,
   kUSBBulk = 2,
   kUSBInterrupt = 3,
   kUSBAnyType = 0xFF
};
Discussion

Used in IOUSBFindEndpointRequest's type field

Feature Selectors

enum {
   kUSBFeatureEndpointStall = 0, // Endpoint
   kUSBFeatureDeviceRemoteWakeup = 1, // Device
   kUSBFeatureTestMode = 2, // Device
   kUSBFeatureFunctionSuspend = 0, // Interface
   kUSBFeatureU1Enable = 48, // Device
   kUSBFeatureU2Enable = 49, // Device
   kUSBFeatureLTMEnable = 50 // Device
};
Discussion

Used with SET/CLEAR_FEATURE requests.

HID Protocol

enum {
   kHIDBootProtocolValue = 0,
   kHIDReportProtocolValue = 1
};
Discussion

Used in the SET_PROTOCOL device request

HID report types

enum {
   kHIDRtInputReport = 1,
   kHIDRtOutputReport = 2,
   kHIDRtFeatureReport = 3
};
Discussion

Constants for the three kinds of HID reports.

HID requests

enum {
   kHIDRqGetReport = 1,
   kHIDRqGetIdle = 2,
   kHIDRqGetProtocol = 3,
   kHIDRqSetReport = 9,
   kHIDRqSetIdle = 10,
   kHIDRqSetProtocol = 11
};
Discussion

Constants for HID requests.

Interface Class

enum {
   kUSBAudioClass = 1, // Deprecated
   kUSBAudioInterfaceClass = 1,
   kUSBCommunicationControlInterfaceClass = 2,
   kUSBCommunicationDataInterfaceClass = 10,
   kUSBHIDClass = 3,
   kUSBHIDInterfaceClass = 3,
   kUSBPhysicalInterfaceClass = 5,
   kUSBImageInterfaceClass = 6,
   kUSBPrintingClass = 7, // Deprecated
   kUSBPrintingInterfaceClass = 7,
   kUSBMassStorageClass = 8, // Deprecated
   kUSBMassStorageInterfaceClass = 8,
   kUSBChipSmartCardInterfaceClass = 11,
   kUSBContentSecurityInterfaceClass = 13,
   kUSBVideoInterfaceClass = 14,
   kUSBPersonalHealthcareInterfaceClass = 15,
   kUSBDiagnosticDeviceInterfaceClass = 220,
   kUSBWirelessControllerInterfaceClass = 224,
   kUSBApplicationSpecificInterfaceClass = 254,
   kUSBVendorSpecificInterfaceClass = 255
};
Discussion

Constants for Interface classes (bInterfaceClass).

Interface Protocol

enum {
   // For kUSBHubClass
   kHubSuperSpeedProtocol = 3,
   // For kUSBHIDInterfaceClass
   //
   kHIDNoInterfaceProtocol = 0,
   kHIDKeyboardInterfaceProtocol = 1,
   kHIDMouseInterfaceProtocol = 2,
   kUSBVendorSpecificProtocol = 0xff,
   // For kUSBDiagnosticDeviceInterfaceClass
   //
   kUSB2ComplianceDeviceProtocol = 0x01,
   // For kUSBWirelessControllerInterfaceClass
   //
   kUSBBluetoothProgrammingInterfaceProtocol = 0x01,
   // For kUSBMiscellaneousClass
   //
   KUSBInterfaceAssociationDescriptorProtocol = 0x01,
   // For Mass Storage
   //
   kMSCProtocolControlBulkInterrupt = 0x00,
   kMSCProtocolControlBulk = 0x01,
   kMSCProtocolBulkOnly = 0x50,
   kMSCProtocolUSBAttachedSCSI = 0x62
};
Discussion

Reported in the bInterfaceProtocol field of the Interface Descriptor.

Interface SubClass

enum {
   kUSBCompositeSubClass = 0,
   kUSBHubSubClass = 0,
   // For the kUSBAudioInterfaceClass
   //
   kUSBAudioControlSubClass = 0x01,
   kUSBAudioStreamingSubClass = 0x02,
   kUSBMIDIStreamingSubClass = 0x03,
   // For the kUSBApplicationSpecificInterfaceClass
   //
   kUSBDFUSubClass = 0x01,
   kUSBIrDABridgeSubClass = 0x02,
   kUSBTestMeasurementSubClass = 0x03,
   // For the kUSBMassStorageInterfaceClass
   //
   kUSBMassStorageRBCSubClass = 0x01,
   kUSBMassStorageATAPISubClass = 0x02,
   kUSBMassStorageQIC157SubClass = 0x03,
   kUSBMassStorageUFISubClass = 0x04,
   kUSBMassStorageSFF8070iSubClass = 0x05,
   kUSBMassStorageSCSISubClass = 0x06,
   // For the kUSBHIDInterfaceClass
   //
   kUSBHIDBootInterfaceSubClass = 0x01,
   // For the kUSBCommunicationDataInterfaceClass
   //
   kUSBCommDirectLineSubClass = 0x01,
   kUSBCommAbstractSubClass = 0x02,
   kUSBCommTelephoneSubClass = 0x03,
   kUSBCommMultiChannelSubClass = 0x04,
   kUSBCommCAPISubClass = 0x05,
   kUSBCommEthernetNetworkingSubClass = 0x06,
   kUSBATMNetworkingSubClass = 0x07,
   // For the kUSBDiagnosticDeviceInterfaceClass
   //
   kUSBReprogrammableDiagnosticSubClass = 0x01,
   // For the kUSBWirelessControllerInterfaceClass
   //
   kUSBRFControllerSubClass = 0x01,
   // For the kUSBMiscellaneousClass
   //
   kUSBCommonClassSubClass = 0x02,
   // For the kUSBVideoInterfaceClass
   //
   kUSBVideoControlSubClass = 0x01,
   kUSBVideoStreamingSubClass = 0x02,
   kUSBVideoInterfaceCollectionSubClass = 0x03
};
Discussion

Constants for USB Interface SubClasses (bInterfaceSubClass).

Miscellaneous

enum {
   kUSBFunctionRemoteWakeCapableBit = 0, // GET_STATUS
   kUSBFunctionRemoteWakeupBit = 1, // GET_STATUS
   kUSBLowPowerSuspendStateBit = 0, // SET_FEATURE(FUNCTION_SUSPEND)
   kUSBFunctionRemoteWakeEnableBit = 1 // SET_FEATURE(FUNCTION_SUSPEND)
};
Discussion

bits and masks

Printer Class Requests

enum {
   kUSPrintingClassGetDeviceID = 0,
   kUSPrintingClassGePortStatus = 1,
   kUSPrintingClassSoftReset = 2
};
Discussion

The bRequest parameter for Printing Class Sepcific Requests

USB Descriptors

enum {
   kUSBAnyDesc = 0, // Wildcard for searches
   kUSBDeviceDesc = 1,
   kUSBConfDesc = 2,
   kUSBStringDesc = 3,
   kUSBInterfaceDesc = 4,
   kUSBEndpointDesc = 5,
   kUSBDeviceQualifierDesc = 6,
   kUSBOtherSpeedConfDesc = 7,
   kUSBInterfacePowerDesc = 8,
   kUSBOnTheGoDesc = 9,
   kUSDebugDesc = 10,
   kUSBInterfaceAssociationDesc = 11,
   kUSBBOSDescriptor = 15,
   kUSBDeviceCapability = 16,
   kUSBSuperSpeedEndpointCompanion = 48,
   kUSB3HUBDesc = 0x2A,
   kUSBHIDDesc = 0x21,
   kUSBReportDesc = 0x22,
   kUSBPhysicalDesc = 0x23,
   kUSBHUBDesc = 0x29,
};
Discussion

Specifies values for diffent descriptor types.

USB Device Capability Type constants

enum {
   kUSB20ExtensionLPMSupported = 1, // Bit 1 of bmAttributes of USB 2.0 Extension Device Capability
   kUSBSuperSpeedLTMCapable = 1, // Bit 1 of bmAttributes of SuperSpeed USB Device Capability
   kUSBSuperSpeedSupportsLS = 0, // Value of wSpeedSupported indicating that the device supports low speed
   kUSBSuperSpeedSupportsFS = 1, // Value of wSpeedSupported indicating that the device supports full speed
   kUSBSuperSpeedSupportsHS = 2, // Value of wSpeedSupported indicating that the device supports high speed
   kUSBSuperSpeedSupportsSS = 3, // Value of wSpeedSupported indicating that the device supports 5 Gbps
};
Discussion

Bit definitions and constants for different values of USB Device Capability types

USB Power constants

enum {
   kUSB100mAAvailable = 50,
   kUSB500mAAvailable = 250,
   kUSB100mA = 50,
   kUSBAtrBusPowered = 0x80,
   kUSBAtrSelfPowered = 0x40,
   kUSBAtrRemoteWakeup = 0x20,
   kUSB2MaxPowerPerPort = kUSB500mAAvailable * 2,
   kUSB150mAAvailable = 75,
   kUSB900mAAvailable = 450,
   kUSB150mA = 75,
   kUSB3MaxPowerPerPort = kUSB900mAAvailable * 2
};
Discussion

Constants relating to USB Power.

USB Release constants

enum {
   kUSBRel10 = 0x0100,
   kUSBRel11 = 0x0110,
   kUSBRel20 = 0x0200,
   kUSBRel30 = 0x0300
};
Discussion

Constants relating to USB releases as found in the bcdUSB field of the Device Descriptor.