|
Mac Dev Center
Mac OS X Reference Library Drivers, Kernel, & Hardware: Kernel Device Drivers Kernel Framework Reference
|
IOUSBDevice |
| Inherits from: | |
| Declared In: |
The IOService object representing a device on the USB bus.
This class provides functionality to configure a device and to create IOUSBInterface objects to represent the interfaces of the device.
execute a control request to the default control pipe (pipe zero)
execute a control request to the default control pipe (pipe zero)
Will use the KUNCUserNotification mechanism to display a notification to the user.
Returns status information about the USB device, such as whether the device is captive or whether it is in the suspended state.
Clients can use this API to ask how much extra power has already been reserved by this device. Units are milliAmps (mA).
Used by the hub driver to give the nub a pointer to its HubPolicyMaker object
build a pipe on a given endpoint
Instruct the hub to which this device is attached to reset the port to which this device is attached. This causes the IOUSBDevice object and any child objects (IOUSBInterface objects or driver objects) to be terminated, and the device to be completely reenumerated, as if it had been detached and reattached.
Clients can use this API to reserve extra power for use by this device while the machine is asleep or while it is awake. Units are milliAmps (mA).
Clients can use this API to tell the system that they will not use power that was previously reserved by using the RequestExtraPower API.
Used by the hub driver to give the nub a pointer to its HubPolicyMaker object
Instruct the hub to which this device is attached to suspend or resume the port to which the device is attached. Note that if there are any outstanding transactions on any pipes in the device, those transactions will get returned with a kIOReturnNotResponding error.
CreateInterfaceIterator |
public
virtual OSIterator *CreateInterfaceIterator( IOUSBFindInterfaceRequest *request);
requestspecifies what properties an interface must have to match.
Pointer to an OSIterator.
return an OSIterator to iterate through interfaces satisfying the requirements specified in request.
DeviceRequest(IOUSBDevRequest *, UInt32, UInt32, IOUSBCompletion *) |
execute a control request to the default control pipe (pipe zero)
public
virtual IOReturn DeviceRequest( IOUSBDevRequest *request, UInt32 noDataTimeout, UInt32 completionTimeout, IOUSBCompletion *completion = 0);
requestThe parameter block to send to the device
noDataTimeoutSpecifies an amount of time (in ms) after which the command will be aborted if no data has been transferred on the bus.
completionTimeoutSpecifies an amount of time (in ms) after which the command will be aborted if the entire command has not been completed.
completionFunction to call when request completes. If omitted then DeviceRequest() executes synchronously, blocking until the request is complete. If the request is asynchronous, the client must make sure that the IOUSBDevRequest is not released until the callback has occurred.
DeviceRequest(IOUSBDevRequestDesc *, UInt32, UInt32, IOUSBCompletion *) |
execute a control request to the default control pipe (pipe zero)
public
virtual IOReturn DeviceRequest( IOUSBDevRequestDesc *request, UInt32 noDataTimeout, UInt32 completionTimeout, IOUSBCompletion *completion = 0);
requestThe parameter block to send to the device (with the pData as an IOMemoryDesriptor)
noDataTimeoutSpecifies an amount of time (in ms) after which the command will be aborted if no data has been transferred on the bus.
completionTimeoutSpecifies an amount of time (in ms) after which the command will be aborted if the entire command has not been completed.
completionFunction to call when request completes. If omitted then DeviceRequest() executes synchronously, blocking until the request is complete. If the request is asynchronous, the client must make sure that the IOUSBDevRequest is not released until the callback has occurred.
DisplayUserNotification |
Will use the KUNCUserNotification mechanism to display a notification to the user.
public
virtual void DisplayUserNotification( UInt32 notificationType);
notificationTypeWhich notification to display.
FindNextInterface |
public
virtual IOUSBInterface *FindNextInterface( IOUSBInterface *current, IOUSBFindInterfaceRequest *request);
currentinterface to start searching from, NULL to start at the beginning of the device's interface list for the current configuration.
requestspecifies what properties an interface must have to match.
Pointer to a matching IOUSBInterface, or NULL if none match. Note: The IOUSBInterface is NOT retained for the caller. If the caller wishes to continue to use the returned object, it should call retain() on that object.
return an pointer to an IOUSBInterface object satisfying the requirements specified in request, or NULL if there aren't any. the device must be configured for there to be any interfaces.
FindNextInterfaceDescriptor |
public
virtual IOReturn FindNextInterfaceDescriptor( const IOUSBConfigurationDescriptor *configDescIn, const IOUSBInterfaceDescriptor *intfDesc, const IOUSBFindInterfaceRequest *request, IOUSBInterfaceDescriptor **descOut);
configDescInthe configuration descriptor within which to search. obtained from GetFullConfigurationDescriptor(configIndex). use NULL to specify the current configuration's descriptor.
intfDescinterface descriptor from which to start the search. NULL for the first interface descriptor in the given configuration descriptor
requestIOUSBFindInterfaceRequest specifying the desired interface. Not changed.
descOutpointer to placeholder for the returned descriptor ptr
returns kIOReturnBadArgument if configDesc is not correct, or if configDesc is NULL and the device is not configured, or if intfDesc is not in configDesc. Otherwise returns kIOReturnSuccess or kIOUSBInterfaceNotFound.
return a pointer to the next interface descriptor within the given full configuration descriptor satisfying the requirements specified, or NULL if there aren't any.
GetAddress |
public
virtual USBDeviceAddress GetAddress( void);
returns the bus address of the device
GetBus |
public
virtual IOUSBController *GetBus( void);
returns a pointer to the IOUSBController object for the device
GetBusPowerAvailable |
public
virtual UInt32 GetBusPowerAvailable( void );
returns the power available to the device, in units of 2mA
GetChildLocationID |
public
virtual UInt32 GetChildLocationID( UInt32 parentLocationID, int port);
parentLocationIDlocationID for the hub to which this device is attached.
portPort number of the hub where this device is attached
Get the locationID (UInt32) given the port number and the parent's location
GetConfiguration |
public
virtual IOReturn GetConfiguration( UInt8 *configNumber);
configNumPointer to place to store configuration value.
Gets the current configuration from the IOUSBDevice object. Note that this call will send a control request on the bus to get the current configuration from the physical device.
GetConfigurationDescriptor |
public
virtual IOReturn GetConfigurationDescriptor( UInt8 configValue, void *data, UInt32 len);
configValueThe configuration value
dataBuffer to copy data into
lennumber of bytes to copy
Copy the specified amount of data for a configuration into the suppled buffer.
GetDeviceInformation |
Returns status information about the USB device, such as whether the device is captive or whether it is in the suspended state.
public
virtual IOReturn GetDeviceInformation( UInt32 *info);
requestedPowerThe desired amount of power that the client wishes to reserve
Actual power that was reserved
GetDeviceRelease |
public
virtual UInt16 GetDeviceRelease( void);
returns the DeviceRelease information
GetDeviceStatus |
public
virtual IOReturn GetDeviceStatus( USBStatus *status);
statusPointer to place to store the status.
Gets the device's status. Note that this sends a control request to the physical device.
GetExtraPowerAllocated |
Clients can use this API to ask how much extra power has already been reserved by this device. Units are milliAmps (mA).
public
virtual UInt32 GetExtraPowerAllocated( UInt32 type);
typeIndicates whether the allocated power was to be used during wake or sleep (One of kUSBPowerDuringSleep or kUSBPowerDuringWake)
Amount of power allocated, in mA. .
GetFullConfigurationDescriptor |
public
virtual const IOUSBConfigurationDescriptor *GetFullConfigurationDescriptor(UInt8 configIndex);
configIndexThe configuration index (not the configuration value)
Pointer to the descriptors, which are cached in the IOUSBDevice object.
return a pointer to all the descriptors for the requested configuration.
GetHubParent |
Used by the hub driver to give the nub a pointer to its HubPolicyMaker object
public
virtual IOUSBHubPolicyMaker* GetHubParent();
hubPolicyMakerThe object representing the Hub driver
GetManufacturerStringIndex |
public
virtual UInt8 GetManufacturerStringIndex( void );
returns the index of string descriptor describing manufacturer
GetMaxPacketSize |
public
virtual UInt8 GetMaxPacketSize( void);
returns the maximum packet size for endpoint zero (only 8, 16, 32, 64 are valid)
GetNumConfigurations |
public
virtual UInt8 GetNumConfigurations( void);
returns the number of configs in the device config descriptor
GetPipeZero |
public
virtual IOUSBPipe * GetPipeZero( void);
returns a pointer to the device's default control pipe
GetProductID |
public
virtual UInt16 GetProductID( void);
returns the Product ID of the device
GetProductStringIndex |
public
virtual UInt8 GetProductStringIndex( void );
returns the index of string descriptor describing product
GetSerialNumberStringIndex |
public
virtual UInt8 GetSerialNumberStringIndex( void );
returns the index of string descriptor describing the device's serial number
GetSpeed |
public
virtual UInt8 GetSpeed( void);
returns the speed of the device
GetStringDescriptor |
public
virtual IOReturn GetStringDescriptor( UInt8 index, char *buf, int maxLen, UInt16 lang=0x409);
indexIndex of the string descriptor to get.
bufPointer to place to store ASCII string
maxLenSize of buffer pointed to by buf
langLanguage to get string in (default is US English)
Get a string descriptor as ASCII, in the specified language (default is US English)
GetVendorID |
public
virtual UInt16 GetVendorID( void);
returns the Vendor ID of the device
MakePipe |
build a pipe on a given endpoint
public
virtual IOUSBPipe* MakePipe( const IOUSBEndpointDescriptor *ep, IOUSBInterface *interface);
epA description of the endpoint
interfaceThe IOUSBInterface object requesting the pipe returns the desired IOUSBPipe object
ReEnumerateDevice |
Instruct the hub to which this device is attached to reset the port to which this device is attached. This causes the IOUSBDevice object and any child objects (IOUSBInterface objects or driver objects) to be terminated, and the device to be completely reenumerated, as if it had been detached and reattached.
public
virtual IOReturn ReEnumerateDevice( UInt32 options );
optionsReserved for future use.
RequestExtraPower |
Clients can use this API to reserve extra power for use by this device while the machine is asleep or while it is awake. Units are milliAmps (mA).
public
virtual UInt32 RequestExtraPower( UInt32 type, UInt32 requestedPower);
typeIndicates whether the power is to be used during wake or sleep (One of kUSBPowerDuringSleep or kUSBPowerDuringWake)
requestedPowerAmount of power desired, in mA
Amount of power actually reserved, in mA. It can be less than the requested or zero.
ResetDevice |
public
virtual IOReturn ResetDevice();
Reset the device, returning it to the addressed, unconfigured state. This is useful if a device has got badly confused. Note that the AppleUSBComposite driver will automatically reconfigure the device if it is a composite device.
ReturnExtraPower |
Clients can use this API to tell the system that they will not use power that was previously reserved by using the RequestExtraPower API.
public
virtual IOReturn ReturnExtraPower( UInt32 type, UInt32 returnedPower);
typeIndicates whether the power is to be used during wake or sleep (One of kUSBPowerDuringSleep or kUSBPowerDuringWake)
returnedPowerAmount of power that is no longer needed, in mA
If the returnedPower was not previously allocated, an error will be returned. This will include the case for power that was requested for sleep but was returned for wake.
SetConfiguration |
public
virtual IOReturn SetConfiguration( IOService *forClient, UInt8 configValue, bool startInterfaceMatching=true);
forClientThe client requesting the configuration change
configValueThe desired configuration value.
startInterfaceMatchingA boolean specifying whether IOKit should begin the process of finding matching drivers for the new IOUSBInterface objects.
Do a USB SetConfiguration call to the device. The caller must have the device open() in order to actually cause a configuration change. If the device is currently configured, all IOUSBInterface objects associated with the device are freed. After the new configuration has been set, all of its IOUSBInterface objects are instantiated automatically.
SetHubParent |
Used by the hub driver to give the nub a pointer to its HubPolicyMaker object
public
virtual void SetHubParent( IOUSBHubPolicyMaker *hubParent);
hubPolicyMakerThe object representing the Hub driver
SuspendDevice |
Instruct the hub to which this device is attached to suspend or resume the port to which the device is attached. Note that if there are any outstanding transactions on any pipes in the device, those transactions will get returned with a kIOReturnNotResponding error.
public
virtual IOReturn SuspendDevice( bool suspend);
suspendBoolean value. true = suspend, false = resume.
Last Updated: 2009-10-14