Expand description
Uses rusb (upto date libusb fork) to get system USB information, most of which has parity with lsusb. Requires ‘libusb’ feature. Uses crate::system_profiler
types to hold data so that it is cross-compatible with macOS system_profiler command.
lsusb uses udev for tree building, which libusb does not have access to and is Linux only. udev-rs is used on Linux to attempt to mirror the output of lsusb on Linux. On other platforms, certain information like driver used cannot be obtained.
Get system_profiler::SPUSBDataType
struct of system USB buses and devices with extra data like configs, interfaces and endpoints
use cyme::lsusb::profiler;
let spusb = profiler::get_spusb_with_extra(true).unwrap();
// print with alternative styling (#) is using utf-8 icons
println!("{:#}", spusb);
See system_profiler
docs for what can be done with returned data, such as system_profiler::USBFilter
Functions
- Builds a
system_profiler::USBDevice
from alibusb::Device
by usingdevice_descriptor()
and intrograting for configuration strings. Optionally withwith_extra
will gather full device information, including from udev if feature is present. - Fills a passed mutable
spusb
reference to fill usingget_spusb
. Will replace existingsystem_profiler::USBDevice
s found in the libusb build but leave others and the buses. - Get
system_profiler::SPUSBDataType
usinglibusb
. Does not sourceusb::USBDeviceExtra
- useget_spusb_with_extra
for that; the extra operation is mostly moving data around so the only hit is to stack. - Get
system_profiler::SPUSBDataType
usinglibusb
includingusb::USBDeviceExtra
- the main function to use for most use cases unless one does not want verbose data. - Set log level for rusb