Struct libusb::Context [] [src]

pub struct Context {
    // some fields omitted
}

A libusb context.

Methods

impl Context
[src]

fn new() -> Result<Self>

Opens a new libusb context.

fn set_log_level(&mut self, level: LogLevel)

Sets the log level of a libusb context.

fn has_capability(&self) -> bool

fn has_hotplug(&self) -> bool

Tests whether the running libusb library supports hotplug.

fn has_hid_access(&self) -> bool

Tests whether the running libusb library has HID access.

fn supports_detach_kernel_driver(&self) -> bool

Tests whether the running libusb library supports detaching the kernel driver.

fn devices<'a>(&'a self) -> Result<DeviceList<'a>>

Returns a list of the current USB devices. The context must outlive the device list.

fn open_device_with_vid_pid<'a>(&'a self, vendor_id: u16, product_id: u16) -> Option<DeviceHandle<'a>>

Convenience function to open a device by its vendor ID and product ID.

This function is provided as a convenience for building prototypes without having to iterate a DeviceList. It is not meant for production applications.

Returns a device handle for the first device found matching vendor_id and product_id. On error, or if the device could not be found, it returns None.

Trait Implementations

impl Drop for Context
[src]

fn drop(&mut self)

Closes the libusb context.

impl Sync for Context
[src]

impl Send for Context
[src]