Skip to content

Commit 0becfff

Browse files
committed
Add --wifisar
Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent fdd553b commit 0becfff

6 files changed

Lines changed: 428 additions & 0 deletions

File tree

EXAMPLES_ADVANCED.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,3 +470,47 @@ r12: sp :00000000 lr : pc :
470470
471471
cfsr = 0, shcsr = 0, hfsr = 0, dfsr = 0
472472
```
473+
474+
475+
## WiFi SAR
476+
477+
```
478+
> framework_tool --wifisar
479+
WRDS - Wi-Fi SAR limits
480+
Revision: 2 (4 chains, 11 sub-bands)
481+
Mode: 0x00000001 (SAR enabled)
482+
Profile 1
483+
Subband Range (MHz) ChainA ChainB
484+
2.4G 2400 0x80 16.0 dBm 0x80 16.0 dBm
485+
5G2/3 5180-5320 0x70 14.0 dBm 0x70 14.0 dBm
486+
5G4 5340-5480 0x70 14.0 dBm 0x70 14.0 dBm
487+
5G6 5500-5720 0x74 14.5 dBm 0x74 14.5 dBm
488+
5G8/9 5745-5885 0x6C 13.5 dBm 0x6C 13.5 dBm
489+
6G1 5955-6175 0x6C 13.5 dBm 0x6C 13.5 dBm
490+
6G3 6195-6415 0x6C 13.5 dBm 0x6C 13.5 dBm
491+
6G5 6435-6515 0x6C 13.5 dBm 0x6C 13.5 dBm
492+
6G6 6535-6695 0x6C 13.5 dBm 0x6C 13.5 dBm
493+
6G8 6715-6855 0x6C 13.5 dBm 0x6C 13.5 dBm
494+
7G0 6875-7115 0x6C 13.5 dBm 0x6C 13.5 dBm
495+
All zero: CdbChainA, CdbChainB
496+
EWRD - Additional Wi-Fi SAR limits
497+
Revision: 2 (4 chains, 11 sub-bands)
498+
Mode: 0x00000001 (SAR enabled)
499+
Profiles in use: 1
500+
Profile 2
501+
Subband Range (MHz) ChainA ChainB
502+
2.4G 2400 0xA8 21.0 dBm 0xA8 21.0 dBm
503+
5G2/3 5180-5320 0xA8 21.0 dBm 0xA8 21.0 dBm
504+
5G4 5340-5480 0xA8 21.0 dBm 0xA8 21.0 dBm
505+
5G6 5500-5720 0xAC 21.5 dBm 0xAC 21.5 dBm
506+
5G8/9 5745-5885 0xAC 21.5 dBm 0xAC 21.5 dBm
507+
6G1 5955-6175 0xAC 21.5 dBm 0xAC 21.5 dBm
508+
6G3 6195-6415 0xAC 21.5 dBm 0xAC 21.5 dBm
509+
6G5 6435-6515 0xA8 21.0 dBm 0xA8 21.0 dBm
510+
6G6 6535-6695 0xA8 21.0 dBm 0xA8 21.0 dBm
511+
6G8 6715-6855 0xA8 21.0 dBm 0xA8 21.0 dBm
512+
7G0 6875-7115 0x70 14.0 dBm 0x70 14.0 dBm
513+
All zero: CdbChainA, CdbChainB
514+
Profile 3 (unused): All zero
515+
Profile 4 (unused): All zero
516+
```

framework_lib/src/commandline/clap_std.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ struct ClapCli {
325325
#[arg(long)]
326326
panicinfo: bool,
327327

328+
/// Show Wi-Fi SAR power limits from UEFI variables (WRDS, EWRD)
329+
#[arg(long)]
330+
wifisar: bool,
331+
328332
/// Hash a file of arbitrary data
329333
#[arg(long)]
330334
hash: Option<std::path::PathBuf>,
@@ -719,6 +723,7 @@ pub fn parse(args: &[String]) -> Cli {
719723
switches: args.switches,
720724
port80read: args.port80read,
721725
panicinfo: args.panicinfo,
726+
wifisar: args.wifisar,
722727
hash: args.hash.map(|x| x.into_os_string().into_string().unwrap()),
723728
driver: args.driver,
724729
pd_addrs,

framework_lib/src/commandline/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ use crate::touchscreen;
7171
#[cfg(feature = "rusb")]
7272
use crate::usbhub::check_usbhub_version;
7373
use crate::util::{self, Config, Platform, PlatformFamily};
74+
use crate::wifi_sar;
7475
use dmidecode::Structure;
7576
#[cfg(feature = "hidapi")]
7677
use hidapi::HidApi;
@@ -256,6 +257,7 @@ pub struct Cli {
256257
pub switches: bool,
257258
pub port80read: bool,
258259
pub panicinfo: bool,
260+
pub wifisar: bool,
259261
pub hash: Option<String>,
260262
pub pd_addrs: Option<(u16, u16, u16)>,
261263
pub pd_ports: Option<(u8, u8, u8)>,
@@ -355,6 +357,7 @@ pub fn parse(args: &[String]) -> Cli {
355357
switches: cli.switches,
356358
port80read: cli.port80read,
357359
panicinfo: cli.panicinfo,
360+
wifisar: cli.wifisar,
358361
hash: cli.hash,
359362
pd_addrs: cli.pd_addrs,
360363
pd_ports: cli.pd_ports,
@@ -1660,6 +1663,11 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
16601663
return 1;
16611664
}
16621665
}
1666+
} else if args.wifisar {
1667+
if wifi_sar::print_wifi_sar().is_none() {
1668+
println!("Failed to read Wi-Fi SAR limits");
1669+
return 1;
1670+
}
16631671
} else if args.test {
16641672
println!("Self-Test");
16651673
let result = selftest(&ec);
@@ -2086,6 +2094,7 @@ Options:
20862094
--switches Show current EC switch positions (lid, power button, ...)
20872095
--port80read Show history of port 80 writes (POST codes)
20882096
--panicinfo Show saved EC panic info
2097+
--wifisar Show Wi-Fi SAR power limits from UEFI variables (WRDS, EWRD)
20892098
--intrusion Show status of intrusion switch
20902099
--inputdeck Show status of the input deck
20912100
--inputdeck-mode Set input deck power mode [possible values: auto, off, on] (Laptop 12, 13, 16)

framework_lib/src/commandline/uefi.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ pub fn parse(args: &[String]) -> Cli {
9999
switches: false,
100100
port80read: false,
101101
panicinfo: false,
102+
wifisar: false,
102103
hash: None,
103104
// This is the only driver that works on UEFI
104105
driver: Some(CrosEcDriverType::Portio),
@@ -593,6 +594,9 @@ pub fn parse(args: &[String]) -> Cli {
593594
} else if arg == "--panicinfo" {
594595
cli.panicinfo = true;
595596
found_an_option = true;
597+
} else if arg == "--wifisar" {
598+
cli.wifisar = true;
599+
found_an_option = true;
596600
} else if arg == "-t" || arg == "--test" {
597601
cli.test = true;
598602
found_an_option = true;

framework_lib/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ pub mod power;
6565
pub mod smart_battery;
6666
pub mod smbios;
6767
mod util;
68+
pub mod wifi_sar;
6869

6970
pub mod built_info {
7071
// The file has been placed there by the build script.

0 commit comments

Comments
 (0)