Skip to content
Closed
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
21 changes: 0 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,6 @@ on:
push:

jobs:
build-freebsd:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Build
id: test
uses: vmactions/freebsd-vm@v1
with:
release: "15.0"
arch: x86_64
usesh: true
mem: 8192
sync: rsync
prepare: |
pkg install -y rust hidapi pkgconf
run: |
cargo build -p framework_lib
cargo build -p framework_tool

build:
name: Build Linux
runs-on: ubuntu-24.04
Expand Down
12 changes: 6 additions & 6 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Project Overview

Framework System is a Rust library and CLI tool for interacting with Framework Computer hardware. It targets Linux, Windows, UEFI, and FreeBSD. The MSRV is 1.81.
Framework System is a Rust library and CLI tool for interacting with Framework Computer hardware. It targets Linux, Windows, and UEFI. The MSRV is 1.81.

## Development and Testing advice

Most commands must be run as root, try to run them with sudo, usually I have fingerprint sudo enabled, if that fails, ask me to run them and provide the output.

By default build in debug mode that's way faster than `--release` builds.
On every commit all builds, lints and tests must keep working.
We also must not break other platforms (Windows, Linux, FreeBSD, UEFI).
We also must not break other platforms (Windows, Linux, UEFI).

## Build Commands

Expand Down Expand Up @@ -53,7 +53,7 @@ cargo run -- --completions fish > completions/fish/framework_tool.fish

### Key Modules in framework_lib

- `chromium_ec/` — Chrome EC controller communication. Multiple driver backends: `cros_ec` (Linux kernel), `portio` (direct I/O for UEFI/FreeBSD), `windows` (Windows driver). Commands defined in `commands.rs`.
- `chromium_ec/` — Chrome EC controller communication. Multiple driver backends: `cros_ec` (Linux kernel), `portio` (direct I/O for UEFI), `windows` (Windows driver). Commands defined in `commands.rs`.
- `ccgx/` — USB Power Delivery controller (CCG5/CCG6/CCG8) firmware parsing and device management. `binary.rs` handles firmware binary parsing.
- `commandline/` — CLI implementation. `clap_std.rs` for std platforms (uses clap), `uefi.rs` for UEFI-specific parsing.
- `smbios.rs` — SMBIOS table parsing for hardware identification.
Expand All @@ -63,7 +63,7 @@ cargo run -- --completions fish > completions/fish/framework_tool.fish

### Platform Abstraction Patterns

- **OS-level:** `#[cfg(target_os = "linux")]`, `#[cfg(windows)]`, `#[cfg(target_os = "freebsd")]`
- **OS-level:** `#[cfg(target_os = "linux")]`, `#[cfg(windows)]`
- **Feature-level:** `#[cfg(feature = "rusb")]`, `#[cfg(feature = "hidapi")]`, `#[cfg(feature = "uefi")]`
- **no_std compatibility:** UEFI builds use `#![no_std]` with `alloc`. `lazy_static` uses `spin::Mutex` for no_std, `std::sync::Mutex` for std. Custom `no_std_compat` wrapper bridges standard library types.

Expand All @@ -78,11 +78,11 @@ cargo run -- --completions fish > completions/fish/framework_tool.fish

### Custom Dependency Forks

The project patches `uefi`, `uefi-services`, and uses custom forks of `smbios-lib` and `rust-hwio` for no_std/FreeBSD support. See `[patch.crates-io]` in the root Cargo.toml.
The project uses a custom fork of `smbios-lib` for no_std/UEFI support. See `[patch.crates-io]` in the root Cargo.toml. This can be removed once upstream `smbios-lib` supports no_std.

## CI Pipeline

Runs on every push: Linux build, Windows build, UEFI build, FreeBSD build, tests, lints (clippy + fmt), doc generation. CI also verifies shell completions are up-to-date and that no untracked changes are introduced by the build.
Runs on every push: Linux build, Windows build, UEFI build, tests, lints (clippy + fmt), doc generation. CI also verifies shell completions are up-to-date and that no untracked changes are introduced by the build.

## Test Binaries

Expand Down
55 changes: 7 additions & 48 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ default-members = [
]

[patch.crates-io]
uefi = { git = "https://github.com/FrameworkComputer/uefi-rs", branch = "merged" }
uefi-services = { git = "https://github.com/FrameworkComputer/uefi-rs", branch = "merged" }
# The crates.io smbios-lib requires std; this fork adds no_std support needed for UEFI builds.
# Can be removed once upstream smbios-lib supports no_std.
smbios-lib = { git = "https://github.com/FrameworkComputer/smbios-lib.git", branch = "no-std" }

[profile.release]
lto = true
7 changes: 0 additions & 7 deletions Cross.toml

This file was deleted.

17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ winget install framework_tool

### FreeBSD

```
sudo pkg install framework-system
```
> **Note:** FreeBSD support has been dropped. Use Linux or Windows instead.

## Features

Expand All @@ -57,11 +55,10 @@ The following operating environments are supported.
- Linux
- Windows
- UEFI
- FreeBSD

Most functionality depends communication with the EC.
For Linux and Windows there are dedicated drivers.
On UEFI and FreeBSD raw port I/O is used - on Linux this can also be used as a fallback, if the driver is not available or not working.
On UEFI raw port I/O is used - on Linux this can also be used as a fallback, if the driver is not available or not working.

| | Port I/O | Linux | Windows |
|---------------------|----------| ------|---------|
Expand All @@ -83,7 +80,7 @@ On UEFI and FreeBSD raw port I/O is used - on Linux this can also be used as a f
###### Firmware Information

- [x] Show system information
- [x] ESRT table (UEFI, Linux, FreeBSD only) (`--esrt`)
- [x] ESRT table (UEFI, Linux only) (`--esrt`)
- [x] SMBIOS
- [x] Get firmware version from binary file
- [x] EC (Legacy and Zephyr based) (`--ec-bin`)
Expand All @@ -104,8 +101,8 @@ On UEFI and FreeBSD raw port I/O is used - on Linux this can also be used as a f
- [x] PD Controller
- [x] ME (Only on Linux)
- [x] Retimer
- [x] Touchpad (Linux, Windows, FreeBSD, not UEFI)
- [x] Touchscreen (Linux, Windows, FreeBSD, not UEFI)
- [x] Touchpad (Linux, Windows, not UEFI)
- [x] Touchscreen (Linux, Windows, not UEFI)
- [x] Get Expansion Card Firmware (Not on UEFI so far)
- [x] HDMI Expansion Card (`--dp-hdmi-info`)
- [x] DisplayPort Expansion Card (`--dp-hdmi-info`)
Expand Down Expand Up @@ -145,7 +142,6 @@ All of these need EC communication support in order to work.
- [x] Framework Desktop (AMD Ryzen AI Max 300)
- [x] Port I/O communication on Linux
- [x] Port I/O communication in UEFI
- [x] Port I/O communication on FreeBSD
- [x] Using `cros_ec` driver in Linux kernel
- [x] Using [Framework EC Windows driver](https://github.com/FrameworkComputer/crosecbus) based on [coolstar's](https://github.com/coolstar/crosecbus)
- [x] Using [DHowett's Windows CrosEC driver](https://github.com/DHowett/FrameworkWindowsUtils)
Expand Down Expand Up @@ -174,9 +170,6 @@ nix develop
# Fedora
sudo dnf install systemd-devel hidapi-devel

# FreeBSD
sudo pkg install rust hidapi pkgconf

# Ubuntu
sudo apt install rustup build-essential libhidapi-dev libsystemd-dev libudev-dev libusb-1.0-0-dev pkg-config
```
Expand Down
2 changes: 0 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@

# Git dependency output hashes
gitDependencyHashes = {
"redox_hwio-0.1.6" = "sha256-knLIZ7yp42SQYk32NGq3SUGvJFVumFhD64Njr5TRdFs=";
"smbios-lib-0.9.1" = "sha256-3L8JaA75j9Aaqg1z9lVs61m6CvXDeQprEFRq+UDCHQo=";
"uefi-0.20.0" = "sha256-2lUd2a+7NvS94LyAHE2BwGV4j6607mbPXE5htrwdz04=";
};

# Build function for the CLI tool (Linux/macOS)
Expand Down
10 changes: 5 additions & 5 deletions framework_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ guid-create = { version = "0.5.0", default-features = false }
uefi = { version = "0.20", features = ["alloc"] }
uefi-services = "0.17"
plain = "0.2.3"
redox_hwio = { git = "https://github.com/FrameworkComputer/rust-hwio", branch = "freebsd", default-features = false }
smbios-lib = { git = "https://github.com/FrameworkComputer/smbios-lib.git", branch = "no-std", default-features = false }
redox_hwio = { version = "0.1.6", default-features = false }
smbios-lib = { version = "0.9.1", default-features = false }

[target.'cfg(windows)'.dependencies]
wmi = "0.18"
smbios-lib = { git = "https://github.com/FrameworkComputer/smbios-lib.git", branch = "no-std" }
smbios-lib = "0.9.1"
env_logger = "0.11"
clap = { version = "4.5", features = ["derive", "cargo"] }
clap-num = { version = "1.2.0" }
Expand All @@ -58,8 +58,8 @@ nvml-wrapper = { version = "0.11.0", optional = true }
[target.'cfg(unix)'.dependencies]
libc = "0.2.155"
nix = { version = "0.30", features = ["ioctl", "user"] }
redox_hwio = { git = "https://github.com/FrameworkComputer/rust-hwio", branch = "freebsd" }
smbios-lib = { git = "https://github.com/FrameworkComputer/smbios-lib.git", branch = "no-std" }
redox_hwio = "0.1.6"
smbios-lib = "0.9.1"
env_logger = "0.11"
clap = { version = "4.5", features = ["derive", "cargo"] }
clap-num = { version = "1.2.0" }
Expand Down
5 changes: 0 additions & 5 deletions framework_lib/src/ccgx/hid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,7 @@ pub fn find_devices(api: &HidApi, filter_devs: &[u16], sn: Option<&str>) -> Vec<
let usage_page = dev_info.usage_page();

debug!("Found {:X}:{:X} Usage Page: {}", vid, pid, usage_page);
#[cfg(not(target_os = "freebsd"))]
let usage_page_filter = usage_page == CCG_USAGE_PAGE;
// On FreeBSD it seems we don't get different usage pages
// There's just one entry overall
#[cfg(target_os = "freebsd")]
let usage_page_filter = true;

if vid == FRAMEWORK_VID
&& filter_devs.contains(&pid)
Expand Down
Loading