Skip to content

Commit 6a25547

Browse files
committed
--pdports: Hide CC if not connected
It's not meaningful if no cable/device is connected Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent b28d263 commit 6a25547

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

framework_lib/src/power.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ pub fn get_and_print_cypd_pd_info(ec: &CrosEc) {
812812
match result {
813813
Ok(info) => {
814814
let c_state = CypdTypeCState::from(info.c_state);
815+
let connected = !matches!(c_state, CypdTypeCState::Nothing);
815816
let power_role = CypdPdPowerRole::from(info.power_role);
816817
let data_role = CypdPdDataRole::from(info.data_role);
817818
let voltage = { info.voltage };
@@ -849,7 +850,18 @@ pub fn get_and_print_cypd_pd_info(ec: &CrosEc) {
849850
""
850851
}
851852
);
852-
println!(" CC Polarity: CC{}", info.cc_polarity + 1);
853+
if connected {
854+
println!(
855+
" CC Polarity: {}",
856+
match info.cc_polarity {
857+
0 => "CC1",
858+
1 => "CC2",
859+
2 => "CC1 (Debug)",
860+
3 => "CC2 (Debug)",
861+
_ => "Unknown",
862+
}
863+
);
864+
}
853865
println!(
854866
" Active Port: {}",
855867
if info.active_port != 0 { "Yes" } else { "No" }

0 commit comments

Comments
 (0)