Skip to content

windows: Add option to dump versions of all drivers #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
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
1,126 changes: 758 additions & 368 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ see the [Support Matrices](support-matrices.md).
- [x] HDMI Expansion Card (`--dp-hdmi-update`)
- [x] DisplayPort Expansion Card (`--dp-hdmi-update`)
- [ ] Audio Expansion Card
- [x] Get driver version for all devices (Windows only) (`--drivers`)

###### System Status

Expand Down Expand Up @@ -196,6 +197,7 @@ Options:
Enable/disable touchscreen [possible values: true, false]
--console <CONSOLE> Get EC console, choose whether recent or to follow the output [possible values: recent, follow]
--reboot-ec <REBOOT_EC> Control EC RO/RW jump [possible values: reboot, jump-ro, jump-rw, cancel-jump, disable-jump]
--drivers Display Windows Driver versions
--hash <HASH> Hash a file of arbitrary data
--driver <DRIVER> Select which driver is used. By default portio is used [possible values: portio, cros-ec, windows]
--pd-addrs <PD_ADDRS> <PD_ADDRS>
Expand Down
5 changes: 5 additions & 0 deletions framework_lib/src/commandline/clap_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ struct ClapCli {
#[arg(long)]
ec_hib_delay: Option<Option<u32>>,

/// Display Windows Driver versions
#[arg(long)]
drivers: bool,

/// Hash a file of arbitrary data
#[arg(long)]
hash: Option<std::path::PathBuf>,
Expand Down Expand Up @@ -404,6 +408,7 @@ pub fn parse(args: &[String]) -> Cli {
console: args.console,
reboot_ec: args.reboot_ec,
ec_hib_delay: args.ec_hib_delay,
drivers: args.drivers,
hash: args.hash.map(|x| x.into_os_string().into_string().unwrap()),
driver: args.driver,
pd_addrs,
Expand Down
9 changes: 9 additions & 0 deletions framework_lib/src/commandline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ use crate::touchscreen;
use crate::uefi::enable_page_break;
use crate::util;
use crate::util::{Config, Platform, PlatformFamily};
#[cfg(target_os = "windows")]
use crate::wmi;

#[cfg(feature = "hidapi")]
use hidapi::HidApi;
use sha2::{Digest, Sha256, Sha384, Sha512};
Expand Down Expand Up @@ -189,6 +192,7 @@ pub struct Cli {
pub reboot_ec: Option<RebootEcArg>,
pub ec_hib_delay: Option<Option<u32>>,
pub hash: Option<String>,
pub drivers: bool,
pub pd_addrs: Option<(u16, u16)>,
pub pd_ports: Option<(u8, u8)>,
pub has_mec: Option<bool>,
Expand Down Expand Up @@ -1038,6 +1042,11 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
flash_ec(&ec, ec_bin_path, EcFlashType::Ro);
} else if let Some(ec_bin_path) = &args.flash_rw_ec {
flash_ec(&ec, ec_bin_path, EcFlashType::Rw);
} else if args.drivers {
#[cfg(target_os = "windows")]
wmi::print_drivers();
#[cfg(not(target_os = "windows"))]
println!("Driver Version only supported on Windows");
} else if let Some(hash_file) = &args.hash {
println!("Hashing file: {}", hash_file);
#[cfg(feature = "uefi")]
Expand Down
1 change: 1 addition & 0 deletions framework_lib/src/commandline/uefi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ pub fn parse(args: &[String]) -> Cli {
console: None,
reboot_ec: None,
ec_hib_delay: None,
drivers: false,
hash: None,
// This is the only driver that works on UEFI
driver: Some(CrosEcDriverType::Portio),
Expand Down
2 changes: 2 additions & 0 deletions framework_lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ pub mod smbios;
#[cfg(feature = "uefi")]
pub mod uefi;
mod util;
#[cfg(target_os = "windows")]
pub mod wmi;

pub mod built_info {
// The file has been placed there by the build script.
Expand Down
343 changes: 343 additions & 0 deletions framework_lib/src/wmi.rs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions framework_tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ default-features = false
[build-dependencies]
# Note: Only takes effect in release builds
static_vcruntime = "2.0"
winresource = "0.1.17"
15 changes: 14 additions & 1 deletion framework_tool/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
fn main() {
use {
std::{env, io},
winresource::WindowsResource,
};

fn main() -> io::Result<()> {
if env::var_os("CARGO_CFG_WINDOWS").is_some() {
WindowsResource::new()
.set_icon("..\\res\\framework_startmenuicon.ico")
.compile()?;
}

static_vcruntime::metabuild();

Ok(())
}
Binary file added res/framework_startmenuicon.ico
Binary file not shown.