Expand description
This crate provides a safe wrapper around the native libusb library.
Re-exports§
pub use libusb1_sys as ffi;
Modules§
Structs§
- Config
Descriptor - Describes a configuration.
- Context
- A
libusbcontext. - Device
- A reference to a USB device.
- Device
Descriptor - Describes a device.
- Device
Handle - A handle to an open USB device.
- Device
List - A list of detected USB devices.
- Devices
- Iterator over detected USB devices.
- Endpoint
Descriptor - Describes an endpoint.
- Endpoint
Descriptors - Iterator over an interface’s endpoint descriptors.
- Global
Context - Hotplug
Builder - Builds hotplug Registration with custom configuration values.
- Interface
- A device interface.
- Interface
Descriptor - Describes an alternate setting for an interface.
- Interface
Descriptors - Iterator over an interface’s descriptors.
- Interfaces
- Iterator over a configuration’s interfaces.
- Language
- A language used to read string descriptors from USB devices.
- Library
Version - A structure that describes the version of the underlying
libusblibrary. - Registration
- UsbOption
- A
libusbruntime option that can be enabled for a context. - Version
- A three-part version consisting of major, minor, and sub minor components.
Enums§
- Direction
- Transfer and endpoint directions.
- Error
- Errors returned by the
libusblibrary. - LogCallback
Mode - LogLevel
- Library logging levels.
- Primary
Language - Primary language families.
- Recipient
- Recipients of control transfers.
- Request
Type - Types of control transfers.
- Speed
- Device speeds. Indicates the speed at which a device is operating.
- SubLanguage
- Language dialects and writing systems.
- Sync
Type - Isochronous synchronization mode.
- Transfer
Type - An endpoint’s transfer type.
- Usage
Type - Isochronous usage type.
Traits§
- Hotplug
- When handling a Hotplug::device_arrived event it is considered safe to call
any
rusbfunction that takes aDevice. It also safe to open a device and submit asynchronous transfers. However, most other functions that take aDeviceHandleare not safe to call. Examples of such functions are any of the synchronous API functions or the blocking functions that retrieve various USB descriptors. These functions must be used outside of the context of the Hotplug functions. - UsbContext
Functions§
- devices
- Returns a list of the current USB devices. Using global context
- disable_
device_ discovery - Disable device scanning in
libusbinit. - has_
capability - Tests whether the running
libusblibrary supports capability API. - has_
hid_ access - Tests whether the running
libusblibrary has HID access. - has_
hotplug - Tests whether the running
libusblibrary supports hotplug. - open_
device_ with_ vid_ pid - Convenience function to open a device by its vendor ID and product ID. Using global context
- request_
type - Builds a value for the
bmRequestTypefield of a control transfer setup packet. - set_
log_ level - Sets the log level of a
libusbglobal context. - supports_
detach_ kernel_ driver - Tests whether the running
libusblibrary supports detaching the kernel driver. - version
- Returns a structure with the version of the running libusb library.
Type Aliases§
- Result
- A result of a function that may return a
Error.