ADC Home > Reference Library > Reference > Hardware & Drivers > I/O Kit Framework Reference

 


USBSpec.h

Include Path :

<IOKit/usb>

Path:

/System/Library/Frameworks/IOKit.framework/Versions/A/Headers/usb/USBSpec.h

Overview

This header contains constants and definitions of parameters that are used in communcating with USB devices and interfaces.



Enumerations


Device Class Codes


enum { 
    kUSBCompositeClass = 0, 
    kUSBCommClass = 2, // Deprecated 
    kUSBCommunicationClass = 2, 
    kUSBHubClass = 9, 
    kUSBDataClass = 10, 
    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 
};  
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 
};  
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, 
    kUSBFeatureDeviceRemoteWakeup = 1 
};  
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 = 12,  
    kUSBVideoInterfaceClass = 14,  
    kUSBDiagnosticDeviceInterfaceClass = 220,  
    kUSBWirelessControllerInterfaceClass = 224,  
    kUSBApplicationSpecificInterfaceClass = 254,  
    kUSBVendorSpecificInterfaceClass = 255 
};  
Discussion

Constants for Interface classes (bInterfaceClass).


Interface Protocol


enum {  
    // For kUSBHIDInterfaceClass 
    // 
    kHIDNoInterfaceProtocol = 0, 
    kHIDKeyboardInterfaceProtocol = 1, 
    kHIDMouseInterfaceProtocol = 2, 
    kUSBVendorSpecificProtocol = 0xff,  
    // For kUSBDiagnosticDeviceInterfaceClass 
    // 
    kUSB2ComplianceDeviceProtocol = 0x01,  
    // For kUSBWirelessControllerInterfaceClass 
    // 
    kUSBBluetoothProgrammingInterfaceProtocol = 0x01,  
    // For kUSBMiscellaneousClass 
    // 
    KUSBInterfaceAssociationDescriptorProtocol = 0x01  
};  
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).


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, 
    kUSBHIDDesc = 0x21, 
    kUSBReportDesc = 0x22, 
    kUSBPhysicalDesc = 0x23, 
    kUSBHUBDesc = 0x29 
};  
Discussion

Specifies values for diffent descriptor types.


USB Power constants


enum { 
    kUSB100mAAvailable = 50, 
    kUSB500mAAvailable = 250, 
    kUSB100mA = 50, 
    kUSBAtrBusPowered = 0x80, 
    kUSBAtrSelfPowered = 0x40, 
    kUSBAtrRemoteWakeup = 0x20 
};  
Discussion

Constants relating to USB Power.


USB Release constants


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

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

#defines


kUSBAlternateSetting


See Also:

Property

 #define kUSBAlternateSetting "bAlternateSetting" 
Discussion

USB property names taken from the field names in various descriptors


kUSBConfigurationValue


See Also:

Property

 #define kUSBConfigurationValue "bConfigurationValue" 
Discussion

USB property names taken from the field names in various descriptors


kUSBDeviceClass


See Also:

Property

 #define kUSBDeviceClass "bDeviceClass" 
Discussion

USB property names taken from the field names in various descriptors


kUSBDeviceMaxPacketSize


See Also:

Property

 #define kUSBDeviceMaxPacketSize "bMaxPacketSize0" 
Discussion

USB property names taken from the field names in various descriptors


kUSBDeviceNumConfigs


See Also:

Property

 #define kUSBDeviceNumConfigs "bNumConfigurations" 
Discussion

USB property names taken from the field names in various descriptors


kUSBDeviceProtocol


See Also:

Property

 #define kUSBDeviceProtocol "bDeviceProtocol" 
Discussion

USB property names taken from the field names in various descriptors


kUSBDeviceReleaseNumber


See Also:

Property

 #define kUSBDeviceReleaseNumber "bcdDevice" 
Discussion

USB property names taken from the field names in various descriptors


kUSBDeviceSubClass


See Also:

Property

 #define kUSBDeviceSubClass "bDeviceSubClass" 
Discussion

USB property names taken from the field names in various descriptors


kUSBInterfaceClass


See Also:

Property

 #define kUSBInterfaceClass "bInterfaceClass" 
Discussion

USB property names taken from the field names in various descriptors


kUSBInterfaceNumber


See Also:

Property

 #define kUSBInterfaceNumber "bInterfaceNumber" 
Discussion

USB property names taken from the field names in various descriptors


kUSBInterfaceProtocol


See Also:

Property

 #define kUSBInterfaceProtocol "bInterfaceProtocol" 
Discussion

USB property names taken from the field names in various descriptors


kUSBInterfaceStringIndex


See Also:

Property

 #define kUSBInterfaceStringIndex "iInterface" 
Discussion

USB property names taken from the field names in various descriptors


kUSBInterfaceSubClass


See Also:

Property

 #define kUSBInterfaceSubClass "bInterfaceSubClass" 
Discussion

USB property names taken from the field names in various descriptors


kUSBManufacturerStringIndex


See Also:

Property

 #define kUSBManufacturerStringIndex "iManufacturer" 
Discussion

USB property names taken from the field names in various descriptors


kUSBNumEndpoints


See Also:

Property

 #define kUSBNumEndpoints "bNumEndpoints" 
Discussion

USB property names taken from the field names in various descriptors


kUSBProductID


See Also:

Property

 #define kUSBProductID "idProduct" // good name  
Discussion

USB property names taken from the field names in various descriptors


kUSBProductName


See Also:

Property

 #define kUSBProductName "idProduct" // bad name - keep for backward compatibility  
Discussion

USB property names taken from the field names in various descriptors


kUSBProductStringIndex


See Also:

Property

 #define kUSBProductStringIndex "iProduct" 
Discussion

USB property names taken from the field names in various descriptors


kUSBSerialNumberStringIndex


See Also:

Property

 #define kUSBSerialNumberStringIndex "iSerialNumber" 
Discussion

USB property names taken from the field names in various descriptors


kUSBVendorID


See Also:

Property

 #define kUSBVendorID "idVendor" // good name  
Discussion

USB property names taken from the field names in various descriptors


kUSBVendorName


See Also:

Property

 #define kUSBVendorName "idVendor" // bad name - keep for backward compatibility  
Discussion

USB property names taken from the field names in various descriptors


Property Names


See Also:

kUSBDeviceClass

kUSBDeviceSubClass

kUSBDeviceProtocol

kUSBDeviceMaxPacketSize

kUSBVendorID

kUSBVendorName

kUSBProductID

kUSBProductName

kUSBDeviceReleaseNumber

kUSBManufacturerStringIndex

kUSBProductStringIndex

kUSBSerialNumberStringIndex

kUSBDeviceNumConfigs

kUSBInterfaceNumber

kUSBAlternateSetting

kUSBNumEndpoints

kUSBInterfaceClass

kUSBInterfaceSubClass

kUSBInterfaceProtocol

kUSBInterfaceStringIndex

kUSBConfigurationValue

 #define kUSBDeviceClass "bDeviceClass" 
 #define kUSBDeviceSubClass "bDeviceSubClass" 
 #define kUSBDeviceProtocol "bDeviceProtocol" 
 #define kUSBDeviceMaxPacketSize "bMaxPacketSize0" 
 #define kUSBVendorID "idVendor" // good name  
 #define kUSBVendorName "idVendor" // bad name - keep for backward compatibility  
 #define kUSBProductID "idProduct" // good name  
 #define kUSBProductName "idProduct" // bad name - keep for backward compatibility  
 #define kUSBDeviceReleaseNumber "bcdDevice" 
 #define kUSBManufacturerStringIndex "iManufacturer" 
 #define kUSBProductStringIndex "iProduct" 
 #define kUSBSerialNumberStringIndex "iSerialNumber" 
 #define kUSBDeviceNumConfigs "bNumConfigurations" 
 #define kUSBInterfaceNumber "bInterfaceNumber" 
 #define kUSBAlternateSetting "bAlternateSetting" 
 #define kUSBNumEndpoints "bNumEndpoints" 
 #define kUSBInterfaceClass "bInterfaceClass" 
 #define kUSBInterfaceSubClass "bInterfaceSubClass" 
 #define kUSBInterfaceProtocol "bInterfaceProtocol" 
 #define kUSBInterfaceStringIndex "iInterface" 
 #define kUSBConfigurationValue "bConfigurationValue" 
Discussion

USB property names taken from the field names in various descriptors


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.

 

Last Updated: 2009-02-23