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

Functions