Mac Developer Library

Developer

USB.h Reference

Options
Deployment Target:

On This Page

USB.h Reference

Included Headers

  • <libkern/OSByteOrder.h>

  • <IOKit/IOMemoryDescriptor.h>

  • <libkern/OSByteOrder.h>

  • <IOKit/IOTypes.h>

Functions

  • Declaration

    #define iokit_usb_err(return) (sys_iokit|sub_iokit_usb|return)

    Discussion

    Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    See Also

    IOUSBFamilyerrorcodes

  • Declaration

    #define iokit_usb_msg(message) (UInt32)(sys_iokit|sub_iokit_usb|message)

    Discussion

    Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    See Also

    IOUSBFamilymessagecodes

  • Declaration

    #define EncodeRequest(request, direction, type, recipient) \ (((UInt16)request << 8) + \ ((UInt16)recipient + \ ((UInt16)type << kUSBRqTypeShift) + \ ((UInt16)direction << kUSBRqDirnShift)))

    Discussion

    Macro that encodes the bRequest and bRequestType fields of a IOUSBDevRequest into a single value. It is useful when one needs to know what type of request the IOUSBDevRequest encodes and simplifies comparisons.

  • Declaration

    #define USBmakebmRequestType(direction, type, recipient) \ (((direction & kUSBRqDirnMask) << kUSBRqDirnShift) | \ ((type & kUSBRqTypeMask) << kUSBRqTypeShift) | \ (recipient & kUSBRqRecipientMask))

    Discussion

    Macro to encode the bRequest field of a Device Request. It is used when constructing an IOUSBDevRequest.

Callbacks

  • Declaration

    typedef void ( *IOUSBCompletionAction)( void *target, void *parameter, IOReturn status, UInt32 bufferSizeRemaining);

    Parameters

    target

    The target specified in the IOUSBCompletion struct.

    parameter

    The parameter specified in the IOUSBCompletion struct.

    status

    Completion status.

    bufferSizeRemaining

    Bytes left to be transferred.

    Discussion

    Function called when USB I/O completes.

  • Declaration

    typedef void ( *IOUSBCompletionActionWithTimeStamp)( void *target, void *parameter, IOReturn status, UInt32 bufferSizeRemaining, AbsoluteTime timeStamp);

    Parameters

    target

    The target specified in the IOUSBCompletion struct.

    parameter

    The parameter specified in the IOUSBCompletion struct.

    status

    Completion status.

    bufferSizeRemaining

    Bytes left to be transferred.

    timeStamp

    Time at which the transaction was processed.

    Discussion

    Function called when USB I/O completes.

  • Declaration

    typedef void ( *IOUSBIsocCompletionAction)( void *target, void *parameter, IOReturn status, IOUSBIsocFrame *pFrames);

    Parameters

    target

    The target specified in the IOUSBIsocCompletionn struct.

    parameter

    The parameter specified in the IOUSBIsocCompletion struct.

    status

    Completion status.

    pFrames

    Pointer to the frame list containing the status for each frame transferred.

    Discussion

    Function called when Isochronous USB I/O completes.

  • Declaration

    typedef void ( *IOUSBLowLatencyIsocCompletionAction)( void *target, void *parameter, IOReturn status, IOUSBLowLatencyIsocFrame *pFrames);

    Parameters

    target

    The target specified in the IOUSBLowLatencyIsocCompletion struct.

    parameter

    The parameter specified in the IOUSBLowLatencyIsocCompletion struct.

    status

    Completion status.

    pFrames

    Pointer to the low latency frame list containing the status for each frame transferred.

    Discussion

    Function called when Low Latency Isochronous USB I/O completes.

Data Types

See the Overview section above for header-level documentation.

  • Declaration

    typedef struct IOUSBBOSDescriptor IOUSBBOSDescriptor;

    Discussion

    BOS Descriptor for a USB Device. .

    Import Statement

  • Declaration

    typedef struct IOUSBCompletion { void *target; IOUSBCompletionAction action; void *parameter; } IOUSBCompletion;

    Discussion

    Struct specifying action to perform when a USB I/O completes.

    Import Statement

  • Declaration

    typedef struct IOUSBCompletionWithTimeStamp { void *target; IOUSBCompletionActionWithTimeStamp action; void *parameter; } IOUSBCompletionWithTimeStamp;

    Discussion

    Struct specifying action to perform when a USB I/O completes.

    Import Statement

  • Declaration

    typedef struct IOUSBConfigurationDescHeader IOUSBConfigurationDescHeader;

    Discussion

    Header of a IOUSBConfigurationDescriptor. Used to get the total length of the descriptor.

    Import Statement

  • Declaration

    typedef struct IOUSBConfigurationDescriptor IOUSBConfigurationDescriptor;

    Discussion

    Standard USB Configuration Descriptor. It is variable length, so this only specifies the known fields. We use the wTotalLength field to read the whole descriptor. See the USB Specification at http://www.usb.org.

    Import Statement

  • Declaration

    typedef struct IOUSBDescriptorHeader IOUSBDescriptorHeader;

    Discussion

    Standard header used for all USB descriptors. Used to read the length of a descriptor so that we can allocate storage for the whole descriptor later on.

    Import Statement

  • Declaration

    typedef struct IOUSBDeviceCapabilityContainerID IOUSBDeviceCapabilityContainerID;

    Discussion

    Device Capability Container ID

    Import Statement

  • Declaration

    typedef struct IOUSBDeviceCapabilityDescriptorHeader IOUSBDeviceCapabilityDescriptorHeader;

    Discussion

    Header for a Device Capability Descriptor for a USB Device. .

    Import Statement

  • Declaration

    typedef struct IOUSBDeviceCapabilitySuperSpeedUSB IOUSBDeviceCapabilitySuperSpeedUSB;

    Discussion

    Device Capability SuperSpeed USB

    Import Statement

  • Declaration

    typedef struct IOUSBDeviceCapabilityUSB2Extension IOUSBDeviceCapabilityUSB2Extension;

    Discussion

    Device Capability USB 2.0 Extension

    Import Statement

  • Declaration

    typedef struct IOUSBDeviceDescriptor IOUSBDeviceDescriptor;

    Discussion

    Descriptor for a USB Device. See the USB Specification at http://www.usb.org.

    Import Statement

  • Declaration

    typedef struct IOUSBDeviceQualifierDescriptor IOUSBDeviceQualifierDescriptor;

    Discussion

    USB Device Qualifier Descriptor. See the USB Specification at http://www.usb.org.

    Import Statement

  • Declaration

    typedef struct { UInt8 bmRequestType; UInt8 bRequest; UInt16 wValue; UInt16 wIndex; UInt16 wLength; void *pData; UInt32 wLenDone; } IOUSBDevRequest;

    Discussion

    Parameter block for control requests, using a simple pointer for the data to be transferred.

    Import Statement

  • Declaration

    typedef struct { UInt8 bmRequestType; UInt8 bRequest; UInt16 wValue; UInt16 wIndex; UInt16 wLength; IOMemoryDescriptor *pData; UInt32 wLenDone; } IOUSBDevRequestDesc;

    Discussion

    Parameter block for control requests, using a memory descriptor for the data to be transferred. Only available in the kernel.

    Import Statement

  • Declaration

    typedef struct { UInt8 bmRequestType; UInt8 bRequest; UInt16 wValue; UInt16 wIndex; UInt16 wLength; void *pData; UInt32 wLenDone; UInt32 noDataTimeout; UInt32 completionTimeout; } IOUSBDevRequestTO;

    Discussion

    Parameter block for control requests with timeouts, using a simple pointer for the data to be transferred. Same as a IOUSBDevRequest except for the two extra timeout fields.

    Import Statement

  • Declaration

    typedef struct IOUSBDFUDescriptor IOUSBDFUDescriptor;

    Discussion

    USB Device Firmware Update Descriptor. See the USB Device Firmware Update Specification at http://www.usb.org.

    Import Statement

  • Declaration

    typedef struct IOUSBEndpointDescriptor IOUSBEndpointDescriptor;

    Discussion

    Descriptor for a USB Endpoint. See the USB Specification at http://www.usb.org.

    Import Statement

  • Declaration

    typedef struct IOUSBEndpointProperties IOUSBEndpointProperties;

    Discussion

    Structure used with the IOUSBLib GetEndpointPropertiesV3 and GetPipePropertiesV3 API. Most of the fields are taken directly from corresponding Standard Endpoint Descriptor and SuperSpeed Endpoint Companion Descriptor. wBytesPerInterval will be synthesized for High Speed High Bandwidth Isochronous endpoints.

    Import Statement

  • Declaration

    typedef struct { UInt8 type; UInt8 direction; UInt16 maxPacketSize; UInt8 interval; } IOUSBFindEndpointRequest;

    Discussion

    Struct used to find endpoints of an interface type and direction are used to match endpoints, type, direction, maxPacketSize and interval are updated with the properties of the found endpoint.

    Import Statement

  • Declaration

    typedef struct { UInt16 bInterfaceClass; // requested class UInt16 bInterfaceSubClass; // requested subclass UInt16 bInterfaceProtocol; // requested protocol UInt16 bAlternateSetting; // requested alt setting } IOUSBFindInterfaceRequest;

    Discussion

    Structure used with FindNextInterface.

    Import Statement

  • Declaration

    typedef struct { UInt64 frame; AbsoluteTime timeStamp; } IOUSBGetFrameStruct;

    Discussion

    Structure used from user space to return the frame number and a timestamp on when the frame register was read.

    Import Statement

  • Declaration

    typedef struct IOUSBHIDDescriptor IOUSBHIDDescriptor;

    Discussion

    USB HID Descriptor. See the USB HID Specification at http://www.usb.org. (This structure should have used the #pragma pack(1) compiler directive to get byte alignment.

    Import Statement

  • Declaration

    typedef struct IOUSBHIDReportDesc IOUSBHIDReportDesc;

    Discussion

    USB HID Report Descriptor header. See the USB HID Specification at http://www.usb.org. (This structure should have used the #pragma pack(1) compiler directive to get byte alignment.

    Import Statement

  • Declaration

    typedef struct IOUSBInterfaceAssociationDescriptor IOUSBInterfaceAssociationDescriptor;

    Discussion

    USB Inerface Association Descriptor. ECN to the USB 2.0 Spec. See the USB Specification at http://www.usb.org.

    Import Statement

  • Declaration

    typedef struct IOUSBInterfaceDescriptor IOUSBInterfaceDescriptor;

    Discussion

    Descriptor for a USB Interface. See the USB Specification at http://www.usb.org.

    Import Statement

  • Declaration

    typedef struct IOUSBIsocCompletion { void *target; IOUSBIsocCompletionAction action; void *parameter; } IOUSBIsocCompletion;

    Discussion

    Struct specifying action to perform when an Isochronous USB I/O completes.

    Import Statement

  • Declaration

    typedef struct IOUSBIsocFrame { IOReturn frStatus; UInt16 frReqCount; UInt16 frActCount; } IOUSBIsocFrame;

    Discussion

    Structure used to encode information about each isoc frame.

    Import Statement

  • Declaration

    typedef struct IOUSBLowLatencyIsocCompletion { void *target; IOUSBLowLatencyIsocCompletionAction action; void *parameter; } IOUSBLowLatencyIsocCompletion;

    Discussion

    Struct specifying action to perform when an Low Latency Isochronous USB I/O completes.

    Import Statement

  • Declaration

    typedef struct IOUSBLowLatencyIsocFrame IOUSBLowLatencyIsocFrame;

    Discussion

    Structure used to encode information about each isoc frame that is processed at hardware interrupt time (low latency).

    Import Statement

  • Declaration

    typedef struct IOUSBSuperSpeedEndpointCompanionDescriptor IOUSBSuperSpeedEndpointCompanionDescriptor;

    Discussion

    Descriptor for a SuperSpeed USB Endpoint Companion. See the USB Specification at http://www.usb.org.

    Import Statement

  • Declaration

    typedef struct UASPipeDescriptor UASPipeDescriptor;

    Discussion

    Structure used to specify the Mass Storage Specific UAS pipe usage descriptor

    Import Statement

  • Declaration

    typedef enum { kUSBInformationDeviceIsCaptiveBit = 0, kUSBInformationDeviceIsAttachedToRootHubBit = 1, kUSBInformationDeviceIsInternalBit = 2, kUSBInformationDeviceIsConnectedBit = 3, kUSBInformationDeviceIsEnabledBit = 4, kUSBInformationDeviceIsSuspendedBit = 5, kUSBInformationDeviceIsInResetBit = 6, kUSBInformationDeviceOvercurrentBit = 7, kUSBInformationDevicePortIsInTestModeBit = 8, kUSBInformationDeviceIsRootHub = 9, kUSBInformationRootHubisBuiltIn = 10, kUSBInformationRootHubIsBuiltInBit = 10, kUSBInformationDeviceIsRemote = 11, kUSBInformationDeviceIsAttachedToEnclosure = 12, kUSBInformationDeviceIsOnThunderboltBit = 13, kUSBInformationDeviceIsCaptiveMask = ( 1 << kUSBInformationDeviceIsCaptiveBit), kUSBInformationDeviceIsAttachedToRootHubMask = ( 1 << kUSBInformationDeviceIsAttachedToRootHubBit), kUSBInformationDeviceIsInternalMask = ( 1 << kUSBInformationDeviceIsInternalBit), kUSBInformationDeviceIsConnectedMask = ( 1 << kUSBInformationDeviceIsConnectedBit), kUSBInformationDeviceIsEnabledMask = ( 1 << kUSBInformationDeviceIsEnabledBit), kUSBInformationDeviceIsSuspendedMask = ( 1 << kUSBInformationDeviceIsSuspendedBit), kUSBInformationDeviceIsInResetMask = ( 1 << kUSBInformationDeviceIsInResetBit), kUSBInformationDeviceOvercurrentMask = ( 1 << kUSBInformationDeviceOvercurrentBit), kUSBInformationDevicePortIsInTestModeMask = ( 1 << kUSBInformationDevicePortIsInTestModeBit), kUSBInformationDeviceIsRootHubMask = ( 1 << kUSBInformationDeviceIsRootHub), kUSBInformationRootHubisBuiltInMask = ( 1 << kUSBInformationRootHubisBuiltIn), kUSBInformationRootHubIsBuiltInMask = ( 1 << kUSBInformationRootHubIsBuiltInBit), kUSBInformationDeviceIsRemoteMask = ( 1 << kUSBInformationDeviceIsRemote), kUSBInformationDeviceIsAttachedToEnclosureMask = ( 1 << kUSBInformationDeviceIsAttachedToEnclosure), kUSBInformationDeviceIsOnThunderboltMask = ( 1 << kUSBInformationDeviceIsOnThunderboltBit) } USBDeviceInformationBits;

    Constants

    • kUSBInformationDeviceIsCaptiveBit

      The USB device is directly attached to its hub and cannot be removed.

    • kUSBInformationDeviceIsAttachedToRootHubBit

      The USB device is directly attached to the root hub

    • kUSBInformationDeviceIsInternalBit

      The USB device is internal to the enclosure (all the hubs it attaches to are captive)

    • kUSBInformationDeviceIsConnectedBit

      The USB device is connected to its hub

    • kUSBInformationDeviceIsEnabledBit

      The hub port to which the USB device is attached is enabled

    • kUSBInformationDeviceIsSuspendedBit

      The hub port to which the USB device is attached is suspended

    • kUSBInformationDeviceIsInResetBit

      The hub port to which the USB device is attached is being reset

    • kUSBInformationDeviceOvercurrentBit

      The USB device generated an overcurrent

    • kUSBInformationDevicePortIsInTestModeBit

      The hub port to which the USB device is attached is in test mode

    • kUSBInformationDeviceIsRootHub

      The device is the root hub simulation

    • kUSBInformationRootHubisBuiltIn

      If this is a root hub simulation and it's built into the enclosure, this bit is set. If it's on an expansion card, it will be cleared

    • kUSBInformationDeviceIsRemote

      This device is "attached" to the controller through a remote connection

    • kUSBInformationDeviceIsAttachedToEnclosure

      The hub port to which the USB device is connected has a USB connector on the enclosure

    • kUSBInformationDeviceIsOnThunderbolt

      The USB device is downstream of a controller that is attached through Thunderbolt

    Discussion

    GetUSBDeviceInformation will return a unit32_t value with bits set indicating that a particular state is present in the USB device. These bits are described here

    Import Statement

  • Declaration

    typedef enum { kUSBLowLatencyWriteBuffer = 0, kUSBLowLatencyReadBuffer = 1, kUSBLowLatencyFrameListBuffer = 2 } USBLowLatencyBufferType;

    Constants

    • kUSBLowLatencyWriteBuffer

      The buffer will be used to write data out to a device.

    • kUSBLowLatencyReadBuffer

      The buffer will be used to read data from a device.

    • kUSBLowLatencyFrameListBuffer

      The buffer will be used for a low latency isoch frame list.

    Discussion

    Used to specify what kind of buffer to create when calling LowLatencyCreateBuffer().

    Import Statement

  • Declaration

    typedef enum { kUSBNotificationPreForcedSuspend = ( 1 << kUSBNotificationPreForcedSuspendBit), kUSBNotificationPostForcedSuspend = ( 1 << kUSBNotificationPostForcedSuspendBit), kUSBNotificationPreForcedResume = ( 1 << kUSBNotificationPreForcedResumeBit), kUSBNotificationPostForcedResume = ( 1 << kUSBNotificationPostForcedResumeBit), } USBNotificationTypes;

    Constants

    • kUSBNotificationPreForcedSuspend

      A notification is sent prior to a forced suspend (e.g. system sleep).

    • kUSBNotificationPostForcedSuspend

      A notification is sent after a forced suspend has been completed (e.g. system sleep).

    • kUSBNotificationPreForcedResume

      A notification is sent before a resume which happens after a forced suspend (e.g. system wake).

    • kUSBNotificationPostForcedResume

      A notification is sent after a resume which happens after a forced suspend (e.g. system wake).

    Discussion

    Used to register for USB notifications. These types may be OR'd together if more than one notification is desired. These notification are expected to be acknowledged before the process (e.g. system sleep or system wake) can be continued. See RegisterForNotification and AcknowledgeNotification in IOUSBDeviceInterface and IOUSBInterfaceInterface.

    Import Statement

  • Declaration

    typedef enum { kUSBPowerDuringSleep = 0, kUSBPowerDuringWake = 1, kUSBPowerRequestWakeRelease = 2, kUSBPowerRequestSleepRelease = 3, kUSBPowerRequestWakeReallocate = 4, kUSBPowerRequestSleepReallocate = 5, kUSBPowerDuringWakeRevocable = 6, kUSBPowerDuringWakeUSB3 = 7 } USBPowerRequestTypes;

    Constants

    • kUSBPowerDuringSleep

      The power is to be used during sleep.

    • kUSBPowerDuringWake

      The power is to be used while the system is awake (i.e not sleeping)

    • kUSBPowerRequestWakeRelease

      When used with ReturnExtraPower(), it will send a message to all devices to return any extra wake power if possible.

    • kUSBPowerRequestSleepRelease

      When used with ReturnExtraPower(), it will send a message to all devices to return any sleep power if possible.

    • kUSBPowerRequestWakeReallocate

      When used with ReturnExtraPower(), it will send a message to all devices indicating that they can ask for more wake power, as some device has released it.

    • kUSBPowerRequestSleepReallocate

      When used with ReturnExtraPower(), it will send a message to all devices indicating that they can ask for more sleep power, as some device has released it.

    • kUSBPowerDuringWakeRevocable

      The power is to be used while the system is awake (i.e not sleeping), but can be taken away (via the kUSBPowerRequestWakeRelease message). The system can then allocate that extra power to another device.

    • kUSBPowerDuringWakeUSB3

      This is used by the USB stack to allocate the 400mA extra for USB3, above the 500ma allocated by USB2

    Discussion

    Used to specify what kind of power will be reserved using the IOUSBDevice RequestExtraPower and ReturnExtraPower APIs.

    Import Statement

  • Declaration

    typedef enum { kUSBAddExtraResetTimeBit = 31, kUSBAddExtraResetTimeMask = ( 1 << kUSBAddExtraResetTimeBit) } USBReEnumerateOptions;

    Constants

    • kUSBAddExtraResetTimeBit

      Setting this bit will cause the Hub driver to wait 100ms before addressing the device after the reset following the re-enumeration.

    Discussion

    Options used when calling ReEnumerateDevice.

    Import Statement

  • Declaration

    typedef UInt16 USBStatus;

    Discussion

    Type used to get a DeviceStatus as a single quantity.

    Import Statement

  • Declaration

    struct IOUSBBOSDescriptor { UInt8 bLength; UInt8 bDescriptorType; UInt16 wTotalLength; UInt8 bNumDeviceCaps; };

    Discussion

    BOS Descriptor for a USB Device. .

  • Declaration

    struct IOUSBConfigurationDescHeader { UInt8 bLength; UInt8 bDescriptorType; UInt16 wTotalLength; };

    Discussion

    Header of a IOUSBConfigurationDescriptor. Used to get the total length of the descriptor.

  • Declaration

    struct IOUSBConfigurationDescriptor { UInt8 bLength; UInt8 bDescriptorType; UInt16 wTotalLength; UInt8 bNumInterfaces; UInt8 bConfigurationValue; UInt8 iConfiguration; UInt8 bmAttributes; UInt8 MaxPower; };

    Discussion

    Standard USB Configuration Descriptor. It is variable length, so this only specifies the known fields. We use the wTotalLength field to read the whole descriptor. See the USB Specification at http://www.usb.org.

  • Declaration

    struct IOUSBDescriptorHeader { UInt8 bLength; UInt8 bDescriptorType; };

    Discussion

    Standard header used for all USB descriptors. Used to read the length of a descriptor so that we can allocate storage for the whole descriptor later on.

  • Declaration

    struct IOUSBDeviceCapabilityContainerID { UInt8 bLength; UInt8 bDescriptorType; UInt8 bDevCapabilityType; UInt8 bReservedID; UInt8 containerID[16]; };

    Discussion

    Device Capability Container ID

  • Declaration

    struct IOUSBDeviceCapabilityDescriptorHeader { UInt8 bLength; UInt8 bDescriptorType; UInt8 bDevCapabilityType; UInt8 bNumDeviceCaps; };

    Discussion

    Header for a Device Capability Descriptor for a USB Device. .

  • Declaration

    struct IOUSBDeviceCapabilitySuperSpeedUSB { UInt8 bLength; UInt8 bDescriptorType; UInt8 bDevCapabilityType; UInt8 bmAttributes; UInt16 wSpeedsSupported; UInt8 bFunctionalitySupport; UInt8 bU1DevExitLat; UInt16 wU2DevExitLat; };

    Discussion

    Device Capability SuperSpeed USB

  • Declaration

    struct IOUSBDeviceCapabilityUSB2Extension { UInt8 bLength; UInt8 bDescriptorType; UInt8 bDevCapabilityType; UInt32 bmAttributes; };

    Discussion

    Device Capability USB 2.0 Extension

  • Declaration

    struct IOUSBDeviceDescriptor { UInt8 bLength; UInt8 bDescriptorType; UInt16 bcdUSB; UInt8 bDeviceClass; UInt8 bDeviceSubClass; UInt8 bDeviceProtocol; UInt8 bMaxPacketSize0; UInt16 idVendor; UInt16 idProduct; UInt16 bcdDevice; UInt8 iManufacturer; UInt8 iProduct; UInt8 iSerialNumber; UInt8 bNumConfigurations; };

    Discussion

    Descriptor for a USB Device. See the USB Specification at http://www.usb.org.

  • Declaration

    struct IOUSBDeviceQualifierDescriptor { UInt8 bLength; UInt8 bDescriptorType; UInt16 bcdUSB; UInt8 bDeviceClass; UInt8 bDeviceSubClass; UInt8 bDeviceProtocol; UInt8 bMaxPacketSize0; UInt8 bNumConfigurations; UInt8 bReserved; };

    Discussion

    USB Device Qualifier Descriptor. See the USB Specification at http://www.usb.org.

  • Declaration

    struct IOUSBDFUDescriptor { UInt8 bLength; UInt8 bDescriptorType; UInt8 bmAttributes; UInt16 wDetachTimeout; UInt16 wTransferSize; };

    Discussion

    USB Device Firmware Update Descriptor. See the USB Device Firmware Update Specification at http://www.usb.org.

  • Declaration

    struct IOUSBEndpointDescriptor { UInt8 bLength; UInt8 bDescriptorType; UInt8 bEndpointAddress; UInt8 bmAttributes; UInt16 wMaxPacketSize; UInt8 bInterval; };

    Discussion

    Descriptor for a USB Endpoint. See the USB Specification at http://www.usb.org.

  • Declaration

    struct IOUSBEndpointProperties { UInt8 bVersion; UInt8 bAlternateSetting; UInt8 bDirection; UInt8 bEndpointNumber; UInt8 bTransferType; UInt8 bUsageType; UInt8 bSyncType; UInt8 bInterval; UInt16 wMaxPacketSize; UInt8 bMaxBurst; UInt8 bMaxStreams; UInt8 bMult; UInt16 wBytesPerInterval; };

    Fields

    bVersion

    Version of the structure. Currently kUSBEndpointPropertiesVersion3. Need to set this when using this structure

    bAlternateSetting

    Used as an input for GetEndpointPropertiesV3. Used as an output for GetPipePropertiesV3

    bDirection

    Used as an input for GetEndpointPropertiesV3. Used as an output for GetPipePropertiesV3. One of kUSBIn or kUSBOut.

    bEndpointNumber

    Used as an input for GetEndpointPropertiesV3. Used as an output for GetPipePropertiesV3

    bTransferType

    One of kUSBControl, kUSBBulk, kUSBIsoc, or kUSBInterrupt

    bUsageType

    For interrupt and isoc endpoints, the usage type. For Bulk endpoints of the UAS Mass Storage Protocol, the pipe ID.

    bSyncType

    For isoc endpoints only

    bInterval

    The bInterval field from the Standard Endpoint descriptor.

    wMaxPacketSize

    The meaning of this value depends on whether this is called with GetPipePropertiesV3 or GetEndpointPropertiesV3. See the documentation of those calls for more info.

    bMaxBurst

    For SuperSpeed endpoints, maximum number of packets the endpoint can send or receive as part of a burst

    bMaxStreams

    For SuperSpeed bulk endpoints, maximum number of streams this endpoint supports.

    bMult

    For SuperSpeed isoc endpoints, this is the mult value from the SuperSpeed Endpoint Companion Descriptor. For High Speed isoc and interrupt endpoints, this is bits 11 and 12 of the Standard Endpoint Descriptor, which represents a similar value.

    wBytesPerInterval

    For SuperSpeed interrupt and isoc endpoints, this is the wBytesPerInterval from the SuperSpeed Endpoint Companion Descriptor. For High Speed High Bandwidth isoc endpoints, this will be equal to wMaxPacketSize * (bMult+1).

    Discussion

    Structure used with the IOUSBLib GetEndpointPropertiesV3 and GetPipePropertiesV3 API. Most of the fields are taken directly from corresponding Standard Endpoint Descriptor and SuperSpeed Endpoint Companion Descriptor. wBytesPerInterval will be synthesized for High Speed High Bandwidth Isochronous endpoints.

  • Declaration

    struct IOUSBHIDDescriptor { UInt8 descLen; UInt8 descType; UInt16 descVersNum; UInt8 hidCountryCode; UInt8 hidNumDescriptors; UInt8 hidDescriptorType; UInt8 hidDescriptorLengthLo; UInt8 hidDescriptorLengthHi; };

    Discussion

    USB HID Descriptor. See the USB HID Specification at http://www.usb.org. (This structure should have used the #pragma pack(1) compiler directive to get byte alignment.

  • Declaration

    struct IOUSBHIDReportDesc { UInt8 hidDescriptorType; UInt8 hidDescriptorLengthLo; UInt8 hidDescriptorLengthHi; };

    Discussion

    USB HID Report Descriptor header. See the USB HID Specification at http://www.usb.org. (This structure should have used the #pragma pack(1) compiler directive to get byte alignment.

  • Declaration

    struct IOUSBInterfaceAssociationDescriptor { UInt8 bLength; UInt8 bDescriptorType; UInt8 bFirstInterface; UInt8 bInterfaceCount; UInt8 bFunctionClass; UInt8 bFunctionSubClass; UInt8 bFunctionProtocol; UInt8 iFunction; };

    Discussion

    USB Inerface Association Descriptor. ECN to the USB 2.0 Spec. See the USB Specification at http://www.usb.org.

  • Declaration

    struct IOUSBInterfaceDescriptor { UInt8 bLength; UInt8 bDescriptorType; UInt8 bInterfaceNumber; UInt8 bAlternateSetting; UInt8 bNumEndpoints; UInt8 bInterfaceClass; UInt8 bInterfaceSubClass; UInt8 bInterfaceProtocol; UInt8 iInterface; };

    Discussion

    Descriptor for a USB Interface. See the USB Specification at http://www.usb.org.

  • Declaration

    struct IOUSBLowLatencyIsocFrame { IOReturn frStatus; UInt16 frReqCount; UInt16 frActCount; AbsoluteTime frTimeStamp; };

    Fields

    frStatus

    Returns status associated with the frame.

    frReqCount

    Input specifiying how many bytes to read or write.

    frActCount

    Actual # of bytes transferred.

    frTimeStamp

    Time stamp that indicates time when frame was procesed.

    Discussion

    Structure used to encode information about each isoc frame that is processed at hardware interrupt time (low latency).

  • Declaration

    struct IOUSBSuperSpeedEndpointCompanionDescriptor { UInt8 bLength; UInt8 bDescriptorType; UInt8 bMaxBurst; UInt8 bmAttributes; UInt16 wBytesPerInterval; };

    Discussion

    Descriptor for a SuperSpeed USB Endpoint Companion. See the USB Specification at http://www.usb.org.

  • Declaration

    struct UASPipeDescriptor { UInt8 bLength; UInt8 bDescriptorType; UInt8 bPipeID; UInt8 bReserved; };

    Discussion

    Structure used to specify the Mass Storage Specific UAS pipe usage descriptor

Constants

See the Overview section above for header-level documentation.

  • Public Interfaces to the USB implementation in Mac OS X.

    Declaration

    #define HostToUSBLong OSSwapHostToLittleInt32 #define HostToUSBWord OSSwapHostToLittleInt16 #define USBToHostLong OSSwapLittleToHostInt32 #define USBToHostWord OSSwapLittleToHostInt16

    Constants

    • HostToUSBLong

      The USB API's use a convention of specifying parameters in the host order. The USB spec specifies that multi-byte items should be formatted in little endian order. The following macros allow one to translate multi-byte values from Host order to USB order and vice versa. There are separate macros for in-kernel use and for user space use.

    • HostToUSBWord

      The USB API's use a convention of specifying parameters in the host order. The USB spec specifies that multi-byte items should be formatted in little endian order. The following macros allow one to translate multi-byte values from Host order to USB order and vice versa. There are separate macros for in-kernel use and for user space use.

    • USBToHostLong

      The USB API's use a convention of specifying parameters in the host order. The USB spec specifies that multi-byte items should be formatted in little endian order. The following macros allow one to translate multi-byte values from Host order to USB order and vice versa. There are separate macros for in-kernel use and for user space use.

    • USBToHostWord

      The USB API's use a convention of specifying parameters in the host order. The USB spec specifies that multi-byte items should be formatted in little endian order. The following macros allow one to translate multi-byte values from Host order to USB order and vice versa. There are separate macros for in-kernel use and for user space use.

    Discussion

    This header file contains definitions and structures that are used in the different USB API's in Mac OS X, both in the kernel and in the user space.

  • Declaration

    #define kIOUSBBitstufErr // 0xe0004002 Pipe stall, bitstuffing #define kIOUSBBufferOverrunErr // 0xe000400c Buffer Overrun (Host hardware failure on data out, PCI busy?) #define kIOUSBBufferUnderrunErr // 0xe000400d Buffer Underrun (Host hardware failure on data out, PCI busy?) #define kIOUSBClearPipeStallNotRecursive // 0xe0004048 IOUSBPipe::ClearPipeStall should not be called recursively #define kIOUSBConfigNotFound // 0xe0004056 Configuration Not found #define kIOUSBCRCErr // 0xe0004001 Pipe stall, bad CRC #define kIOUSBDataToggleErr // 0xe0004003 Pipe stall, Bad data toggle #define kIOUSBDeviceCountExceeded // 0xe0004045 The device cannot be enumerated because the controller cannot support more devices #define kIOUSBDeviceNotHighSpeed // 0xe0004049 Name is deprecated, see below #define kIOUSBDevicePortWasNotSuspended // 0xe0004047 Port was not suspended #define kIOUSBDeviceTransferredToCompanion // 0xe0004049 The device has been tranferred to another controller for enumeration #define kIOUSBEndpointCountExceeded // 0xe0004046 The endpoint was not created because the controller cannot support more endpoints #define kIOUSBEndpointNotFound // 0xe0004057 Endpoint Not found #define kIOUSBHighSpeedSplitError // 0xe000404b Error to hub on high speed bus trying to do split transaction #define kIOUSBInterfaceNotFound // 0xe000404e Interface ref not recognized #define kIOUSBInvalidSSEndpoint // 0xe0004043 An endpoint found in a SuperSpeed device is invalid (usually because there is no Endpoint Companion Descriptor) /*! */ #define kIOUSBLinkErr // 0xe0004010 #define kIOUSBLowLatencyBufferNotPreviouslyAllocated // 0xe000404d Attempted to use user land low latency isoc calls w/out calling PrepareBuffer (on the data buffer) first #define kIOUSBLowLatencyFrameListNotPreviouslyAllocated // 0xe000404c Attempted to use user land low latency isoc calls w/out calling PrepareBuffer (on the frame list) first #define kIOUSBNoAsyncPortErr // 0xe000405f no async port #define kIOUSBNotEnoughPipesErr // 0xe000405e not enough pipes in interface #define kIOUSBNotEnoughPowerErr // 0xe000405d not enough power for selected configuration #define kIOUSBNotSent1Err // 0xe000400e Transaction not sent #define kIOUSBNotSent2Err // 0xe000400f Transaction not sent #define kIOUSBPIDCheckErr // 0xe0004006 Pipe stall, PID CRC error #define kIOUSBPipeStalled // 0xe000404f Pipe has stalled, error needs to be cleared #define kIOUSBReserved1Err // 0xe000400a Reserved #define kIOUSBReserved2Err // 0xe000400b Reserved #define kIOUSBStreamsNotSupported // 0xe0004044 The request cannot be completed because the XHCI controller does not support streams #define kIOUSBSyncRequestOnWLThread // 0xe000404a A synchronous USB request was made on the workloop thread (from a callback?). Only async requests are permitted in that case #define kIOUSBTooManyPipesErr // 0xe0004060 Too many pipes #define kIOUSBTooManyTransactionsPending // 0xe0004042 The transaction cannot be submitted because it would exceed the allowed number of pending transactions #define kIOUSBTransactionReturned // 0xe0004050 The transaction has been returned to the caller #define kIOUSBTransactionTimeout // 0xe0004051 Transaction timed out #define kIOUSBUnknownPipeErr // 0xe0004061 Pipe ref not recognized #define kIOUSBWrongPIDErr // 0xe0004007 Pipe stall, Bad or wrong PID

    Constants

    • kIOUSBBitstufErr

      These errors are returned by the OHCI controller. The # in parenthesis (xx) corresponds to the OHCI Completion Code. For the following Completion codes, we return a generic IOKit error instead of a USB specific error.

      1. Completion Code Error Returned Description
      2. 9 kIOReturnUnderrun (Data Underrun) EP returned less data than max packet size
      3. 8 kIOReturnOverrun (Data Overrun) Packet too large or more data than buffer
      4. 5 kIOReturnNotResponding Device Not responding
      5. 4 kIOUSBPipeStalled Endpoint returned a STALL PID

    • kIOUSBBufferOverrunErr

      These errors are returned by the OHCI controller. The # in parenthesis (xx) corresponds to the OHCI Completion Code. For the following Completion codes, we return a generic IOKit error instead of a USB specific error.

      1. Completion Code Error Returned Description
      2. 9 kIOReturnUnderrun (Data Underrun) EP returned less data than max packet size
      3. 8 kIOReturnOverrun (Data Overrun) Packet too large or more data than buffer
      4. 5 kIOReturnNotResponding Device Not responding
      5. 4 kIOUSBPipeStalled Endpoint returned a STALL PID

    • kIOUSBBufferUnderrunErr

      These errors are returned by the OHCI controller. The # in parenthesis (xx) corresponds to the OHCI Completion Code. For the following Completion codes, we return a generic IOKit error instead of a USB specific error.

      1. Completion Code Error Returned Description
      2. 9 kIOReturnUnderrun (Data Underrun) EP returned less data than max packet size
      3. 8 kIOReturnOverrun (Data Overrun) Packet too large or more data than buffer
      4. 5 kIOReturnNotResponding Device Not responding
      5. 4 kIOUSBPipeStalled Endpoint returned a STALL PID

    • kIOUSBClearPipeStallNotRecursive

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBConfigNotFound

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBCRCErr

      These errors are returned by the OHCI controller. The # in parenthesis (xx) corresponds to the OHCI Completion Code. For the following Completion codes, we return a generic IOKit error instead of a USB specific error.

      1. Completion Code Error Returned Description
      2. 9 kIOReturnUnderrun (Data Underrun) EP returned less data than max packet size
      3. 8 kIOReturnOverrun (Data Overrun) Packet too large or more data than buffer
      4. 5 kIOReturnNotResponding Device Not responding
      5. 4 kIOUSBPipeStalled Endpoint returned a STALL PID

    • kIOUSBDataToggleErr

      These errors are returned by the OHCI controller. The # in parenthesis (xx) corresponds to the OHCI Completion Code. For the following Completion codes, we return a generic IOKit error instead of a USB specific error.

      1. Completion Code Error Returned Description
      2. 9 kIOReturnUnderrun (Data Underrun) EP returned less data than max packet size
      3. 8 kIOReturnOverrun (Data Overrun) Packet too large or more data than buffer
      4. 5 kIOReturnNotResponding Device Not responding
      5. 4 kIOUSBPipeStalled Endpoint returned a STALL PID

    • kIOUSBDeviceCountExceeded

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBDeviceNotHighSpeed

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBDevicePortWasNotSuspended

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBDeviceTransferredToCompanion

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBEndpointCountExceeded

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBEndpointNotFound

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBHighSpeedSplitError

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBInterfaceNotFound

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBInvalidSSEndpoint

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBLinkErr

      These errors are returned by the OHCI controller. The # in parenthesis (xx) corresponds to the OHCI Completion Code. For the following Completion codes, we return a generic IOKit error instead of a USB specific error.

      1. Completion Code Error Returned Description
      2. 9 kIOReturnUnderrun (Data Underrun) EP returned less data than max packet size
      3. 8 kIOReturnOverrun (Data Overrun) Packet too large or more data than buffer
      4. 5 kIOReturnNotResponding Device Not responding
      5. 4 kIOUSBPipeStalled Endpoint returned a STALL PID

    • kIOUSBLowLatencyBufferNotPreviouslyAllocated

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBLowLatencyFrameListNotPreviouslyAllocated

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBNoAsyncPortErr

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBNotEnoughPipesErr

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBNotEnoughPowerErr

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBNotSent1Err

      These errors are returned by the OHCI controller. The # in parenthesis (xx) corresponds to the OHCI Completion Code. For the following Completion codes, we return a generic IOKit error instead of a USB specific error.

      1. Completion Code Error Returned Description
      2. 9 kIOReturnUnderrun (Data Underrun) EP returned less data than max packet size
      3. 8 kIOReturnOverrun (Data Overrun) Packet too large or more data than buffer
      4. 5 kIOReturnNotResponding Device Not responding
      5. 4 kIOUSBPipeStalled Endpoint returned a STALL PID

    • kIOUSBNotSent2Err

      These errors are returned by the OHCI controller. The # in parenthesis (xx) corresponds to the OHCI Completion Code. For the following Completion codes, we return a generic IOKit error instead of a USB specific error.

      1. Completion Code Error Returned Description
      2. 9 kIOReturnUnderrun (Data Underrun) EP returned less data than max packet size
      3. 8 kIOReturnOverrun (Data Overrun) Packet too large or more data than buffer
      4. 5 kIOReturnNotResponding Device Not responding
      5. 4 kIOUSBPipeStalled Endpoint returned a STALL PID

    • kIOUSBPIDCheckErr

      These errors are returned by the OHCI controller. The # in parenthesis (xx) corresponds to the OHCI Completion Code. For the following Completion codes, we return a generic IOKit error instead of a USB specific error.

      1. Completion Code Error Returned Description
      2. 9 kIOReturnUnderrun (Data Underrun) EP returned less data than max packet size
      3. 8 kIOReturnOverrun (Data Overrun) Packet too large or more data than buffer
      4. 5 kIOReturnNotResponding Device Not responding
      5. 4 kIOUSBPipeStalled Endpoint returned a STALL PID

    • kIOUSBPipeStalled

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBReserved1Err

      These errors are returned by the OHCI controller. The # in parenthesis (xx) corresponds to the OHCI Completion Code. For the following Completion codes, we return a generic IOKit error instead of a USB specific error.

      1. Completion Code Error Returned Description
      2. 9 kIOReturnUnderrun (Data Underrun) EP returned less data than max packet size
      3. 8 kIOReturnOverrun (Data Overrun) Packet too large or more data than buffer
      4. 5 kIOReturnNotResponding Device Not responding
      5. 4 kIOUSBPipeStalled Endpoint returned a STALL PID

    • kIOUSBReserved2Err

      These errors are returned by the OHCI controller. The # in parenthesis (xx) corresponds to the OHCI Completion Code. For the following Completion codes, we return a generic IOKit error instead of a USB specific error.

      1. Completion Code Error Returned Description
      2. 9 kIOReturnUnderrun (Data Underrun) EP returned less data than max packet size
      3. 8 kIOReturnOverrun (Data Overrun) Packet too large or more data than buffer
      4. 5 kIOReturnNotResponding Device Not responding
      5. 4 kIOUSBPipeStalled Endpoint returned a STALL PID

    • kIOUSBStreamsNotSupported

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBSyncRequestOnWLThread

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBTooManyPipesErr

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBTooManyTransactionsPending

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBTransactionReturned

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBTransactionTimeout

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBUnknownPipeErr

      Errors specific to the IOUSBFamily. Note that the iokit_usb_err(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBWrongPIDErr

      These errors are returned by the OHCI controller. The # in parenthesis (xx) corresponds to the OHCI Completion Code. For the following Completion codes, we return a generic IOKit error instead of a USB specific error.

      1. Completion Code Error Returned Description
      2. 9 kIOReturnUnderrun (Data Underrun) EP returned less data than max packet size
      3. 8 kIOReturnOverrun (Data Overrun) Packet too large or more data than buffer
      4. 5 kIOReturnNotResponding Device Not responding
      5. 4 kIOUSBPipeStalled Endpoint returned a STALL PID

  • Declaration

    #define kIOUSBMessageCompositeDriverReconfigured // 0xe0004011 Message from the composite driver indicating that it has finished re-configuring the device after a reset #define kIOUSBMessageController // 0xe0004015 Generic message sent from controller user client to controllers #define kIOUSBMessageDeviceCountExceeded // 0xe000401a Message sent by a hub when a device cannot be enumerated because the USB controller ran out of resources #define kIOUSBMessageEndpointCountExceeded // 0xe0004019 Message sent to a device when endpoints cannot be created because the USB controller ran out of resources #define kIOUSBMessageExpressCardCantWake // 0xe0004010 Message from a driver to a bus that an express card will disconnect on sleep and thus shouldn't wake #define kIOUSBMessageFromThirdParty // 0xe000400e Message sent from a third party. Uses IOUSBThirdPartyParam to encode the sender's ID #define kIOUSBMessageHubIsDeviceConnected // 0xe0004004 Message sent to a hub to inquire whether a particular port has a device connected or not #define kIOUSBMessageHubIsPortEnabled // 0xe0004005 Message sent to a hub to inquire whether a particular port is enabled or not #define kIOUSBMessageHubPortClearTT // 0xe000400c Message sent to a hub to clear the transaction translator #define kIOUSBMessageHubPortDeviceDisconnected // 0xe000401b Message sent by a built-in hub when a device was disconnected #define kIOUSBMessageHubReEnumeratePort // 0xe0004006 Message sent to a hub to reenumerate the device attached to a particular port #define kIOUSBMessageHubResetPort // 0xe0004001 Message sent to a hub to reset a particular port #define kIOUSBMessageHubResumePort // 0xe0004003 Message sent to a hub to resume a particular port #define kIOUSBMessageHubSetPortRecoveryTime // 0xe0004012 Message sent to a hub to set the # of ms required when resuming a particular port #define kIOUSBMessageHubSuspendPort // 0xe0004002 Message sent to a hub to suspend a particular port #define kIOUSBMessageNotEnoughPower // 0xe0004014 Message sent to the clients of the device's hub parent, when a device causes an low power notice to be displayed. The message argument contains the locationID of the device #define kIOUSBMessageOvercurrentCondition // 0xe0004013 Message sent to the clients of the device's hub parent, when a device causes an overcurrent condition. The message argument contains the locationID of the device #define kIOUSBMessagePortHasBeenReset // 0xe000400a Message sent to a device indicating that the port it is attached to has been reset #define kIOUSBMessagePortHasBeenResumed // 0xe000400b Message sent to a device indicating that the port it is attached to has been resumed #define kIOUSBMessagePortHasBeenSuspended // 0xe000400d Message sent to a device indicating that the port it is attached to has been suspended #define kIOUSBMessagePortWasNotSuspended // 0xe000400f Message indicating that the hub driver received a resume request for a port that was not suspended #define kIOUSBMessageReallocateExtraCurrent // 0xe0004018 Message to ask any clients using extra current to attempt to allocate it some more #define kIOUSBMessageReleaseExtraCurrent // 0xe0004017 Message to ask any clients using extra current to release it if possible #define kIOUSBMessageRootHubWakeEvent // 0xe0004016 Message from the HC Wakeup code indicating that a Root Hub port has a wake event #define kIOUSBMessageUnsupportedConfiguration // 0xe000401c Message sent to the clients of the device when a device is not supported in the current configuration. The message argument contains the locationID of the device

    Constants

    • kIOUSBMessageCompositeDriverReconfigured

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageController

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageDeviceCountExceeded

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageEndpointCountExceeded

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageExpressCardCantWake

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageFromThirdParty

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageHubIsDeviceConnected

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageHubIsPortEnabled

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageHubPortClearTT

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageHubPortDeviceDisconnected

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageHubReEnumeratePort

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageHubResetPort

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageHubResumePort

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageHubSetPortRecoveryTime

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageHubSuspendPort

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageNotEnoughPower

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageOvercurrentCondition

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessagePortHasBeenReset

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessagePortHasBeenResumed

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessagePortHasBeenSuspended

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessagePortWasNotSuspended

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageReallocateExtraCurrent

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageReleaseExtraCurrent

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageRootHubWakeEvent

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

    • kIOUSBMessageUnsupportedConfiguration

      Messages specific to the IOUSBFamily. Note that the iokit_usb_msg(x) translates to 0xe0004xxx, where xxx is the value in parenthesis as a hex number.

  • Declaration

    #define kConfigurationDescriptorOverride "ConfigurationDescriptorOverride" #define kOverrideIfAtLocationID "OverrideIfAtLocationID" #define kUSBControllerNeedsContiguousMemoryForIsoch "Need contiguous memory for isoch" #define kUSBDevicePropertyAddress "USB Address" #define kUSBDevicePropertyBusPowerAvailable "Bus Power Available" #define kUSBDevicePropertyLocationID "locationID" #define kUSBDevicePropertySpeed "Device Speed" #define kUSBDeviceResumeRecoveryTime "kUSBDeviceResumeRecoveryTime" #define kUSBExpressCardCantWake "ExpressCardCantWake" #define kUSBHubDontAllowLowPower "kUSBHubDontAllowLowPower" #define kUSBOutOfSpecMPSOK "Out of spec MPS OK" #define kUSBPreferredConfiguration "Preferred Configuration" #define kUSBProductIDMask "idProductMask" #define kUSBProductIdsArrayName "idProductArray" #define kUSBSuspendPort "kSuspendPort"

    Constants

    • kConfigurationDescriptorOverride

      Useful property names in USB land.

    • kOverrideIfAtLocationID

      Useful property names in USB land.

    • kUSBControllerNeedsContiguousMemoryForIsoch

      Useful property names in USB land.

    • kUSBDevicePropertyAddress

      Useful property names in USB land.

    • kUSBDevicePropertyBusPowerAvailable

      Useful property names in USB land.

    • kUSBDevicePropertyLocationID

      Useful property names in USB land.

    • kUSBDevicePropertySpeed

      Useful property names in USB land.

    • kUSBDeviceResumeRecoveryTime

      Useful property names in USB land.

    • kUSBExpressCardCantWake

      Useful property names in USB land.

    • kUSBHubDontAllowLowPower

      Useful property names in USB land.

    • kUSBOutOfSpecMPSOK

      Useful property names in USB land.

    • kUSBPreferredConfiguration

      Useful property names in USB land.

    • kUSBProductIDMask

      Useful property names in USB land.

    • kUSBProductIdsArrayName

      Useful property names in USB land.

    • kUSBSuspendPort

      Useful property names in USB land.

  • Declaration

    #define kCallInterfaceOpenWithGate "kCallInterfaceOpenWithGate"

    Constants

    • kCallInterfaceOpenWithGate

      If the USB Device has this property, drivers for any of its interfaces will have their handleOpen method called while holding the workloop gate.

  • Declaration

    enum { kUSBRqDirnShift = 7, kUSBRqDirnMask = 1, kUSBRqTypeShift = 5, kUSBRqTypeMask = 3, kUSBRqRecipientMask = 0X1F };

    Discussion

    These are used to create the macro to encode the bRequest filed of a Device Request

  • Declaration

    enum { kUSBDefaultControlNoDataTimeoutMS = 5000, kUSBDefaultControlCompletionTimeoutMS = 0 };

    Discussion

    default values used for data and completion timeouts.

  • Declaration

    enum { kIOUSBInterfaceOpenAlt = 0x00010000, kIOUSBInterfaceOpenAlternateInterfaceBit = 16, kUSBOptionBitOpenExclusivelyBit = 17, kIOUSBInterfaceOpenAlternateInterfaceMask = ( 1 << kIOUSBInterfaceOpenAlternateInterfaceBit ), kUSBOptionBitOpenExclusivelyMask = ( 1 << kUSBOptionBitOpenExclusivelyBit ) };

    Constants

    • kIOUSBInterfaceOpenAlt

      Open the alternate interface specified when creating the interface.

    • kUSBOptionBitOpenExclusivelyBit

      Used in open()'ing the IOUSBDevice or IOUSBInterface by the corresponding user client. Only 1 user client can have exclusive access to those objects

    Discussion

    Options used exclusively by the USB Family when calling calling IOService APIs, such as open() and close().

  • Declaration

    enum { kIOUSBFindInterfaceDontCare = 0xFFFF };

    Discussion

    Constant that can be used for the fields of IOUSBFindInterfaceRequest to specify that they should not be matched.

  • Declaration

    enum { kIOUSBVendorIDAppleComputer = 0x05AC, kIOUSBVendorIDApple = 0x05AC };

    Discussion

    USB Vendor ID for Apple, Inc.

  • Declaration

    enum { kUSBMaxFSIsocEndpointReqCount = 1023, // max size (bytes ) of any one Isoc frame for 1 FS endpoint kUSBMaxHSIsocEndpointReqCount = 3072, // max size (bytes ) of any one Isoc frame for 1 HS endpoint kUSBMaxHSIsocFrameCount = 7168 // max size (bytes ) of all Isoc transfers in a HS frame };

    Discussion

    Maximum size in bytes allowed for one Isochronous frame

  • Declaration

    enum { kUSBFullSpeedMicrosecondsInFrame = 1000, kUSBHighSpeedMicrosecondsInFrame = 125 };

    Constants

    • kUSBFullSpeedMicrosecondsInFrame

      The device is attached to a bus running at full speed (1 ms / frame).

    • kUSBHighSpeedMicrosecondsInFrame

      The device is attached to a bus running at high speed (125 microseconds / frame).

    Discussion

    Returns the number of microseconds in a USB frame.

  • Declaration

    enum { kUSBDeviceIDShift = 7, kUSBMaxDevices = 128, kUSBMaxDevice = kUSBMaxDevices-1, kUSBDeviceIDMask = 0x7f, kUSBPipeIDMask = 0xf, kUSBMaxPipes = 32, // In and Out pipes can have same pipe number. kUSBInterfaceIDShift = 8, kUSBMaxInterfaces = 1 << kUSBInterfaceIDShift, kUSBInterfaceIDMask = kUSBMaxInterfaces-1, kUSBEndPtShift = 7, kUSBDeviceMask = ( ( 1 << kUSBEndPtShift ) -1), kUSBNoPipeIdx = -1, // Constants for streams kUSBStream0 = 0, kUSBMaxStream = 65533, kUSBPRimeStream = 0xfffe, kUSBNoStream = 0xffff, kUSBAllStreams = 0xffffffff };

  • Declaration

    enum { kClearDeviceFeature = ( ( ( UInt16)kUSBRqClearFeature << 8) + ( ( UInt16) kUSBDevice + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBOut << kUSBRqDirnShift ))), kClearInterfaceFeature = ( ( ( UInt16)kUSBRqClearFeature << 8) + ( ( UInt16) kUSBInterface + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBOut << kUSBRqDirnShift ))), kClearEndpointFeature = ( ( ( UInt16)kUSBRqClearFeature << 8) + ( ( UInt16) kUSBEndpoint + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBOut << kUSBRqDirnShift ))), kGetConfiguration = ( ( ( UInt16)kUSBRqGetConfig << 8) + ( ( UInt16) kUSBDevice + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBIn << kUSBRqDirnShift ))), kGetDescriptor = ( ( ( UInt16)kUSBRqGetDescriptor << 8) + ( ( UInt16) kUSBDevice + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBIn << kUSBRqDirnShift ))), kGetInterface = ( ( ( UInt16)kUSBRqGetInterface << 8) + ( ( UInt16) kUSBInterface + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBIn << kUSBRqDirnShift ))), kGetDeviceStatus = ( ( ( UInt16)kUSBRqGetStatus << 8) + ( ( UInt16) kUSBDevice + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBIn << kUSBRqDirnShift ))), kGetInterfaceStatus = ( ( ( UInt16)kUSBRqGetStatus << 8) + ( ( UInt16) kUSBInterface + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBIn << kUSBRqDirnShift ))), kGetEndpointStatus = ( ( ( UInt16)kUSBRqGetStatus << 8) + ( ( UInt16) kUSBEndpoint + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBIn << kUSBRqDirnShift ))), kSetAddress = ( ( ( UInt16)kUSBRqSetAddress << 8) + ( ( UInt16) kUSBDevice + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBOut << kUSBRqDirnShift ))), kSetConfiguration = ( ( ( UInt16)kUSBRqSetConfig << 8) + ( ( UInt16) kUSBDevice + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBOut << kUSBRqDirnShift ))), kSetDescriptor = ( ( ( UInt16)kUSBRqSetDescriptor << 8) + ( ( UInt16) kUSBDevice + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBOut << kUSBRqDirnShift ))), kSetDeviceFeature = ( ( ( UInt16)kUSBRqSetFeature << 8) + ( ( UInt16) kUSBDevice + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBOut << kUSBRqDirnShift ))), kSetInterfaceFeature = ( ( ( UInt16)kUSBRqSetFeature << 8) + ( ( UInt16) kUSBInterface + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBOut << kUSBRqDirnShift ))), kSetEndpointFeature = ( ( ( UInt16)kUSBRqSetFeature << 8) + ( ( UInt16) kUSBEndpoint + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBOut << kUSBRqDirnShift ))), kSetInterface = ( ( ( UInt16)kUSBRqSetInterface << 8) + ( ( UInt16) kUSBInterface + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBOut << kUSBRqDirnShift ))), kSyncFrame = ( ( ( UInt16)kUSBRqSyncFrame << 8) + ( ( UInt16) kUSBEndpoint + ( ( UInt16) kUSBStandard << kUSBRqTypeShift ) + ( ( UInt16) kUSBIn << kUSBRqDirnShift ))), };

    Discussion

    Encoding of the standard device requests.

    1. bmRequestType bRequest wValue wIndex wLength Data
    2. 00000000B CLEAR_FEATURE Feature Zero Zero None (device)
    3. 00000001B Feature Interface Zero None (Interface)
    4. 00000010B Feature Endpoint Zero None (Endpoint)
    5. 10000000B GET_CONFIGURATION Zero Zero One Configuration
    6. 10000000B GET_DESCRIPTOR Type LangID Length Descriptor
    7. 10000001B GET_INTERFACE Zero Interface One Alternate
    8. 10000000B GET_STATUS Zero Zero Two status (device)
    9. 10000001B Zero Interface Two status (Interface)
    10. 10000010B Zero Endpoint Two status (Endpoint)
    11. 00000000B SET_ADDRESS Address Zero Zero None
    12. 00000000B SET_CONFIGURATION Configuration Zero Zero None
    13. 00000000B SET_DESCRIPTOR Type LangID Length Descriptor
    14. 00000000B SET_FEATURE Feature Zero Zero None (device)
    15. 00000001B Feature Interface Zero None (Interface)
    16. 00000010B Feature Endpoint Zero None (Endpoint)
    17. 00000001B SET_INTERFACE Alternate Interface Zero None
    18. 10000010B SYNCH_FRAME Zero Endpoint Two Frame Number

  • Declaration

    enum { kUSBDeviceSpeedLow = 0, kUSBDeviceSpeedFull = 1, kUSBDeviceSpeedHigh = 2, kUSBDeviceSpeedSuper = 3 };

    Constants

    • kUSBDeviceSpeedLow

      The device is a low speed device.

    • kUSBDeviceSpeedFull

      The device is a full speed device.

    • kUSBDeviceSpeedHigh

      The device is a high speed device.

    • kUSBDeviceSpeedSuper

      The device is a SuperSpeed device

    Discussion

    Returns the speed of a particular USB device.

  • Declaration

    enum { kUSBEndpointPropertiesVersion3 = 0x03 };

    Constants

    • kUSBEndpointPropertiesVersion3

      Version that has support for USB3 SuperSpeed Endpoint Companion fields.

    Discussion

    Version of the IOUSBEndpointProperties structure.