Contents

initWithIOService:queue:error:interestHandler:

Creates a USB host object and sets up a default communication channel to the kernel.

Declaration

- (instancetype) initWithIOService:(io_service_t) ioService queue:(dispatch_queue_t) queue error:(NSError **) error interestHandler:(IOUSBHostInterestHandler) interestHandler;

Parameters

  • ioService:

    The service type of the Iousbhostdevice or Iousbhostinterface. The Iousbhostobject keeps a reference to the service type and releases it during Destroy().

  • queue:

    A serial dispatch queue for servicable asynchronous input/output requests. By default, this method creates a serial queue on behalf of the client.

  • error:

    An Nserror that contains an Ioreturn value on failure.

  • interestHandler:

    A callback for managing internal device state changes, such as termination.

Return Value

An IOUSBHostObject instance, or nil on failure.

Discussion

If the kernel IOUSBHostDevice or IOUSBHostInterface is already open for exclusive access, the method returns nil. The method establishes exclusive ownership of the io_service_t.

Topics

Interest Handler

See Also

Managing the Object Life Cycle