Expand description
List system USB buses and devices; a modern lsusb
that attempts to maintain compatibility with, but also add new features.
Includes a macOS system_profiler
parser module and lsusb
for non-macOS systems/gathering more verbose information.
Examples
To get all the USB devices on cross-platform systems using libusb:
ⓘ
use cyme::lsusb::profiler;
let sp_usb = profiler::get_spusb(false).unwrap();
It’s often useful to then flatten this into a list of devices (system_profiler::USBDevice
):
ⓘ
// flatten since we don't care tree/buses
let devices = sp_usb.flatten_devices();
for device in devices {
format!("{}");
}
One can then print with the cyme display module:
ⓘ
use cyme::display;
// print with default [`display::PrintSettings`]
display::print_flattened_devices(&devices, &display::PrintSettings::default());
The system_profiler::SPUSBDataType
struct contains system system_profiler::USBBus
s, which contain system_profiler::USBDevice
s as a USB tree.
Modules
- Colouring of cyme output
- Config for cyme binary
- Provides the main utilities to display USB types within this crate - primarily used by
cyme
binary. - Error type used within crate with From for commonly used crate errors
- Icons and themeing of cyme output
- Originally based on libusb list_devices.rs example, attempts to mimic lsusb output and provide cross-platform
crate::system_profiler::SPUSBDataType
getter - Parser for macOS
system_profiler
command -json output with SPUSBDataType. - Types used in crate non-specific to a module
- Defines for USB, mainly thosed covered at usb.org
Functions
- Set cyme module and binary log level