USBD_OPEN_DEVICE
Purpose
Opens a specific USB logical device.
Syntax
int fp_ioctl (file, USBD_OPEN_DEVICE, arg, ext)
Parameter
Item | Description |
---|---|
file | File descriptor that is obtained when the USBD special file was opened. |
arg | Address of an initialized DEVOPEN structure (See the DEVOPEN structure that is defined in the /usr/include/sys/usbdi.h file). |
ext | Not used and must be set to zero. |
Description
The client driver uses this fp_ioctl to establish a connection to a specific USB logical device as identified by information within the DEVSELECTOR structure. A USB logical device can be opened by only one client driver at a time. After a client is opened the device, it must connect to a pipe before data flows to or from the device. This includes the default control pipe. The client driver must close any device that it is opened when it is not managing the device by calling usbdCloseDevice call vector.
Typically, a client driver must open the USB System Driver, issue a USBD_OPEN_DEVICE ioctl to open a specific USB device, and then close the USB System Driver. The client must then communicate with the USB system driver by using the handle returned by the USBD_OPEN_DEVICE ioctl and the interface macros located within the usbdi.hfile.
To properly track the USB device must it be moved or replaced, it is strongly recommended that the client open the device when the client is configured and closed the USB device when the client is un-configured.
Execution Environment
This function may be called from the user process environment only.
Return Values
Value | Description |
---|---|
0 | Indicates successful completion. |
EINVAL | Invalid parameter. |
ENODEV | Indicates that the device with matching selection criteria does not exist. The selection criteria include matching class, subclass, and protocol. |