Mac OS X Reference Library Apple Developer
Search

USBSpec.h

Overview

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



Enumerated Types

Apple USB Vendor ID
Device Class Codes
Device Request
Device Request Recipient
Device Request Type
DFU Class Attributes
Endpoint Descriptor bits
Endpoint direction
Endpoint type
Feature Selectors
HID Protocol
HID report types
HID requests
Interface Class
Interface Protocol
Interface SubClass
Printer Class Requests
USB Descriptors
USB Power constants
USB Release constants

Apple USB Vendor ID



enum { 
    kAppleVendorID = 0x05AC 
};  
Discussion

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


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 
};  
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 = 13,  
    kUSBVideoInterfaceClass = 14,  
    kUSBPersonalHealthcareInterfaceClass = 15,  
    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).


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, 
    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.

Macro Definitions

kUSB1284DeviceID
kUSBAlternateSetting
kUSBConfigurationValue
kUSBDeviceClass Descriptor and IORegistry constants
kUSBDeviceMaxPacketSize
kUSBDeviceNumConfigs
kUSBDeviceProtocol
kUSBDeviceReleaseNumber
kUSBDeviceSubClass
kUSBInterfaceClass
kUSBInterfaceNumber
kUSBInterfaceProtocol
kUSBInterfaceStringIndex
kUSBInterfaceSubClass
kUSBManufacturerStringIndex
kUSBNumEndpoints
kUSBProductID
kUSBProductName
kUSBProductString
kUSBProductStringIndex
kUSBSerialNumberString
kUSBSerialNumberStringIndex
kUSBVendorID
kUSBVendorName
kUSBVendorString

kUSB1284DeviceID



#define kUSB1284DeviceID "1284 Device ID" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBAlternateSetting



#define kUSBAlternateSetting "bAlternateSetting" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBConfigurationValue



#define kUSBConfigurationValue "bConfigurationValue" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBDeviceClass Descriptor and IORegistry constants



 #define kUSBDeviceClass "bDeviceClass" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBDeviceMaxPacketSize



#define kUSBDeviceMaxPacketSize "bMaxPacketSize0" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBDeviceNumConfigs



#define kUSBDeviceNumConfigs "bNumConfigurations" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBDeviceProtocol



#define kUSBDeviceProtocol "bDeviceProtocol" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBDeviceReleaseNumber



#define kUSBDeviceReleaseNumber "bcdDevice" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBDeviceSubClass



#define kUSBDeviceSubClass "bDeviceSubClass" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBInterfaceClass



#define kUSBInterfaceClass "bInterfaceClass" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBInterfaceNumber



#define kUSBInterfaceNumber "bInterfaceNumber" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBInterfaceProtocol



#define kUSBInterfaceProtocol "bInterfaceProtocol" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBInterfaceStringIndex



#define kUSBInterfaceStringIndex "iInterface" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBInterfaceSubClass



#define kUSBInterfaceSubClass "bInterfaceSubClass" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBManufacturerStringIndex



#define kUSBManufacturerStringIndex "iManufacturer" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBNumEndpoints



#define kUSBNumEndpoints "bNumEndpoints" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBProductID



#define kUSBProductID "idProduct" // good name  
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBProductName



#define kUSBProductName "idProduct" /* good name \

        */ // bad name - keep for backward compatibility  
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBProductString



#define kUSBProductString "USB Product Name" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBProductStringIndex



#define kUSBProductStringIndex "iProduct" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBSerialNumberString



#define kUSBSerialNumberString "USB Serial Number" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBSerialNumberStringIndex



#define kUSBSerialNumberStringIndex "iSerialNumber" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBVendorID



#define kUSBVendorID "idVendor" // good name  
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBVendorName



#define kUSBVendorName "idVendor" /* good name \

        */ // bad name - keep for backward compatibility  
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also


kUSBVendorString



#define kUSBVendorString "USB Vendor Name" 
Discussion

Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields

See Also

 

Did this document help you? Yes It's good, but... Not helpful...

Last Updated: 2010-07-29