|
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);
selfPointer to the IOUSBInterfaceInterface.
pipeRefIndex 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);
selfPointer to the IOUSBInterfaceInterface.
pipeRefIndex 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);
selfPointer to the IOUSBInterfaceInterface.
pipeRefIndex of the control pipe to use. Use zero for the default control pipe on the device.
reqPointer 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);
selfPointer to the IOUSBInterfaceInterface.
pipeRefIndex of the control pipe to use. Use zero for the default control pipe on the device.
reqPointer to an IOUSBDevRequest containing the request.
callbackAn IOAsyncCallback1 method. A message addressed to this callback is posted to the Async port upon completion.
refConArbitrary 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);
selfPointer to the IOUSBInterfaceInterface.
sourcePointer 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);
selfPointer 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);
selfPointer to the IOUSBInterfaceInterface.
intfAltSettingPointer 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);
selfPointer to the IOUSBInterfaceInterface.
framePointer to UInt64 to hold the frame number.
atTimePointer 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);
selfPointer to the IOUSBInterfaceInterface.
configValPointer 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);
selfPointer to the IOUSBInterfaceInterface.
devicePointer 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);
selfPointer to the IOUSBInterfaceInterface.
devProductPointer 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);
selfPointer to the IOUSBInterfaceInterface.
devRelNumPointer 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);
selfPointer to the IOUSBInterfaceInterface.
devVendorPointer 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);
selfPointer 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);
selfPointer 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);
selfPointer to the IOUSBInterfaceInterface.
intfClassPointer 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);
selfPointer to the IOUSBInterfaceInterface.
intfNumberPointer 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);
selfPointer to the IOUSBInterfaceInterface.
intfProtocolPointer 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);
selfPointer to the IOUSBInterfaceInterface.
intfSubClassPointer 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);
selfPointer to the IOUSBInterfaceInterface.
locationIDPointer 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);
selfPointer to the IOUSBInterfaceInterface.
intfNumEndpointsPointer 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);
selfPointer to the IOUSBInterfaceInterface.
pipeRefIndex for the desired pipe (1 - GetNumEndpoints).
directionPointer to an UInt8 to get the direction of the pipe.
numberPointer to an UInt8 to get the pipe number.
transferTypePointer to an UInt8 to get the transfer type of the pipe.
maxPacketSizePointer to an UInt16 to get the maxPacketSize of the pipe.
intervalPointer 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);
selfPointer to the IOUSBInterfaceInterface.
pipeRefIndex 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);
selfPointer to the IOUSBInterfaceInterface.
pipeRefIndex for the desired pipe (1 - GetNumEndpoints ).
bufBuffer to hold the data.
frameStartThe bus frame number on which to start the read (obtained from GetBusFrameNumber).
numFramesThe number of frames for which to transfer data.
frameListA pointer to an array of IOUSBIsocFrame structures describing the frames.
callbackAn IOAsyncCallback1 method. A message addressed to this callback is posted to the Async port upon completion.
refConArbitrary 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);
selfPointer to the IOUSBInterfaceInterface.
pipeRefIndex for the desired pipe (1 - GetNumEndpoints ).
bufBuffer to hold the data.
sizeOn 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);
selfPointer to the IOUSBInterfaceInterface.
pipeRefIndex for the desired pipe (1 - GetNumEndpoints ).
bufBuffer to hold the data.
sizeThe size of the buffer pointed to by buf.
callbackAn IOAsyncCallback1 method. A message addressed to this callback is posted to the Async port upon completion.
refConArbitrary 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);
selfPointer to the IOUSBInterfaceInterface.
pipeRefIndex 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);
selfPointer to the IOUSBInterfaceInterface.
alternateSettingThe 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);
selfPointer 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);
selfPointer 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);
selfPointer to the IOUSBInterfaceInterface.
pipeRefIndex for the desired pipe (1 - GetNumEndpoints ).
bufBuffer to hold the data.
frameStartThe bus frame number on which to start the write (obtained from GetBusFrameNumber).
numFramesThe number of frames for which to transfer data.
frameListA pointer to an array of IOUSBIsocFrame structures describing the frames.
callbackAn IOAsyncCallback1 method. A message addressed to this callback is posted to the Async port upon completion.
refConArbitrary 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);
selfPointer to the IOUSBInterfaceInterface.
pipeRefIndex for the desired pipe (1 - GetNumEndpoints ).
bufBuffer to hold the data.
sizeThe 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);
selfPointer to the IOUSBInterfaceInterface.
pipeRefIndex for the desired pipe (1 - GetNumEndpoints ).
bufBuffer to hold the data.
sizeThe size of the buffer pointed to by buf.
callbackAn IOAsyncCallback1 method. A message addressed to this callback is posted to the Async port upon completion.
refConArbitrary 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