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
17 changes: 8 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ members = [
"framework_uefi",
# Catchall library that we'll probably want to split up further
"framework_lib",
# Fork of https://github.com/rust-osdev/uefi-rs/blob/main/uefi-macros
# To avoid pulling in UEFI dependencies when building for an OS
"guid_macros",
]

# Don't build UEFI by default. Needs special cargo invocation
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,12 @@ make -C framework_uefi
ls -l framework_uefi/build/x86_64-unknown-uefi/boot.efi
```

Building on Windows or in general with fewer features:
## Install local package

```ps1
# Build the library and tool
cargo build

# Running the tool
cargo run
```
> cargo install --path framework_tool
> which framework_tool
/home/zoid/.cargo/bin/framework_tool
```

## Running
Expand Down
9 changes: 7 additions & 2 deletions framework_lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
[package]
name = "framework_lib"
version = "0.4.1"
version = "0.4.2"
description = "Library to control Framework Computer systems"
homepage = "https://github.com/FrameworkComputer/framework-system"
repository = "https://github.com/FrameworkComputer/framework-system"
readme = "README.md"
license = "BSD-3-Clause"
edition = "2021"
# Minimum Supported Rust Version
# Ubuntu 24.04 LTS ships 1.75
Expand All @@ -26,9 +31,9 @@ num-traits = { version = "0.2", default-features = false }
log = { version = "0.4", default-features = true }
spin = { version = "0.9.8" }
no-std-compat = { version = "0.4.1", features = [ "alloc" ] }
guid_macros = { path = "../guid_macros" }
hidapi = { version = "2.6.3", features = [ "windows-native" ], optional = true }
rusb = { version = "0.9.4", optional = true }
guid-create = { git = "https://github.com/FrameworkComputer/guid-create", branch = "no-rand", default-features = false }

[target.'cfg(target_os = "uefi")'.dependencies]
uefi = { version = "0.20", features = ["alloc"] }
Expand Down
10 changes: 3 additions & 7 deletions framework_lib/src/capsule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@
use std::prelude::v1::*;

use core::prelude::rust_2021::derive;
use guid_create::Guid;
#[cfg(not(feature = "uefi"))]
use std::fs::File;
#[cfg(not(feature = "uefi"))]
use std::io::prelude::*;

#[cfg(not(feature = "uefi"))]
use crate::guid::Guid;
#[cfg(feature = "uefi")]
use uefi::Guid;

#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[repr(C)]
pub struct EfiCapsuleHeader {
Expand Down Expand Up @@ -209,14 +205,14 @@ mod tests {
let data = fs::read(capsule_path).unwrap();
let cap = parse_capsule_header(&data).unwrap();
let expected_header = EfiCapsuleHeader {
capsule_guid: esrt::WINUX_GUID,
capsule_guid: Guid::from(esrt::WINUX_GUID),
header_size: 28,
flags: 65536,
capsule_image_size: 676898,
};
assert_eq!(cap, expected_header);

assert_eq!(cap.capsule_guid, esrt::WINUX_GUID);
assert_eq!(cap.capsule_guid, Guid::from(esrt::WINUX_GUID));
let ux_header = parse_ux_header(&data);
assert_eq!(
ux_header,
Expand Down
9 changes: 5 additions & 4 deletions framework_lib/src/commandline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use alloc::format;
use alloc::string::String;
use alloc::string::ToString;
use alloc::vec::Vec;
use guid_create::{Guid, GUID};
use log::Level;
use num_traits::FromPrimitive;

Expand Down Expand Up @@ -494,7 +495,7 @@ fn print_versions(ec: &CrosEc) {
let mut right_retimer: Option<u32> = None;
if let Some(esrt) = esrt::get_esrt() {
for entry in &esrt.entries {
match entry.fw_class {
match GUID::from(entry.fw_class) {
esrt::TGL_RETIMER01_GUID
| esrt::ADL_RETIMER01_GUID
| esrt::RPL_RETIMER01_GUID
Expand Down Expand Up @@ -700,7 +701,7 @@ fn compare_version(device: Option<HardwareDeviceType>, version: String, ec: &Cro

if let Some(esrt) = esrt::get_esrt() {
for entry in &esrt.entries {
match entry.fw_class {
match GUID::from(entry.fw_class) {
esrt::TGL_RETIMER01_GUID | esrt::ADL_RETIMER01_GUID | esrt::RPL_RETIMER01_GUID => {
if device == Some(HardwareDeviceType::RTM01) {
println!("Comparing RTM01 version {:?}", entry.fw_version.to_string());
Expand Down Expand Up @@ -1032,7 +1033,7 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
println!(" Size: {:>20} B", data.len());
println!(" Size: {:>20} KB", data.len() / 1024);
if let Some(header) = analyze_capsule(&data) {
if header.capsule_guid == esrt::WINUX_GUID {
if header.capsule_guid == Guid::from(esrt::WINUX_GUID) {
let ux_header = capsule::parse_ux_header(&data);
if let Some(dump_path) = &args.dump {
// TODO: Better error handling, rather than just panicking
Expand Down Expand Up @@ -1434,7 +1435,7 @@ pub fn analyze_capsule(data: &[u8]) -> Option<capsule::EfiCapsuleHeader> {
let header = capsule::parse_capsule_header(data)?;
capsule::print_capsule_header(&header);

match header.capsule_guid {
match GUID::from(header.capsule_guid) {
esrt::TGL_BIOS_GUID => {
println!(" Type: Framework TGL Insyde BIOS");
}
Expand Down
Loading
Loading