Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 33 additions & 12 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ UEFI BIOS
Version: 03.00
Release Date: 03/10/2025
EC Firmware
Build version: "lilac-3.0.0-1541dc6 2025-05-05 11:31:24 zoid@localhost"
RO Version: "lilac-3.0.0-1541dc6"
RW Version: "lilac-3.0.0-1541dc6"
Build version: lilac-3.0.0-1541dc6 2025-05-05 11:31:24 zoid@localhost
Current image: RO
PD Controllers
Right (01)
Main: 0.0.0E (Active)
Backup: 0.0.0E
Left (23)
Main: 0.0.0E (Active)
Backup: 0.0.0E
Right (01): 0.0.0E (MainFw)
Left (23): 0.0.0E (MainFw)
[...]
```

Expand Down Expand Up @@ -56,8 +50,7 @@ Laptop Webcam Module (2nd Gen)
[...]
Touchscreen
Firmware Version: v7.0.0.5.0.0.0.0
USI Protocol: false
MPP Protocol: true
Protocols: USI
```

### Stylus (Framework 12)
Expand All @@ -79,7 +72,6 @@ Stylus
> framework_tool --versions
[...]
Touchpad
IC Type: 0239
Firmware Version: v0E07
```

Expand Down Expand Up @@ -114,6 +106,35 @@ LED Matrix
[...]
```

### DisplayPort or HDMI Expansion Card

```
> framework_tool --dp-hdmi-info
DisplayPort Expansion Card
Serial Number: 11AD1D0030123F17142C0B00
Active Firmware: 101 (3.0.11.065)
Inactive Firmware: 008 (3.0.11.008)
Operating Mode: MainFw (#2)

# Or
> framework_tool --versions
[...]
DisplayPort Expansion Card
Active Firmware: 101 (3.0.11.065)
Inactive Firmware: 008 (3.0.11.008)
Operating Mode: MainFw (#2)
```

### CSME Version (Linux on Intel systems)

```
> framework_tool --versions
[...]
CSME
Firmware Version: 0:16.1.32.2473
[...]
```

## Check input deck status

### On Framework 12
Expand Down
56 changes: 33 additions & 23 deletions framework_lib/src/ccgx/hid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ fn get_fw_info(device: &HidDevice) -> HidFirmwareInfo {
decode_fw_info(&buf)
}

pub fn check_ccg_fw_version(device: &HidDevice) {
pub fn check_ccg_fw_version(device: &HidDevice, verbose: bool) {
magic_unlock(device);
let info = get_fw_info(device);
print_fw_info(&info);
print_fw_info(&info, verbose);
}

fn decode_fw_info(buf: &[u8]) -> HidFirmwareInfo {
Expand All @@ -152,13 +152,13 @@ fn decode_fw_info(buf: &[u8]) -> HidFirmwareInfo {
info
}

fn print_fw_info(info: &HidFirmwareInfo) {
fn print_fw_info(info: &HidFirmwareInfo, verbose: bool) {
assert_eq!(info.report_id, ReportIdCmd::E0Read as u8);

info!(" Signature: {:X?}", info.signature);
// Something's totally off if the signature is invalid
if info.signature != [b'C', b'Y'] {
println!("Firmware Signature is invalid.");
error!("Firmware Signature is invalid.");
return;
}

Expand Down Expand Up @@ -219,23 +219,33 @@ fn print_fw_info(info: &HidFirmwareInfo) {
FwMode::BackupFw => (base_version_1, image_1_valid, base_version_2, image_2_valid),
};

println!(
" Active Firmware: {:03} ({}){}",
active_ver.build_number,
active_ver,
if active_valid { "" } else { " - INVALID!" }
);
println!(
" Inactive Firmware: {:03} ({}){}",
inactive_ver.build_number,
inactive_ver,
if inactive_valid { "" } else { " - INVALID!" }
);
println!(
" Operating Mode: {:?} (#{})",
FwMode::try_from(info.operating_mode).unwrap(),
info.operating_mode
);
if verbose || active_ver != inactive_ver {
println!(
" Active Firmware: {:03} ({}){}",
active_ver.build_number,
active_ver,
if active_valid { "" } else { " - INVALID!" }
);
println!(
" Inactive Firmware: {:03} ({}){}",
inactive_ver.build_number,
inactive_ver,
if inactive_valid { "" } else { " - INVALID!" }
);
println!(
" Operating Mode: {:?} (#{})",
FwMode::try_from(info.operating_mode).unwrap(),
info.operating_mode
);
} else {
println!(
" Active Firmware: {:03} ({}, {:?}){}",
active_ver.build_number,
active_ver,
FwMode::try_from(info.operating_mode).unwrap(),
if active_valid { "" } else { " - INVALID!" }
);
}
}

/// Turn CCG3 Expansion Card VID/PID into their name
Expand Down Expand Up @@ -332,7 +342,7 @@ pub fn flash_firmware(fw_binary: &[u8]) {
magic_unlock(&device);
let info = get_fw_info(&device);
println!("Before Updating");
print_fw_info(&info);
print_fw_info(&info, true);

println!("Updating...");
match info.operating_mode {
Expand Down Expand Up @@ -369,7 +379,7 @@ pub fn flash_firmware(fw_binary: &[u8]) {
wait_to_reappear(&mut api, &filter_devs, sn).expect("Device did not reappear");

println!("After Updating");
print_fw_info(&info);
print_fw_info(&info, true);
}
}

Expand Down
105 changes: 68 additions & 37 deletions framework_lib/src/commandline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ fn print_audio_card_details() {
}

#[cfg(feature = "hidapi")]
fn print_dp_hdmi_details() {
fn print_dp_hdmi_details(verbose: bool) {
match HidApi::new() {
Ok(api) => {
for dev_info in find_devices(&api, &[HDMI_CARD_PID, DP_CARD_PID], None) {
Expand All @@ -264,11 +264,11 @@ fn print_dp_hdmi_details() {
dev_info.product_string().unwrap_or(NOT_SET)
);

println!(
debug!(
" Serial Number: {}",
dev_info.serial_number().unwrap_or(NOT_SET)
);
check_ccg_fw_version(&device);
check_ccg_fw_version(&device, verbose);
}
}
Err(e) => {
Expand Down Expand Up @@ -373,11 +373,13 @@ fn print_versions(ec: &CrosEc) {

println!("EC Firmware");
let ver = print_err(ec.version_info()).unwrap_or_else(|| "UNKNOWN".to_string());
println!(" Build version: {:?}", ver);
println!(" Build version: {}", ver);

if let Some((ro, rw, curr)) = ec.flash_version() {
println!(" RO Version: {:?}", ro);
println!(" RW Version: {:?}", rw);
if ro != rw || log_enabled!(Level::Info) {
println!(" RO Version: {}", ro);
println!(" RW Version: {}", rw);
}
print!(" Current image: ");
if curr == chromium_ec::EcCurrentImage::RO {
println!("RO");
Expand All @@ -397,53 +399,78 @@ fn print_versions(ec: &CrosEc) {
if let Ok(pd_versions) = ccgx::get_pd_controller_versions(ec) {
let right = &pd_versions.controller01;
let left = &pd_versions.controller23;
println!(" Right (01)");
// let active_mode =
if let Some(Platform::IntelGen11) = smbios::get_platform() {
if right.main_fw.base != right.backup_fw.base {
println!(" Right (01)");
println!(
" Main: {}{}",
right.main_fw.base,
active_mode(&right.active_fw, FwMode::MainFw)
);
println!(
" Backup: {}{}",
right.backup_fw.base,
active_mode(&right.active_fw, FwMode::BackupFw)
);
} else {
println!(
" Right (01): {} ({:?})",
right.main_fw.base, right.active_fw
);
}
} else if right.main_fw.app != right.backup_fw.app {
println!(
" Main: {}{}",
right.main_fw.base,
" Main: {}{}",
right.main_fw.app,
active_mode(&right.active_fw, FwMode::MainFw)
);
println!(
" Backup: {}{}",
right.backup_fw.base,
" Backup: {}{}",
right.backup_fw.app,
active_mode(&right.active_fw, FwMode::BackupFw)
);
} else {
println!(
" Main: {}{}",
right.main_fw.app,
active_mode(&right.active_fw, FwMode::MainFw)
);
println!(
" Backup: {}{}",
right.backup_fw.app,
active_mode(&right.active_fw, FwMode::BackupFw)
" Right (01): {} ({:?})",
right.main_fw.app, right.active_fw
);
}
println!(" Left (23)");
if let Some(Platform::IntelGen11) = smbios::get_platform() {
if left.main_fw.base != left.backup_fw.base {
println!(" Left (23)");
println!(
" Main: {}{}",
left.main_fw.base,
active_mode(&left.active_fw, FwMode::MainFw)
);
println!(
" Backup: {}{}",
left.backup_fw.base,
active_mode(&left.active_fw, FwMode::BackupFw)
);
} else {
println!(
" Left (23): {} ({:?})",
left.main_fw.base, left.active_fw
);
}
} else if left.main_fw.app != left.backup_fw.app {
println!(" Left (23)");
println!(
" Main: {}{}",
left.main_fw.base,
" Main: {}{}",
left.main_fw.app,
active_mode(&left.active_fw, FwMode::MainFw)
);
println!(
" Backup: {}{}",
left.backup_fw.base,
" Backup: {}{}",
left.backup_fw.app,
active_mode(&left.active_fw, FwMode::BackupFw)
);
} else {
println!(
" Main: {}{}",
left.main_fw.app,
active_mode(&left.active_fw, FwMode::MainFw)
);
println!(
" Backup: {}{}",
left.backup_fw.app,
active_mode(&left.active_fw, FwMode::BackupFw)
" Left (23): {} ({:?})",
left.main_fw.app, left.active_fw
);
}
} else if let Ok(pd_versions) = power::read_pd_version(ec) {
Expand Down Expand Up @@ -500,10 +527,12 @@ fn print_versions(ec: &CrosEc) {
{
println!("CSME");
if let Ok(csme) = csme::csme_from_sysfs() {
println!(" Enabled: {}", csme.enabled);
println!(" Version: {}", csme.main_ver);
println!(" Recovery Ver: {}", csme.recovery_ver);
println!(" Original Ver: {}", csme.fitc_ver);
info!(" Enabled: {}", csme.enabled);
println!(" Firmware Version: {}", csme.main_ver);
if csme.main_ver != csme.recovery_ver || csme.main_ver != csme.fitc_ver {
println!(" Recovery Ver: {}", csme.recovery_ver);
println!(" Original Ver: {}", csme.fitc_ver);
}
} else {
println!(" Unknown");
}
Expand All @@ -521,6 +550,8 @@ fn print_versions(ec: &CrosEc) {
if let Some(Platform::Framework12IntelGen13) = smbios::get_platform() {
let _ignore_err = touchscreen::print_fw_ver();
}
#[cfg(feature = "hidapi")]
print_dp_hdmi_details(false);
}

fn print_esrt() {
Expand Down Expand Up @@ -913,7 +944,7 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
print_pd_details(&ec);
} else if args.dp_hdmi_info {
#[cfg(feature = "hidapi")]
print_dp_hdmi_details();
print_dp_hdmi_details(true);
} else if let Some(pd_bin_path) = &args.dp_hdmi_update {
#[cfg(feature = "hidapi")]
flash_dp_hdmi_card(pd_bin_path);
Expand Down
2 changes: 1 addition & 1 deletion framework_lib/src/touchpad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub fn print_touchpad_fw_ver() -> Result<(), HidError> {
let device = dev_info.open_device(&api).unwrap();

println!("Touchpad");
println!(" IC Type: {:04X}", pid);
info!(" IC Type: {:04X}", pid);

let ver = match pid {
0x0239 => format!("{:04X}", read_239_ver(&device)?),
Expand Down
10 changes: 8 additions & 2 deletions framework_lib/src/touchscreen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,14 @@ pub trait TouchScreen {
println!(" Firmware Version: v{}", ver);

let res = self.send_message(0x20, 16, vec![0])?;
println!(" USI Protocol: {:?}", (res[15] & USI_BITMAP) > 0);
println!(" MPP Protocol: {:?}", (res[15] & MPP_BITMAP) > 0);
let mut protocols = vec![];
if (res[15] & USI_BITMAP) > 0 {
protocols.push("USI");
}
if (res[15] & MPP_BITMAP) > 0 {
protocols.push("MPP");
}
println!(" Protocols: {}", protocols.join(", "));

Some(())
}
Expand Down
Loading