@@ -33,7 +33,7 @@ use crate::capsule_content::{
33
33
use crate :: ccgx:: device:: { FwMode , PdController , PdPort } ;
34
34
#[ cfg( feature = "hidapi" ) ]
35
35
use crate :: ccgx:: hid:: { check_ccg_fw_version, find_devices, DP_CARD_PID , HDMI_CARD_PID } ;
36
- use crate :: ccgx:: { self , MainPdVersions , SiliconId :: * } ;
36
+ use crate :: ccgx:: { self , MainPdVersions , PdVersions , SiliconId :: * } ;
37
37
use crate :: chromium_ec;
38
38
use crate :: chromium_ec:: commands:: DeckStateMode ;
39
39
use crate :: chromium_ec:: commands:: FpLedBrightnessLevel ;
@@ -398,11 +398,8 @@ fn print_versions(ec: &CrosEc) {
398
398
}
399
399
400
400
println ! ( "PD Controllers" ) ;
401
-
402
- if let Ok ( pd_versions) = ccgx:: get_pd_controller_versions ( ec) {
403
- let right = & pd_versions. controller01 ;
404
- let left = & pd_versions. controller23 ;
405
- // let active_mode =
401
+ let ccgx_pd_vers = ccgx:: get_pd_controller_versions ( ec) ;
402
+ if let Ok ( PdVersions :: RightLeft ( ( right, left) ) ) = ccgx_pd_vers {
406
403
if let Some ( Platform :: IntelGen11 ) = smbios:: get_platform ( ) {
407
404
if right. main_fw . base != right. backup_fw . base {
408
405
println ! ( " Right (01)" ) ;
@@ -476,8 +473,24 @@ fn print_versions(ec: &CrosEc) {
476
473
left. main_fw. app, left. active_fw
477
474
) ;
478
475
}
476
+ } else if let Ok ( PdVersions :: Single ( pd) ) = ccgx_pd_vers {
477
+ if pd. main_fw . app != pd. backup_fw . app {
478
+ println ! (
479
+ " Main: {}{}" ,
480
+ pd. main_fw. app,
481
+ active_mode( & pd. active_fw, FwMode :: MainFw )
482
+ ) ;
483
+ println ! (
484
+ " Backup: {}{}" ,
485
+ pd. backup_fw. app,
486
+ active_mode( & pd. active_fw, FwMode :: BackupFw )
487
+ ) ;
488
+ } else {
489
+ println ! ( " Version: {} ({:?})" , pd. main_fw. app, pd. active_fw) ;
490
+ }
479
491
} else if let Ok ( pd_versions) = power:: read_pd_version ( ec) {
480
492
// As fallback try to get it from the EC. But not all EC versions have this command
493
+ debug ! ( " Fallback to PD Host command" ) ;
481
494
match pd_versions {
482
495
MainPdVersions :: RightLeft ( ( controller01, controller23) ) => {
483
496
if let Some ( Platform :: IntelGen11 ) = smbios:: get_platform ( ) {
@@ -655,8 +668,8 @@ fn compare_version(device: Option<HardwareDeviceType>, version: String, ec: &Cro
655
668
}
656
669
}
657
670
Some ( HardwareDeviceType :: PD0 ) => {
658
- if let Ok ( pd_versions ) = ccgx:: get_pd_controller_versions ( ec) {
659
- let ver = pd_versions . controller01 . active_fw_ver ( ) ;
671
+ if let Ok ( PdVersions :: RightLeft ( ( pd01 , _pd23 ) ) ) = ccgx:: get_pd_controller_versions ( ec) {
672
+ let ver = pd01 . active_fw_ver ( ) ;
660
673
println ! ( "Comparing PD0 version {:?}" , ver) ;
661
674
662
675
if ver. contains ( & version) {
@@ -667,8 +680,8 @@ fn compare_version(device: Option<HardwareDeviceType>, version: String, ec: &Cro
667
680
}
668
681
}
669
682
Some ( HardwareDeviceType :: PD1 ) => {
670
- if let Ok ( pd_versions ) = ccgx:: get_pd_controller_versions ( ec) {
671
- let ver = pd_versions . controller23 . active_fw_ver ( ) ;
683
+ if let Ok ( PdVersions :: RightLeft ( ( _pd01 , pd23 ) ) ) = ccgx:: get_pd_controller_versions ( ec) {
684
+ let ver = pd23 . active_fw_ver ( ) ;
672
685
println ! ( "Comparing PD1 version {:?}" , ver) ;
673
686
674
687
if ver. contains ( & version) {
0 commit comments