USB.h Reference

Declared in
USB.h

Overview

Included Headers

  • <libkern/OSByteOrder.h>

  • <IOKit/IOMemoryDescriptor.h>

  • <libkern/OSByteOrder.h>

  • <IOKit/IOTypes.h>

Functions by Task

See the Overview section above for header-level documentation.

UNKNOWN OBJECT

Miscellaneous

Functions

EncodeRequest

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

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

iokit_usb_err

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

Availability
  • Available in OS X v10.0 and later.
See Also
  • IOUSBFamilyerrorcodes
Declared In
USB.h

iokit_usb_msg

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

Availability
  • Available in OS X v10.1 and later.
See Also
  • IOUSBFamilymessagecodes
Declared In
USB.h

USBmakebmRequestType

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

Availability
  • Available in OS X v10.0 and later.
Related Sample Code
Declared In
USB.h

Callbacks

See the Overview section above for header-level documentation.

IOUSBCompletionAction

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.

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBCompletionActionWithTimeStamp

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.

Availability
  • Available in OS X v10.3 and later.
Declared In
USB.h

IOUSBIsocCompletionAction

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.

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBLowLatencyIsocCompletionAction

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.

Availability
  • Available in OS X v10.2 and later.
Declared In
USB.h

Data Types

See the Overview section above for header-level documentation.

IOUSBBOSDescriptor

typedef struct IOUSBBOSDescriptor IOUSBBOSDescriptor;
Discussion

BOS Descriptor for a USB Device. .

Availability
  • Available in OS X v10.7 and later.
Declared In
USB.h

IOUSBCompletion

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

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

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBCompletionWithTimeStamp

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

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

Availability
  • Available in OS X v10.3 and later.
Declared In
USB.h

IOUSBConfigurationDescHeader

typedef struct IOUSBConfigurationDescHeader IOUSBConfigurationDescHeader;
Discussion

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

Availability
  • Available in OS X v10.1 and later.
Declared In
USB.h

IOUSBConfigurationDescriptor

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.

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBDescriptorHeader

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.

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBDeviceCapabilityContainerID

typedef struct IOUSBDeviceCapabilityContainerID IOUSBDeviceCapabilityContainerID;
Discussion

Device Capability Container ID

Availability
  • Available in OS X v10.7 and later.
Declared In
USB.h

IOUSBDeviceCapabilityDescriptorHeader

typedef struct IOUSBDeviceCapabilityDescriptorHeader IOUSBDeviceCapabilityDescriptorHeader;
Discussion

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

Availability
  • Available in OS X v10.7 and later.
Declared In
USB.h

IOUSBDeviceCapabilitySuperSpeedUSB

typedef struct IOUSBDeviceCapabilitySuperSpeedUSB IOUSBDeviceCapabilitySuperSpeedUSB;
Discussion

Device Capability SuperSpeed USB

Availability
  • Available in OS X v10.7 and later.
Declared In
USB.h

IOUSBDeviceCapabilityUSB2Extension

typedef struct IOUSBDeviceCapabilityUSB2Extension IOUSBDeviceCapabilityUSB2Extension;
Discussion

Device Capability USB 2.0 Extension

Availability
  • Available in OS X v10.7 and later.
Declared In
USB.h

IOUSBDeviceDescriptor

typedef struct IOUSBDeviceDescriptor IOUSBDeviceDescriptor;
Discussion

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

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBDeviceQualifierDescriptor

typedef struct IOUSBDeviceQualifierDescriptor IOUSBDeviceQualifierDescriptor;
Discussion

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

Availability
  • Available in OS X v10.2 and later.
Declared In
USB.h

IOUSBDevRequest

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.

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBDevRequestDesc

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.

Availability
  • Available in OS X v10.6 and later.
Declared In
USB.h

IOUSBDevRequestTO

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.

Availability
  • Available in OS X v10.1 and later.
Declared In
USB.h

IOUSBDFUDescriptor

typedef struct IOUSBDFUDescriptor IOUSBDFUDescriptor;
Discussion

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

Availability
  • Available in OS X v10.2 and later.
Declared In
USB.h

IOUSBEndpointDescriptor

typedef struct IOUSBEndpointDescriptor IOUSBEndpointDescriptor;
Discussion

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

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBEndpointProperties

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.

Availability
  • Available in OS X v10.8 and later.
Declared In
USB.h

IOUSBFindEndpointRequest

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.

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBFindInterfaceRequest

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.

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBGetFrameStruct

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.

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBHIDDescriptor

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.

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBHIDReportDesc

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.

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBInterfaceAssociationDescriptor

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.

Availability
  • Available in OS X v10.3 and later.
Declared In
USB.h

IOUSBInterfaceDescriptor

typedef struct IOUSBInterfaceDescriptor IOUSBInterfaceDescriptor;
Discussion

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

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBIsocCompletion

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

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

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBIsocFrame

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

Structure used to encode information about each isoc frame.

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBLowLatencyIsocCompletion

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.

Availability
  • Available in OS X v10.2 and later.
Declared In
USB.h

IOUSBLowLatencyIsocFrame

typedef struct IOUSBLowLatencyIsocFrame IOUSBLowLatencyIsocFrame;
Discussion

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

Availability
  • Available in OS X v10.2 and later.
Declared In
USB.h

IOUSBSuperSpeedEndpointCompanionDescriptor

typedef struct IOUSBSuperSpeedEndpointCompanionDescriptor IOUSBSuperSpeedEndpointCompanionDescriptor;
Discussion

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

Availability
  • Available in OS X v10.7 and later.
Declared In
USB.h

UASPipeDescriptor

typedef struct UASPipeDescriptor UASPipeDescriptor;
Discussion

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

Availability
  • Available in OS X v10.8 and later.
Declared In
USB.h

USBDeviceInformationBits

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.

Available in OS X v10.6 and later.

Declared in USB.h.

kUSBInformationDeviceIsAttachedToRootHubBit

The USB device is directly attached to the root hub

Available in OS X v10.6 and later.

Declared in USB.h.

kUSBInformationDeviceIsInternalBit

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

Available in OS X v10.6 and later.

Declared in USB.h.

kUSBInformationDeviceIsConnectedBit

The USB device is connected to its hub

Available in OS X v10.6 and later.

Declared in USB.h.

kUSBInformationDeviceIsEnabledBit

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

Available in OS X v10.6 and later.

Declared in USB.h.

kUSBInformationDeviceIsSuspendedBit

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

Available in OS X v10.6 and later.

Declared in USB.h.

kUSBInformationDeviceIsInResetBit

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

Available in OS X v10.6 and later.

Declared in USB.h.

kUSBInformationDeviceOvercurrentBit

The USB device generated an overcurrent

Available in OS X v10.6 and later.

Declared in USB.h.

kUSBInformationDevicePortIsInTestModeBit

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

Available in OS X v10.6 and later.

Declared in USB.h.

kUSBInformationDeviceIsRootHub

The device is the root hub simulation

Available in OS X v10.6 and later.

Declared in USB.h.

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

Available in OS X v10.6 and later.

Declared in USB.h.

kUSBInformationDeviceIsRemote

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

Available in OS X v10.7 and later.

Declared in USB.h.

kUSBInformationDeviceIsAttachedToEnclosure

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

Available in OS X v10.7 and later.

Declared in USB.h.

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

Availability
  • Available in OS X v10.6 and later.
Declared In
USB.h

USBLowLatencyBufferType

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

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

Available in OS X v10.2 and later.

Declared in USB.h.

kUSBLowLatencyReadBuffer

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

Available in OS X v10.2 and later.

Declared in USB.h.

kUSBLowLatencyFrameListBuffer

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

Available in OS X v10.2 and later.

Declared in USB.h.

Discussion

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

Availability
  • Available in OS X v10.2 and later.
Declared In
USB.h

USBNotificationTypes

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

Available in OS X v10.9 and later.

Declared in USB.h.

kUSBNotificationPostForcedSuspend

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

Available in OS X v10.9 and later.

Declared in USB.h.

kUSBNotificationPreForcedResume

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

Available in OS X v10.9 and later.

Declared in USB.h.

kUSBNotificationPostForcedResume

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

Available in OS X v10.9 and later.

Declared in USB.h.

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.

Availability
  • Available in OS X v10.9 and later.
Declared In
USB.h

USBPowerRequestTypes

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.

Available in OS X v10.6 and later.

Declared in USB.h.

kUSBPowerDuringWake

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

Available in OS X v10.6 and later.

Declared in USB.h.

kUSBPowerRequestWakeRelease

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

Available in OS X v10.7 and later.

Declared in USB.h.

kUSBPowerRequestSleepRelease

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

Available in OS X v10.7 and later.

Declared in USB.h.

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.

Available in OS X v10.7 and later.

Declared in USB.h.

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.

Available in OS X v10.7 and later.

Declared in USB.h.

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.

Available in OS X v10.8 and later.

Declared in USB.h.

kUSBPowerDuringWakeUSB3

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

Available in OS X v10.8 and later.

Declared in USB.h.

Discussion

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

Availability
  • Available in OS X v10.6 and later.
Declared In
USB.h

USBReEnumerateOptions

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.

Available in OS X v10.3 and later.

Declared in USB.h.

Discussion

Options used when calling ReEnumerateDevice.

Availability
  • Available in OS X v10.3 and later.
Declared In
USB.h

USBStatus

typedef UInt16 USBStatus;
Discussion

Type used to get a DeviceStatus as a single quantity.

Availability
  • Available in OS X v10.0 and later.
Declared In
USB.h

IOUSBBOSDescriptor

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

BOS Descriptor for a USB Device. .

IOUSBConfigurationDescHeader

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

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

IOUSBConfigurationDescriptor

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.

IOUSBDescriptorHeader

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.

IOUSBDeviceCapabilityContainerID

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

Device Capability Container ID

IOUSBDeviceCapabilityDescriptorHeader

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

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

IOUSBDeviceCapabilitySuperSpeedUSB

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

Device Capability SuperSpeed USB

IOUSBDeviceCapabilityUSB2Extension

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

Device Capability USB 2.0 Extension

IOUSBDeviceDescriptor

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.

IOUSBDeviceQualifierDescriptor

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.

IOUSBDFUDescriptor

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.

IOUSBEndpointDescriptor

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.

IOUSBEndpointProperties

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.

IOUSBHIDDescriptor

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.

IOUSBHIDReportDesc

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.

IOUSBInterfaceAssociationDescriptor

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.

IOUSBInterfaceDescriptor

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.

IOUSBLowLatencyIsocFrame

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

IOUSBSuperSpeedEndpointCompanionDescriptor

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.

UASPipeDescriptor

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.

Endian conversion definitions

Public Interfaces to the USB implementation in Mac OS X.

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

Available in OS X v10.0 and later.

Declared in USB.h.

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.

Available in OS X v10.0 and later.

Declared in USB.h.

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.

Available in OS X v10.0 and later.

Declared in USB.h.

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.

Available in OS X v10.0 and later.

Declared in USB.h.

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.

IOUSBFamily error codes

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

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

Available in OS X v10.1 and later.

Declared in USB.h.

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.

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

Available in OS X v10.1 and later.

Declared in USB.h.

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.

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

Available in OS X v10.1 and later.

Declared in USB.h.

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.

Available in OS X v10.7 and later.

Declared in USB.h.

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.

Available in OS X v10.0 and later.

Declared in USB.h.

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.

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

Available in OS X v10.1 and later.

Declared in USB.h.

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.

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

Available in OS X v10.1 and later.

Declared in USB.h.

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.

Available in OS X v10.7 and later.

Declared in USB.h.

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.

Available in OS X v10.4 and later.

Declared in USB.h.

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.

Available in OS X v10.6 and later.

Declared in USB.h.

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.

Available in OS X v10.7 and later.

Declared in USB.h.

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.

Available in OS X v10.7 and later.

Declared in USB.h.

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.

Available in OS X v10.0 and later.

Declared in USB.h.

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.

Available in OS X v10.3 and later.

Declared in USB.h.

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.

Available in OS X v10.0 and later.

Declared in USB.h.

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.

Available in OS X v10.8 and later.

Declared in USB.h.

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.

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

Available in OS X v10.1 and later.

Declared in USB.h.

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.

Available in OS X v10.2 and later.

Declared in USB.h.

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.

Available in OS X v10.2 and later.

Declared in USB.h.

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.

Available in OS X v10.0 and later.

Declared in USB.h.

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.

Available in OS X v10.0 and later.

Declared in USB.h.

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.

Available in OS X v10.0 and later.

Declared in USB.h.

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.

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

Available in OS X v10.1 and later.

Declared in USB.h.

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.

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

Available in OS X v10.1 and later.

Declared in USB.h.

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.

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

Available in OS X v10.1 and later.

Declared in USB.h.

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.

Available in OS X v10.0 and later.

Declared in USB.h.

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.

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

Available in OS X v10.1 and later.

Declared in USB.h.

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.

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

Available in OS X v10.1 and later.

Declared in USB.h.

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.

Available in OS X v10.7 and later.

Declared in USB.h.

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.

Available in OS X v10.3 and later.

Declared in USB.h.

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.

Available in OS X v10.0 and later.

Declared in USB.h.

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.

Available in OS X v10.9 and later.

Declared in USB.h.

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.

Available in OS X v10.1 and later.

Declared in USB.h.

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.

Available in OS X v10.1 and later.

Declared in USB.h.

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.

Available in OS X v10.0 and later.

Declared in USB.h.

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.

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

Available in OS X v10.1 and later.

Declared in USB.h.

IOUSBFamily message codes

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

Available in OS X v10.4 and later.

Declared in USB.h.

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.

Available in OS X v10.7 and later.

Declared in USB.h.

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.

Available in OS X v10.7 and later.

Declared in USB.h.

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.

Available in OS X v10.7 and later.

Declared in USB.h.

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.

Available in OS X v10.4 and later.

Declared in USB.h.

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.

Available in OS X v10.3 and later.

Declared in USB.h.

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.

Available in OS X v10.1 and later.

Declared in USB.h.

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.

Available in OS X v10.1 and later.

Declared in USB.h.

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.

Available in OS X v10.3 and later.

Declared in USB.h.

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.

Available in OS X v10.7 and later.

Declared in USB.h.

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.

Available in OS X v10.1 and later.

Declared in USB.h.

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.

Available in OS X v10.1 and later.

Declared in USB.h.

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.

Available in OS X v10.1 and later.

Declared in USB.h.

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.

Available in OS X v10.5 and later.

Declared in USB.h.

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.

Available in OS X v10.1 and later.

Declared in USB.h.

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.

Available in OS X v10.6 and later.

Declared in USB.h.

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.

Available in OS X v10.6 and later.

Declared in USB.h.

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.

Available in OS X v10.1 and later.

Declared in USB.h.

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.

Available in OS X v10.1 and later.

Declared in USB.h.

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.

Available in OS X v10.3 and later.

Declared in USB.h.

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.

Available in OS X v10.4 and later.

Declared in USB.h.

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.

Available in OS X v10.7 and later.

Declared in USB.h.

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.

Available in OS X v10.7 and later.

Declared in USB.h.

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.

Available in OS X v10.7 and later.

Declared in USB.h.

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.

Available in OS X v10.9 and later.

Declared in USB.h.

Property Definitions

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

Available in OS X v10.7 and later.

Declared in USB.h.

kOverrideIfAtLocationID

Useful property names in USB land.

Available in OS X v10.7 and later.

Declared in USB.h.

kUSBControllerNeedsContiguousMemoryForIsoch

Useful property names in USB land.

Available in OS X v10.4 and later.

Declared in USB.h.

kUSBDevicePropertyAddress

Useful property names in USB land.

Available in OS X v10.0 and later.

Declared in USB.h.

kUSBDevicePropertyBusPowerAvailable

Useful property names in USB land.

Available in OS X v10.0 and later.

Declared in USB.h.

kUSBDevicePropertyLocationID

Useful property names in USB land.

Available in OS X v10.0 and later.

Declared in USB.h.

kUSBDevicePropertySpeed

Useful property names in USB land.

Available in OS X v10.0 and later.

Declared in USB.h.

kUSBDeviceResumeRecoveryTime

Useful property names in USB land.

Available in OS X v10.5 and later.

Declared in USB.h.

kUSBExpressCardCantWake

Useful property names in USB land.

Available in OS X v10.4 and later.

Declared in USB.h.

kUSBHubDontAllowLowPower

Useful property names in USB land.

Available in OS X v10.5 and later.

Declared in USB.h.

kUSBOutOfSpecMPSOK

Useful property names in USB land.

Available in OS X v10.6 and later.

Declared in USB.h.

kUSBPreferredConfiguration

Useful property names in USB land.

Available in OS X v10.4 and later.

Declared in USB.h.

kUSBProductIDMask

Useful property names in USB land.

Available in OS X v10.4 and later.

Declared in USB.h.

kUSBProductIdsArrayName

Useful property names in USB land.

Available in OS X v10.7 and later.

Declared in USB.h.

kUSBSuspendPort

Useful property names in USB land.

Available in OS X v10.4 and later.

Declared in USB.h.

Miscellaneous Defines

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

Available in OS X v10.3 and later.

Declared in USB.h.

bRequest Shifts and Masks

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

Default timeout values

enum {
   kUSBDefaultControlNoDataTimeoutMS = 5000,
   kUSBDefaultControlCompletionTimeoutMS = 0
};
Discussion

default values used for data and completion timeouts.

IOUSBFamilyIOOptionBit

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

Open the alternate interface specified when creating the interface.

Available in OS X v10.6 and later.

Declared in USB.h.

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

Available in OS X v10.8 and later.

Declared in USB.h.

Discussion

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

kIOUSBFindInterfaceDontCare

enum {
   kIOUSBFindInterfaceDontCare = 0xFFFF
};
Discussion

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

kIOUSBVendorIDApple

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

USB Vendor ID for Apple, Inc.

kUSBMaxIsocFrameReqCount

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

MicrosecondsInFrame

enum {
   kUSBFullSpeedMicrosecondsInFrame = 1000,
   kUSBHighSpeedMicrosecondsInFrame = 125
};
Constants
kUSBFullSpeedMicrosecondsInFrame

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

Available in OS X v10.2 and later.

Declared in USB.h.

kUSBHighSpeedMicrosecondsInFrame

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

Available in OS X v10.2 and later.

Declared in USB.h.

Discussion

Returns the number of microseconds in a USB frame.

Miscellaneous Constants

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
};

Standard Device Requests

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.

 
bmRequestType bRequest          wValue        wIndex     wLength Data
00000000B     CLEAR_FEATURE     Feature       Zero       Zero    None (device)
00000001B                       Feature       Interface  Zero    None (Interface)
00000010B                       Feature       Endpoint   Zero    None (Endpoint)
 
10000000B     GET_CONFIGURATION Zero          Zero       One     Configuration
10000000B     GET_DESCRIPTOR    Type          LangID     Length  Descriptor
10000001B     GET_INTERFACE     Zero          Interface  One     Alternate
 
10000000B     GET_STATUS        Zero          Zero       Two     status (device)
10000001B                       Zero          Interface  Two     status (Interface)
10000010B                       Zero          Endpoint   Two     status (Endpoint)
 
00000000B     SET_ADDRESS       Address       Zero       Zero    None
00000000B     SET_CONFIGURATION Configuration Zero       Zero    None
00000000B     SET_DESCRIPTOR    Type          LangID     Length  Descriptor
 
00000000B     SET_FEATURE       Feature       Zero       Zero    None (device)
00000001B                       Feature       Interface  Zero    None (Interface)
00000010B                       Feature       Endpoint   Zero    None (Endpoint)
 
00000001B     SET_INTERFACE     Alternate     Interface  Zero    None
10000010B     SYNCH_FRAME       Zero          Endpoint   Two     Frame Number

USBDeviceSpeed

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

The device is a low speed device.

Available in OS X v10.0 and later.

Declared in USB.h.

kUSBDeviceSpeedFull

The device is a full speed device.

Available in OS X v10.0 and later.

Declared in USB.h.

kUSBDeviceSpeedHigh

The device is a high speed device.

Available in OS X v10.2 and later.

Declared in USB.h.

kUSBDeviceSpeedSuper

The device is a SuperSpeed device

Available in OS X v10.7 and later.

Declared in USB.h.

Discussion

Returns the speed of a particular USB device.

USBGetEndpointVersion

enum {
   kUSBEndpointPropertiesVersion3 = 0x03
};
Constants
kUSBEndpointPropertiesVersion3

Version that has support for USB3 SuperSpeed Endpoint Companion fields.

Available in OS X v10.8 and later.

Declared in USB.h.

Discussion

Version of the IOUSBEndpointProperties structure.