Crate cyme

Source
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::USBBuss, which contain system_profiler::USBDevices as a USB tree.

Modules§

colour
Colouring of cyme output
config
Config for cyme binary
display
Provides the main utilities to display USB types within this crate - primarily used by cyme binary.
error
Error type used within crate with From for commonly used crate errors
icon
Icons and themeing of cyme output
lsusb
Originally based on libusb list_devices.rs example, attempts to mimic lsusb output and provide cross-platform crate::system_profiler::SPUSBDataType getter
system_profiler
Parser for macOS system_profiler command -json output with SPUSBDataType.
types
Types used in crate non-specific to a module
udev
Utilities to get device information using udev - only supported on Linux. Requires ‘udev’ feature.
usb
Defines for USB, mainly thosed covered at usb.org

Functions§

set_log_level
Set cyme module and binary log level