ADC Home > Reference Library > Reference > Hardware & Drivers > I/O Kit Framework Reference
|
IOUSBDeviceInterface |
Declared In: |
The object you use to access USB devices from user space, returned by all versions of the IOUSBFamily currently shipping.
The functions listed here will work with any version of the IOUSBDeviceInterface, including the one shipped with Mac OS X version 10.0.
Creates a run loop source for delivery of all asynchronous notifications on this device.
Creates and registers a mach_port_t for asynchronous communications.
Creates an iterator to iterate over some or all of the interfaces of a device.
Sends a USB request on the default control pipe.
Sends an asynchronous USB request on the default control pipe.
Gets the current frame number of the bus to which the device is attached.
Returns the currently selected configuration in the device.
Returns a pointer to a configuration descriptor for a given index.
Returns the address of the device on its bus.
Returns the CFRunLoopSourceRef for this IOService instance.
Returns the mach_port_t port for this IOService instance.
Returns the power available to the device.
Returns the USB Class (bDeviceClass) of the device.
Returns the USB Product ID (idProduct) of the device.
Returns the USB Protocol (bDeviceProtocol) of the interface.
Returns the Device Release Number (bcdDevice) of the device.
Returns the speed of the device.
Returns the USB Subclass (bDeviceSubClass) of the device.
Returns the USB Vendor ID (idVendor) of the device.
Returns the location ID.
Returns the number of supported configurations in this device.
Tells the IOUSBFamily to issue a reset to the device.
Sets the configuration in the device.
Closes the task's connection to the IOUSBDevice.
Opens the IOUSBDevice for exclusive access.
CreateDeviceAsyncEventSource |
Creates a run loop source for delivery of all asynchronous notifications on this device.
IOReturn ( *CreateDeviceAsyncEventSource)( void *self, CFRunLoopSourceRef *source);
self
Pointer to the IOUSBDeviceInterface.
source
Pointer to a CFRunLoopSourceRef to return the newly created run loop event source.
Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
The Mac OS X kernel does not spawn a thread to callback to the client. Instead it delivers completion notifications (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.
CreateDeviceAsyncPort |
Creates and registers a mach_port_t for asynchronous communications.
IOReturn ( *CreateDeviceAsyncPort)( void *self, mach_port_t *port);
self
Pointer to the IOUSBDeviceInterface.
port
Pointer to a mach_port_t to return the newly created port.
Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
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.
CreateInterfaceIterator |
Creates an iterator to iterate over some or all of the interfaces of a device.
IOReturn ( *CreateInterfaceIterator)( void *self, IOUSBFindInterfaceRequest *req, io_iterator_t *iter);
self
Pointer to the IOUSBDeviceInterface.
req
Pointer an IOUSBFindInterfaceRequest structure describing the desired interfaces.
iter
Pointer to a an io_iterator_t to contain the new iterator.
Returns kIOReturnSuccess if successful or kIOReturnNoDevice if there is no connection to an IOService.
The device does not have to be open to use this function.
DeviceRequest |
Sends a USB request on the default control pipe.
IOReturn ( *DeviceRequest)( void *self, IOUSBDevRequest *req);
self
Pointer to the IOUSBDeviceInterface.
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 device is not open for exclusive access.
The device must be open to issue this call. Care should be taken when issuing a device request which changes the state of the device. Use the API, for example, to change the configuration of the device or to select an alternate setting on an interface.
DeviceRequestAsync |
Sends an asynchronous USB request on the default control pipe.
IOReturn ( *DeviceRequestAsync)( void *self, IOUSBDevRequest *req, IOAsyncCallback1 callback, void *refCon);
self
Pointer to the IOUSBDeviceInterface.
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 device is not open for exclusive access, or kIOUSBNoAsyncPortErr if no Async port has been created for this interface.
The device must be open to issue this command. Care should be taken when issuing a device request which changes the state of the device. Use the API, for example, to change the configuration of the device or to select an alternate setting on an interface.
GetBusFrameNumber |
Gets the current frame number of the bus to which the device is attached.
IOReturn ( *GetBusFrameNumber)( void *self, UInt64 *frame, AbsoluteTime *atTime);
self
Pointer to the IOUSBDeviceInterface.
frame
Pointer to UInt64 to hold the frame number.
atTime
Pointer to a returned AbsoluteTime, which is the system time ("wall time") when the frame number register was read. This system time could be the time at the beginning, middle, or end of the given frame.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The device does not have to be open to use this function.
GetConfiguration |
Returns the currently selected configuration in the device.
IOReturn ( *GetConfiguration)( void *self, UInt8 *configNum);
self
Pointer to the IOUSBDeviceInterface.
configNum
Pointer to UInt8 to hold the configuration value.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The device does not have to be open to use this function.
GetConfigurationDescriptorPtr |
Returns a pointer to a configuration descriptor for a given index.
IOReturn ( *GetConfigurationDescriptorPtr)( void *self, UInt8 configIndex, IOUSBConfigurationDescriptorPtr *desc);
self
Pointer to the IOUSBDeviceInterface.
configIndex
The index (zero based) of the desired config descriptor.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
Note that this will point to the data as received from the USB bus and hence will be in USB bus order (i.e. little endian). The device does not have to be open to use this function.
GetDeviceAddress |
Returns the address of the device on its bus.
IOReturn ( *GetDeviceAddress)( void *self, USBDeviceAddress *addr);
self
Pointer to the IOUSBDeviceInterface.
addr
Pointer to USBDeviceAddress to hold the result.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The device does not have to be open to use this function.
GetDeviceAsyncEventSource |
Returns the CFRunLoopSourceRef for this IOService instance.
CFRunLoopSourceRef ( *GetDeviceAsyncEventSource)( void *self);
self
Pointer to the IOUSBDeviceInterface.
Returns the run loop source if one has been created, 0 otherwise.
GetDeviceAsyncPort |
Returns the mach_port_t port for this IOService instance.
mach_port_t ( *GetDeviceAsyncPort)( void *self);
self
Pointer to the IOUSBDeviceInterface.
Returns the port if one exists, 0 otherwise.
GetDeviceBusPowerAvailable |
Returns the power available to the device.
IOReturn ( *GetDeviceBusPowerAvailable)( void *self, UInt32 *powerAvailable);
self
Pointer to the IOUSBDeviceInterface.
powerAvailable
Pointer to UInt32 to hold the power available (in 2 mA increments).
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The device does not have to be open to use this function.
GetDeviceClass |
Returns the USB Class (bDeviceClass) of the device.
IOReturn ( *GetDeviceClass)( void *self, UInt8 *devClass);
self
Pointer to the IOUSBDeviceInterface.
devClass
Pointer to UInt8 to hold the device Class.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The device does not have to be open to use this function.
GetDeviceProduct |
Returns the USB Product ID (idProduct) of the device.
IOReturn ( *GetDeviceProduct)( void *self, UInt16 *devProduct);
self
Pointer to the IOUSBDeviceInterface.
devProduct
Pointer to UInt16 to hold the ProductID.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The device does not have to be open to use this function.
GetDeviceProtocol |
Returns the USB Protocol (bDeviceProtocol) of the interface.
IOReturn ( *GetDeviceProtocol)( void *self, UInt8 *devProtocol);
self
Pointer to the IOUSBDeviceInterface.
devProtocol
Pointer to UInt8 to hold the device Protocol.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The device does not have to be open to use this function.
GetDeviceReleaseNumber |
Returns the Device Release Number (bcdDevice) of the device.
IOReturn ( *GetDeviceReleaseNumber)( void *self, UInt16 *devRelNum);
self
Pointer to the IOUSBDeviceInterface.
devRelNum
Pointer to UInt16 to hold the Device Release Number.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The device does not have to be open to use this function.
GetDeviceSpeed |
Returns the speed of the device.
IOReturn ( *GetDeviceSpeed)( void *self, UInt8 *devSpeed);
self
Pointer to the IOUSBDeviceInterface.
devSpeed
Pointer to UInt8 to hold the speed (kUSBDeviceSpeedLow, kUSBDeviceSpeedFull, or kUSBDeviceSpeedHigh).
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The device does not have to be open to use this function.
GetDeviceSubClass |
Returns the USB Subclass (bDeviceSubClass) of the device.
IOReturn ( *GetDeviceSubClass)( void *self, UInt8 *devSubClass);
self
Pointer to the IOUSBDeviceInterface.
devSubClass
Pointer to UInt8 to hold the device Subclass.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The device does not have to be open to use this function.
GetDeviceVendor |
Returns the USB Vendor ID (idVendor) of the device.
IOReturn ( *GetDeviceVendor)( void *self, UInt16 *devVendor);
self
Pointer to the IOUSBDeviceInterface.
devVendor
Pointer to UInt16 to hold the vendorID.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The device 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 IOUSBDeviceInterface.
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 device does not have to be open to use this function.
GetNumberOfConfigurations |
Returns the number of supported configurations in this device.
IOReturn ( *GetNumberOfConfigurations)( void *self, UInt8 *numConfig);
self
Pointer to the IOUSBDeviceInterface.
numConfig
Pointer to UInt8 to hold the number of configurations.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
The device does not have to be open to use this function.
ResetDevice |
Tells the IOUSBFamily to issue a reset to the device.
IOReturn ( *ResetDevice)( void *self);
self
Pointer to the IOUSBDeviceInterface.
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, or kIOReturnNotOpen if the device is not open for exclusive access.
It will not reenumerate the device, which means that the cached device descriptor values will not be updated after the reset. (If you want the IOUSBFamily to reload the cached values, use the call USBDeviceReEnumerate ). Prior to version 1.8.5 of the IOUSBFamily, this call also sent a message to all clients of the IOUSBDevice (IOUSBInterfaces and their drivers). The device must be open to use this function.
This behavior was eliminated in version 1.8.5 of the IOUSBFamily.
SetConfiguration |
Sets the configuration in the device.
IOReturn ( *SetConfiguration)( void *self, UInt8 configNum);
self
Pointer to the IOUSBDeviceInterface.
configNum
The value of the desired configuration (from IOUSBConfigurationDescriptor.bConfigurationValue).
Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, or kIOReturnNotOpen if the device is not open for exclusive access.
Note that setting the configuration causes any existing IOUSBInterface objects attached to the IOUSBDevice to be destroyed, and all of the interfaces in the new configuration to be instantiated as new IOUSBInterface objects. The device must be open to use this function.
USBDeviceClose |
Closes the task's connection to the IOUSBDevice.
IOReturn ( *USBDeviceClose)( void *self);
self
Pointer to the IOUSBDeviceInterface.
Returns kIOReturnSuccess if successful, some other mach error if the connection is no longer valid.
Releases the client's exclusive access to the IOUSBDevice.
USBDeviceOpen |
Opens the IOUSBDevice for exclusive access.
IOReturn ( *USBDeviceOpen)( void *self);
self
Pointer to the IOUSBDeviceInterface.
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 issue commands that change the state of the device, it must have succeeded in opening the device. This establishes an exclusive link between the client's task and the actual device.
|
Last Updated: 2009-02-23