ADC Home > Reference Library > Reference > Hardware & Drivers > I/O Kit Framework Reference
|
IOUSBInterfaceInterface |
Declared In: |
The object you use to access a USB device interface from user space, returned by all versions of the IOUSBFamily currently shipping.
The functions listed here will work with any version of the IOUSBInterfaceInterface, including the one shipped with Mac OS X version 10.0.
Aborts any outstanding transactions on the pipe with status kIOReturnAborted.
Clears the halted bit and the data toggle bit on the pipe's endpoint in the controller.
Sends a USB request on a control pipe.
Sends an asynchronous USB request on a control pipe.
Creates a run loop source for delivery of all asynchronous notifications on this device.
Creates and registers a mach_port_t for asynchronous communications.
Returns the alternate setting currently selected in this interface.
Gets the current frame number of the bus to which the interface and its device are attached.
Returns the current configuration value set in the device (the interface will be part of that configuration.)
Returns the device of which this interface is part.
Returns the USB Product ID (idProduct) of the device of which this interface is a part.
Returns the Device Release Number (bcdDevice) of the device of which this interface is a part.
Returns the USB Vendor ID (idVendor) of the device of which this interface is a part.
Returns the CFRunLoopSourceRef for this IOService instance.
Returns the mach_port_t port for this IOService instance.
Returns the USB Class of the interface (bInterfaceClass).
Returns the interface number (zero-based index) of this interface within the current configuration of the device.
Returns the USB Protocol of the interface (bInterfaceProtocol).
Returns the USB Subclass of the interface (bInterfaceSubClass).
Returns the location ID.
Returns the number of endpoints in this interface, excluding the control interface (endpoint 0).
Gets the properties for a pipe.
Gets the current status of a pipe.
Performs a read on an ISOCHRONOUS pipe.
Reads data on a BULK IN or an INTERRUPT pipe.
Performs an asynchronous read on a BULK IN or an INTERRUPT pipe.
Equivalent to ClearPipeStall .
Changes the AltInterface setting.
Closes the task's connection to the IOUSBInterface.
Opensthe IOUSBInterface for exclusive access.
Performs an asynchronous write on an ISOCHRONOUS pipe.
Writes data on a BULK OUT or INTERRUPT OUT pipe.
Performs an asynchronous write on a BULK OUT or INTERRUPT OUT pipe.
AbortPipe |
Aborts any outstanding transactions on the pipe with status kIOReturnAborted.
IOReturn ( *AbortPipe)( void *self, UInt8 pipeRef);
self
Pointer to the IOUSBInterfaceInterface.
pipeRef
Index for the desired pipe (1 - GetNumEndpoints).
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, or kIOReturnNotOpen if the interface is not open for exclusive access.
If there are outstanding asynchronous transactions on the pipe, the callbacks will happen. Note that this command will also clear the halted bit on the endpoint in the controller, but will NOT clear the data toggle bit. If you want to clear the data toggle bit as well, see ClearPipeStall or ClearPipeStallBothEnds for more information. The interface must be open for the pipe to exist.
ClearPipeStall |
Clears the halted bit and the data toggle bit on the pipe's endpoint in the controller.
IOReturn ( *ClearPipeStall)( void *self, UInt8 pipeRef);
self
Pointer to the IOUSBInterfaceInterface.
pipeRef
Index for the desired pipe (1 - GetNumEndpoints ).
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, or kIOReturnNotOpen if the interface is not open for exclusive access.
This function also returns any outstanding transactions on the pipe with status kIOUSBTransactionReturned. If there are outstanding asynchronous transactions on the pipe, the callbacks will happen. The data toggle may need to be resynchronized. The driver may handle this by sending a ClearFeature(ENDPOINT_HALT) to the default control pipe, specifying the device's endpoint for this pipe. See also ClearPipeStallBothEnds.
ControlRequest |
Sends a USB request on a control pipe.
IOReturn ( *ControlRequest)( void *self, UInt8 pipeRef, IOUSBDevRequest *req);
self
Pointer to the IOUSBInterfaceInterface.
pipeRef
Index of the control pipe to use. Use zero for the default control pipe on the device.
req
Pointer to an IOUSBDevRequest containing the request.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, or kIOReturnNotOpen if the interface is not open for exclusive access.
If the request is a standard request which will change the state of the device, the device must be open, which means you should be using the IOUSBDeviceInterface for this command.
ControlRequestAsync |
Sends an asynchronous USB request on a control pipe.
IOReturn ( *ControlRequestAsync)( void *self, UInt8 pipeRef, IOUSBDevRequest *req, IOAsyncCallback1 callback, void *refCon);
self
Pointer to the IOUSBInterfaceInterface.
pipeRef
Index of the control pipe to use. Use zero for the default control pipe on the device.
req
Pointer to an IOUSBDevRequest containing the request.
callback
An IOAsyncCallback1 method. A message addressed to this callback is posted to the Async port upon completion.
refCon
Arbitrary pointer which is passed as a parameter to the callback routine.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, kIOReturnNotOpen if the interface is not open for exclusive access, or kIOUSBNoAsyncPortErr if no Async port has been created for this interface.
Use pipeRef=0 for the default device control pipe. If the request is a standard request which will change the state of the device, the device must be open, which means you should be using the IOUSBDeviceInterface for this command.
CreateInterfaceAsyncEventSource |
Creates a run loop source for delivery of all asynchronous notifications on this device.
IOReturn ( *CreateInterfaceAsyncEventSource)( void *self, CFRunLoopSourceRef *source);
self
Pointer to the IOUSBInterfaceInterface.
source
Pointer to a CFRunLoopSourceRef to return the newly created run loop event source.
Returns kIOReturnSuccess if successful or a kern_return_t if failed.
The Mac OS X kernel does not spawn a thread to callback to the client. Instead it delivers completion notifications on a Mach port (see CreateInterfaceAsyncPort). This routine wraps that port with the appropriate routing code so that the completion notifications can be automatically routed through the client's CFRunLoop.
CreateInterfaceAsyncPort |
Creates and registers a mach_port_t for asynchronous communications.
IOReturn ( *CreateInterfaceAsyncPort)( void *self, mach_port_t *port);
self
Pointer to the IOUSBInterfaceInterface.
Returns kIOReturnSuccess if successful or a kern_return_t if failed.
The Mac OS X kernel does not spawn a thread to callback to the client. Instead it delivers completion notifications on this Mach port. After receiving a message on this port the client is obliged to call the IOKitLib.h IODispatchCalloutFromMessage function for decoding the notification message.
GetAlternateSetting |
Returns the alternate setting currently selected in this interface.
IOReturn ( *GetAlternateSetting)( void *self, UInt8 *intfAltSetting);
self
Pointer to the IOUSBInterfaceInterface.
intfAltSetting
Pointer to UInt8 to hold the alternate setting value.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The interface does not have to be open to use this function.
GetBusFrameNumber |
Gets the current frame number of the bus to which the interface and its device are attached.
IOReturn ( *GetBusFrameNumber)( void *self, UInt64 *frame, AbsoluteTime *atTime);
self
Pointer to the IOUSBInterfaceInterface.
frame
Pointer to UInt64 to hold the frame number.
atTime
Pointer to an AbsoluteTime, which should be within 1ms of the time when the bus frame number was attained.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The interface does not have to be open to use this function.
GetConfigurationValue |
Returns the current configuration value set in the device (the interface will be part of that configuration.)
IOReturn ( *GetConfigurationValue)( void *self, UInt8 *configVal);
self
Pointer to the IOUSBInterfaceInterface.
configVal
Pointer to UInt8 to hold the configuration value.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The interface does not have to be open to use this function.
GetDevice |
Returns the device of which this interface is part.
IOReturn ( *GetDevice)( void *self, io_service_t *device);
self
Pointer to the IOUSBInterfaceInterface.
device
Pointer to io_service_t to hold the result.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The interface does not have to be open to use this function. The returned device can be used to create a CFPlugin to talk to the device.
GetDeviceProduct |
Returns the USB Product ID (idProduct) of the device of which this interface is a part.
IOReturn ( *GetDeviceProduct)( void *self, UInt16 *devProduct);
self
Pointer to the IOUSBInterfaceInterface.
devProduct
Pointer to UInt16 to hold the ProductID.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The interface does not have to be open to use this function.
GetDeviceReleaseNumber |
Returns the Device Release Number (bcdDevice) of the device of which this interface is a part.
IOReturn ( *GetDeviceReleaseNumber)( void *self, UInt16 *devRelNum);
self
Pointer to the IOUSBInterfaceInterface.
devRelNum
Pointer to UInt16 to hold the Release Number.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The interface does not have to be open to use this function.
GetDeviceVendor |
Returns the USB Vendor ID (idVendor) of the device of which this interface is a part.
IOReturn ( *GetDeviceVendor)( void *self, UInt16 *devVendor);
self
Pointer to the IOUSBInterfaceInterface.
devVendor
Pointer to UInt16 to hold the vendorID.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The interface does not have to be open to use this function.
GetInterfaceAsyncEventSource |
Returns the CFRunLoopSourceRef for this IOService instance.
CFRunLoopSourceRef ( *GetInterfaceAsyncEventSource)( void *self);
self
Pointer to the IOUSBInterfaceInterface.
Returns the run loop source if one has been created, 0 otherwise.
GetInterfaceAsyncPort |
Returns the mach_port_t port for this IOService instance.
mach_port_t ( *GetInterfaceAsyncPort)( void *self);
self
Pointer to the IOUSBInterfaceInterface.
Returns the port if one exists, 0 otherwise.
GetInterfaceClass |
Returns the USB Class of the interface (bInterfaceClass).
IOReturn ( *GetInterfaceClass)( void *self, UInt8 *intfClass);
self
Pointer to the IOUSBInterfaceInterface.
intfClass
Pointer to UInt8 to hold the interface Class.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The interface does not have to be open to use this function.
GetInterfaceNumber |
Returns the interface number (zero-based index) of this interface within the current configuration of the device.
IOReturn ( *GetInterfaceNumber)( void *self, UInt8 *intfNumber);
self
Pointer to the IOUSBInterfaceInterface.
intfNumber
Pointer to UInt8 to hold the interface number.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The interface does not have to be open to use this function.
GetInterfaceProtocol |
Returns the USB Protocol of the interface (bInterfaceProtocol).
IOReturn ( *GetInterfaceProtocol)( void *self, UInt8 *intfProtocol);
self
Pointer to the IOUSBInterfaceInterface.
intfProtocol
Pointer to UInt8 to hold the interface Protocol.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The interface does not have to be open to use this function.
GetInterfaceSubClass |
Returns the USB Subclass of the interface (bInterfaceSubClass).
IOReturn ( *GetInterfaceSubClass)( void *self, UInt8 *intfSubClass);
self
Pointer to the IOUSBInterfaceInterface.
intfSubClass
Pointer to UInt8 to hold the interface Subclass.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The interface does not have to be open to use this function.
GetLocationID |
Returns the location ID.
IOReturn ( *GetLocationID)( void *self, UInt32 *locationID);
self
Pointer to the IOUSBInterfaceInterface.
locationID
Pointer to UInt32 to hold the location ID.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The location ID is a 32 bit number which is unique among all USB devices in the system, and which will not change on a system reboot unless the topology of the bus itself changes. The interface does not have to be open to use this function.
GetNumEndpoints |
Returns the number of endpoints in this interface, excluding the control interface (endpoint 0).
IOReturn ( *GetNumEndpoints)( void *self, UInt8 *intfNumEndpoints);
self
Pointer to the IOUSBInterfaceInterface.
intfNumEndpoints
Pointer to UInt8 to hold the number of endpoints.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The interface does not have to be open to use this function.
GetPipeProperties |
Gets the properties for a pipe.
IOReturn ( *GetPipeProperties)( void *self, UInt8 pipeRef, UInt8 *direction, UInt8 *number, UInt8 *transferType, UInt16 *maxPacketSize, UInt8 *interval);
self
Pointer to the IOUSBInterfaceInterface.
pipeRef
Index for the desired pipe (1 - GetNumEndpoints).
direction
Pointer to an UInt8 to get the direction of the pipe.
number
Pointer to an UInt8 to get the pipe number.
transferType
Pointer to an UInt8 to get the transfer type of the pipe.
maxPacketSize
Pointer to an UInt16 to get the maxPacketSize of the pipe.
interval
Pointer to an UInt8 to get the interval for polling the pipe for data (in milliseconds).
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, or kIOReturnNotOpen if the interface is not open for exclusive access.
Once an interface is opened, all of the pipes in that interface get created by the kernel. The number of pipes can be retrieved by GetNumEndpoints. The client can then get the properties of any pipe using an index of 1 to GetNumEndpoints. Pipe 0 is the default control pipe in the device.
GetPipeStatus |
Gets the current status of a pipe.
IOReturn ( *GetPipeStatus)( void *self, UInt8 pipeRef);
self
Pointer to the IOUSBInterfaceInterface.
pipeRef
Index for the desired pipe (1 - GetNumEndpoints ).
Returns kIOReturnNoDevice if there is no connection to an IOService, or kIOReturnNotOpen if the interface is not open for exclusive access. Otherwise, the status of the pipe is returned. Returns kIOUSBPipeStalled if the pipe is stalled. See ClearPipeStall or ClearPipeStallBothEnds for more information.
The interface must be open for the pipe to exist.
ReadIsochPipeAsync |
Performs a read on an ISOCHRONOUS pipe.
IOReturn ( *ReadIsochPipeAsync)( void *self, UInt8 pipeRef, void *buf, UInt64 frameStart, UInt32 numFrames, IOUSBIsocFrame *frameList, IOAsyncCallback1 callback, void *refcon);
self
Pointer to the IOUSBInterfaceInterface.
pipeRef
Index for the desired pipe (1 - GetNumEndpoints ).
buf
Buffer to hold the data.
frameStart
The bus frame number on which to start the read (obtained from GetBusFrameNumber).
numFrames
The number of frames for which to transfer data.
frameList
A pointer to an array of IOUSBIsocFrame structures describing the frames.
callback
An IOAsyncCallback1 method. A message addressed to this callback is posted to the Async port upon completion.
refCon
Arbitrary pointer which is passed as a parameter to the callback routine.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, or kIOReturnNotOpen if the interface is not open for exclusive access.
The interface must be open for the pipe to exist.
ReadPipe |
Reads data on a BULK IN or an INTERRUPT pipe.
IOReturn ( *ReadPipe)( void *self, UInt8 pipeRef, void *buf, UInt32 *size);
self
Pointer to the IOUSBInterfaceInterface.
pipeRef
Index for the desired pipe (1 - GetNumEndpoints ).
buf
Buffer to hold the data.
size
On entry: a pointer to the size of the buffer pointed to by buf. On exit: a pointer to the number of bytes actually read from the device.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, or kIOReturnNotOpen if the interface is not open for exclusive access.
The interface must be open for the pipe to exist.
ReadPipeAsync |
Performs an asynchronous read on a BULK IN or an INTERRUPT pipe.
IOReturn ( *ReadPipeAsync)( void *self, UInt8 pipeRef, void *buf, UInt32 size, IOAsyncCallback1 callback, void *refcon);
self
Pointer to the IOUSBInterfaceInterface.
pipeRef
Index for the desired pipe (1 - GetNumEndpoints ).
buf
Buffer to hold the data.
size
The size of the buffer pointed to by buf.
callback
An IOAsyncCallback1 method. A message addressed to this callback is posted to the Async port upon completion.
refCon
Arbitrary pointer which is passed as a parameter to the callback routine.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, or kIOReturnNotOpen if the interface is not open for exclusive access.
The interface must be open for the pipe to exist.
ResetPipe |
Equivalent to ClearPipeStall.
IOReturn ( *ResetPipe)( void *self, UInt8 pipeRef);
self
Pointer to the IOUSBInterfaceInterface.
pipeRef
Index for the desired pipe (1 - GetNumEndpoints ).
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, or kIOReturnNotOpen if the interface is not open for exclusive access.
The interface must be open for the pipe to exist.
SetAlternateInterface |
Changes the AltInterface setting.
IOReturn ( *SetAlternateInterface)( void *self, UInt8 alternateSetting);
self
Pointer to the IOUSBInterfaceInterface.
alternateSetting
The new alternate setting for the interface.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, or kIOReturnNotOpen if the interface is not open for exclusive access.
The interface must be open to use this function.
USBInterfaceClose |
Closes the task's connection to the IOUSBInterface.
IOReturn ( *USBInterfaceClose)( void *self);
self
Pointer to the IOUSBInterfaceInterface.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
Releases the client's exclusive access to the IOUSBInterface.
USBInterfaceOpen |
Opensthe IOUSBInterface for exclusive access.
IOReturn ( *USBInterfaceOpen)( void *self);
self
Pointer to the IOUSBInterfaceInterface.
Returns kIOReturnExclusiveAccess if some other task has the device opened already, kIOReturnError if the connection with the kernel cannot be established or kIOReturnSuccess if successful.
Before the client can transfer data to and from the interface, it must have succeeded in opening the interface. This establishes an exclusive link between the client's task and the actual interface device. Opening the interface causes pipes to be created on each endpoint contained in the interface. If the interface contains isochronous endpoints, an attempt is made to allocate bandwidth on the bus for each of those pipes. If there is not enough bandwidth available, an isochronous pipe may be created with a bandwidth of zero. The software must then call SetPipePolicy to change the size of that pipe before it can be used for I/O.
WriteIsochPipeAsync |
Performs an asynchronous write on an ISOCHRONOUS pipe.
IOReturn ( *WriteIsochPipeAsync)( void *self, UInt8 pipeRef, void *buf, UInt64 frameStart, UInt32 numFrames, IOUSBIsocFrame *frameList, IOAsyncCallback1 callback, void *refcon);
self
Pointer to the IOUSBInterfaceInterface.
pipeRef
Index for the desired pipe (1 - GetNumEndpoints ).
buf
Buffer to hold the data.
frameStart
The bus frame number on which to start the write (obtained from GetBusFrameNumber).
numFrames
The number of frames for which to transfer data.
frameList
A pointer to an array of IOUSBIsocFrame structures describing the frames.
callback
An IOAsyncCallback1 method. A message addressed to this callback is posted to the Async port upon completion.
refCon
Arbitrary pointer which is passed as a parameter to the callback routine.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, or kIOReturnNotOpen if the interface is not open for exclusive access.
The interface must be open for the pipe to exist.
WritePipe |
Writes data on a BULK OUT or INTERRUPT OUT pipe.
IOReturn ( *WritePipe)( void *self, UInt8 pipeRef, void *buf, UInt32 size);
self
Pointer to the IOUSBInterfaceInterface.
pipeRef
Index for the desired pipe (1 - GetNumEndpoints ).
buf
Buffer to hold the data.
size
The size of the data buffer.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, or kIOReturnNotOpen if the interface is not open for exclusive access.
The interface must be open for the pipe to exist.
WritePipeAsync |
Performs an asynchronous write on a BULK OUT or INTERRUPT OUT pipe.
IOReturn ( *WritePipeAsync)( void *self, UInt8 pipeRef, void *buf, UInt32 size, IOAsyncCallback1 callback, void *refcon);
self
Pointer to the IOUSBInterfaceInterface.
pipeRef
Index for the desired pipe (1 - GetNumEndpoints ).
buf
Buffer to hold the data.
size
The size of the buffer pointed to by buf.
callback
An IOAsyncCallback1 method. A message addressed to this callback is posted to the Async port upon completion.
refCon
Arbitrary pointer which is passed as a parameter to the callback routine.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, or kIOReturnNotOpen if the interface is not open for exclusive access.
The interface must be open for the pipe to exist.
|
Last Updated: 2009-02-23