1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! WhatCable: USB / USB-C / USB Power Delivery diagnostics for Linux.
//!
//! This crate ships the [`whatcable`](https://crates.io/crates/whatcable) CLI
//! plus a library API. The library has three layers, each toggled by a Cargo
//! feature so consumers pull in only what they need:
//!
//! | Feature | Default | What it adds |
//! |---|---|---|
//! | (none) | always on | Pure data types ([`UsbDevice`], [`TypeCPort`], [`PowerDeliveryPort`], …), USB-PD VDO decoders ([`pd::decode_id_header`], [`pd::decode_cable_vdo`]), [`ChargingDiagnostic`], [`DeviceSummary`]. No IO. |
//! | `sysfs` | yes | [`Sysfs`] handle and [`DeviceManager`] — Linux `/sys` enumeration with an injectable root path. |
//! | `watch` | yes | libudev hotplug monitor: [`watch::Watcher`] + [`watch::run_loop`]. |
//! | `cli` | yes | The `whatcable` binary (clap + JSON / text rendering). |
//!
//! Library-only consumers can drop the binary deps:
//!
//! ```toml
//! [dependencies]
//! whatcable = { version = "0.3", default-features = false }
//! # for the sysfs backend without the bin / hotplug:
//! whatcable = { version = "0.3", default-features = false, features = ["sysfs"] }
//! ```
//!
//! # Example — decode a Cable VDO
//!
//! ```
//! use whatcable::pd::{decode_cable_vdo, CableSpeed, CableCurrent};
//!
//! let v = decode_cable_vdo(2 | (2 << 5) | (3 << 9), false);
//! assert_eq!(v.speed, CableSpeed::Usb32Gen2);
//! assert_eq!(v.current_rating, CableCurrent::FiveAmp);
//! assert_eq!(v.max_watts, 250);
//! ```
//!
//! # Example — enumerate `/sys`
//!
//! ```no_run
//! # #[cfg(feature = "sysfs")] {
//! use whatcable::DeviceManager;
//!
//! let mut mgr = DeviceManager::new();
//! mgr.refresh();
//! for s in mgr.devices() {
//! println!("{}: {}", s.headline, s.subtitle);
//! }
//! # }
//! ```
pub use CableInfo;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;