openusb_open_device,openusb_close_device
handle
- Libusb handle.
devid
- Device's devid.
flags
- Initialization flag.
dev
- Device handle
openusb_open_device
prepares a device and sets up internal
data structures for use by openusb. openusb_close_device
returns the
opened device to its original state.
Application must call openusb_open_device()
to open a device before it can do any USB transfers on that device. The open
flags
can be:
USB_INIT_DEFAULT default behavior USB_INIT_FAIL_FAST fail if not immediately available USB_INIT_REVERSIBLE try platform dependent things that are guaranteed to be reversed on close USB_INIT_NON_REVERSIBLE try advanced platform dependent things that may not be guaranteed to be reversible on close |
Upon successful open of a device, the device handle is returned in dev
.
All device associated operations will use this handle.
openusb_close_device()
will destroy some internal data structures associated
with the device handle dev
.
LIBUSB_SUCCESS - Success.
LIBUSB_NO_RESOURCES - Memory allocation failure.
LIBUSB_UNKNOWN_DEVICE - Can't find the device specified by devid
.
LIBUSB_SYS_FUNC_FAILURE - System function fails.
LIBUSB_INVALID_HANDLE - Libusb handle
is invalid.
LIBUSB_PLATFORM_FAILURE - Unspecified kernel/driver failure.
LIBUSB_IO_* - USB host controller errors