Skip to content

Commit 6fddfd8

Browse files
committed
--boardid: Print all available board IDs
Using a native host command to get the ID from the EC instead of having the sotware measure ADC and evaluate the host command. This is better because the ADC values represent different board IDs on different platforms (Microchip vs Nuvoton based ECs) > sudo framework_tool --boardid Board IDs Mainboard: Ok(Some(6)) PowerButton: Err(Response(InvalidResponse)) Touchpad: Ok(Some(7)) AudioBoard: Ok(Some(7)) dGPU0: Err(Response(InvalidCommand)) dGPU1: Err(Response(InvalidCommand)) ``` Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent be57edb commit 6fddfd8

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed

EXAMPLES.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,26 @@ Positions:
380380
Pos 4: GenericC
381381
```
382382

383+
### Checking board ID
384+
385+
Most inputdeck checking is implemented by Board ID. To read those directly for
386+
debugging low level issues, use the `--boardid` command.
387+
This host command was added recently is not available on every system yet.
388+
389+
```
390+
# Example on Framework Laptop 13
391+
# Touchpad Board ID is only present on Laptop 12
392+
# dGPU Board IDs are only present on Laptop 16
393+
> framework_tool --boardid
394+
Board IDs
395+
Mainboard: Ok(Some(6))
396+
PowerButton: Err(Response(InvalidResponse))
397+
Touchpad: Ok(Some(7))
398+
AudioBoard: Ok(Some(7))
399+
dGPU0: Err(Response(InvalidCommand))
400+
dGPU1: Err(Response(InvalidCommand))
401+
```
402+
383403
## Check temperatures and fan speed
384404

385405
```

framework_lib/src/commandline/clap_std.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ struct ClapCli {
273273
#[arg(long)]
274274
test_retimer: bool,
275275

276+
/// Print all board IDs
277+
#[arg(long)]
278+
boardid: bool,
279+
276280
/// Force execution of an unsafe command - may render your hardware unbootable!
277281
#[arg(long, short)]
278282
force: bool,
@@ -472,6 +476,7 @@ pub fn parse(args: &[String]) -> Cli {
472476
pd_ports,
473477
test: args.test,
474478
test_retimer: args.test_retimer,
479+
boardid: args.boardid,
475480
dry_run: args.dry_run,
476481
force: args.force,
477482
// TODO: Set help. Not very important because Clap handles this by itself

framework_lib/src/commandline/mod.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ use crate::ccgx::device::{FwMode, PdController, PdPort};
3535
use crate::ccgx::hid::{check_ccg_fw_version, find_devices, DP_CARD_PID, HDMI_CARD_PID};
3636
use crate::ccgx::{self, MainPdVersions, PdVersions, SiliconId::*};
3737
use crate::chromium_ec;
38+
use crate::chromium_ec::commands::BoardIdType;
3839
use crate::chromium_ec::commands::DeckStateMode;
3940
use crate::chromium_ec::commands::FpLedBrightnessLevel;
4041
use crate::chromium_ec::commands::RebootEcCmd;
@@ -192,6 +193,7 @@ pub struct Cli {
192193
pub driver: Option<CrosEcDriverType>,
193194
pub test: bool,
194195
pub test_retimer: bool,
196+
pub boardid: bool,
195197
pub dry_run: bool,
196198
pub force: bool,
197199
pub intrusion: bool,
@@ -279,6 +281,7 @@ pub fn parse(args: &[String]) -> Cli {
279281
driver: cli.driver,
280282
test: cli.test,
281283
test_retimer: cli.test_retimer,
284+
boardid: cli.boardid,
282285
dry_run: cli.dry_run,
283286
// force
284287
intrusion: cli.intrusion,
@@ -1487,6 +1490,8 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
14871490
if let Err(err) = selftest_retimer(&ec) {
14881491
println!(" Failed: {:?}", err);
14891492
}
1493+
} else if args.boardid {
1494+
print_board_ids(&ec);
14901495
} else if args.power {
14911496
return power::get_and_print_power_info(&ec);
14921497
} else if args.thermal {
@@ -1850,6 +1855,34 @@ fn hash(data: &[u8]) {
18501855
util::print_buffer(sha512);
18511856
}
18521857

1858+
fn print_board_ids(ec: &CrosEc) {
1859+
println!("Board IDs");
1860+
println!(
1861+
" Mainboard: {:?}",
1862+
ec.read_board_id_hc(BoardIdType::Mainboard)
1863+
);
1864+
println!(
1865+
" PowerButton: {:?}",
1866+
ec.read_board_id_hc(BoardIdType::PowerButtonBoard)
1867+
);
1868+
println!(
1869+
" Touchpad: {:?}",
1870+
ec.read_board_id_hc(BoardIdType::Touchpad)
1871+
);
1872+
println!(
1873+
" AudioBoard: {:?}",
1874+
ec.read_board_id_hc(BoardIdType::AudioBoard)
1875+
);
1876+
println!(
1877+
" dGPU0: {:?}",
1878+
ec.read_board_id_hc(BoardIdType::DGpu0)
1879+
);
1880+
println!(
1881+
" dGPU1: {:?}",
1882+
ec.read_board_id_hc(BoardIdType::DGpu1)
1883+
);
1884+
}
1885+
18531886
fn selftest(ec: &CrosEc) -> Option<()> {
18541887
if let Some(platform) = smbios::get_platform() {
18551888
println!(" SMBIOS Platform: {:?}", platform);

framework_lib/src/commandline/uefi.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ pub fn parse(args: &[String]) -> Cli {
8787
pd_ports: None,
8888
test: false,
8989
test_retimer: false,
90+
boardid: false,
9091
dry_run: false,
9192
force: false,
9293
help: false,
@@ -511,6 +512,9 @@ pub fn parse(args: &[String]) -> Cli {
511512
} else if arg == "-t" || arg == "--test-retimer" {
512513
cli.test_retimer = true;
513514
found_an_option = true;
515+
} else if arg == "--boardid" {
516+
cli.boardid = true;
517+
found_an_option = true;
514518
} else if arg == "-f" || arg == "--force" {
515519
cli.force = true;
516520
found_an_option = true;

0 commit comments

Comments
 (0)