Skip to content

Commit 9cd82b5

Browse files
committed
README: Move more examples away
Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 5ac001d commit 9cd82b5

2 files changed

Lines changed: 156 additions & 81 deletions

File tree

EXAMPLES.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,142 @@
11
# Example usage
22

3+
Built-in help:
4+
5+
```
6+
> framework_tool
7+
Swiss army knife for Framework laptops
8+
9+
Usage: framework_tool [OPTIONS]
10+
11+
Options:
12+
--flash-gpu-descriptor <fgd> <fgd>
13+
14+
-v, --verbose...
15+
Increase logging verbosity
16+
-q, --quiet...
17+
Decrease logging verbosity
18+
--versions
19+
List current firmware versions
20+
--version
21+
Show tool version information (Add -vv for more details)
22+
--features
23+
Show features support by the firmware
24+
--esrt
25+
Display the UEFI ESRT table
26+
--device <DEVICE>
27+
[possible values: bios, ec, pd0, pd1, rtm01, rtm23, ac-left, ac-right]
28+
--compare-version <COMPARE_VERSION>
29+
30+
--power
31+
Show current power status of battery and AC (Add -vv for more details)
32+
--thermal
33+
Print thermal information (Temperatures and Fan speed)
34+
--sensors
35+
Print sensor information (ALS, G-Sensor)
36+
--fansetduty [<FANSETDUTY>...]
37+
Set fan duty cycle (0-100%)
38+
--fansetrpm [<FANSETRPM>...]
39+
Set fan RPM (limited by EC fan table max RPM)
40+
--autofanctrl
41+
Turn on automatic fan speed control
42+
--pdports
43+
Show information about USB-C PD ports
44+
--info
45+
Show info from SMBIOS (Only on UEFI)
46+
--pd-info
47+
Show details about the PD controllers
48+
--pd-reset <PD_RESET>
49+
Reset a specific PD controller (for debugging only)
50+
--pd-disable <PD_DISABLE>
51+
Disable all ports on a specific PD controller (for debugging only)
52+
--pd-enable <PD_ENABLE>
53+
Enable all ports on a specific PD controller (for debugging only)
54+
--dp-hdmi-info
55+
Show details about connected DP or HDMI Expansion Cards
56+
--dp-hdmi-update <UPDATE_BIN>
57+
Update the DisplayPort or HDMI Expansion Card
58+
--audio-card-info
59+
Show details about connected Audio Expansion Cards (Needs root privileges)
60+
--privacy
61+
Show privacy switch statuses (camera and microphone)
62+
--pd-bin <PD_BIN>
63+
Parse versions from PD firmware binary file
64+
--ec-bin <EC_BIN>
65+
Parse versions from EC firmware binary file
66+
--capsule <CAPSULE>
67+
Parse UEFI Capsule information from binary file
68+
--dump <DUMP>
69+
Dump extracted UX capsule bitmap image to a file
70+
--h2o-capsule <H2O_CAPSULE>
71+
Parse UEFI Capsule information from binary file
72+
--dump-ec-flash <DUMP_EC_FLASH>
73+
Dump EC flash contents
74+
--flash-ec <FLASH_EC>
75+
Flash EC (RO+RW) with new firmware from file - may render your hardware unbootable!
76+
--flash-ro-ec <FLASH_RO_EC>
77+
Flash EC with new RO firmware from file - may render your hardware unbootable!
78+
--flash-rw-ec <FLASH_RW_EC>
79+
Flash EC with new RW firmware from file
80+
--intrusion
81+
Show status of intrusion switch
82+
--inputdeck
83+
Show status of the input modules (Framework 16 only)
84+
--inputdeck-mode <INPUTDECK_MODE>
85+
Set input deck power mode [possible values: auto, off, on] (Framework 16 only) [possible values: auto, off, on]
86+
--expansion-bay
87+
Show status of the expansion bay (Framework 16 only)
88+
--charge-limit [<CHARGE_LIMIT>]
89+
Get or set max charge limit
90+
--charge-current-limit <CHARGE_CURRENT_LIMIT>...
91+
Set max charge current limit
92+
--charge-rate-limit <CHARGE_RATE_LIMIT>...
93+
Set max charge current limit
94+
--get-gpio [<GET_GPIO>]
95+
Get GPIO value by name or all, if no name provided
96+
--fp-led-level [<FP_LED_LEVEL>]
97+
Get or set fingerprint LED brightness level [possible values: high, medium, low, ultra-low, auto]
98+
--fp-brightness [<FP_BRIGHTNESS>]
99+
Get or set fingerprint LED brightness percentage
100+
--kblight [<KBLIGHT>]
101+
Set keyboard backlight percentage or get, if no value provided
102+
--remap-key <REMAP_KEY> <REMAP_KEY> <REMAP_KEY>
103+
Remap a key by changing the scancode
104+
--rgbkbd <RGBKBD> <RGBKBD>...
105+
Set the color of <key> to <RGB>. Multiple colors for adjacent keys can be set at once. <key> <RGB> [<RGB> ...] Example: 0 0xFF000 0x00FF00 0x0000FF
106+
--tablet-mode <TABLET_MODE>
107+
Set tablet mode override [possible values: auto, tablet, laptop]
108+
--touchscreen-enable <TOUCHSCREEN_ENABLE>
109+
Enable/disable touchscreen [possible values: true, false]
110+
--stylus-battery
111+
Check stylus battery level (USI 2.0 stylus only)
112+
--console <CONSOLE>
113+
Get EC console, choose whether recent or to follow the output [possible values: recent, follow]
114+
--reboot-ec <REBOOT_EC>
115+
Control EC RO/RW jump [possible values: reboot, jump-ro, jump-rw, cancel-jump, disable-jump]
116+
--ec-hib-delay [<EC_HIB_DELAY>]
117+
Get or set EC hibernate delay (S5 to G3)
118+
--hash <HASH>
119+
Hash a file of arbitrary data
120+
--driver <DRIVER>
121+
Select which driver is used. By default portio is used [possible values: portio, cros-ec, windows]
122+
--pd-addrs <PD_ADDRS> <PD_ADDRS> <PD_ADDRS>
123+
Specify I2C addresses of the PD chips (Advanced)
124+
--pd-ports <PD_PORTS> <PD_PORTS> <PD_PORTS>
125+
Specify I2C ports of the PD chips (Advanced)
126+
-t, --test
127+
Run self-test to check if interaction with EC is possible
128+
-f, --force
129+
Force execution of an unsafe command - may render your hardware unbootable!
130+
--dry-run
131+
Simulate execution of a command (e.g. --flash-ec)
132+
--flash-gpu-descriptor-file <FLASH_GPU_DESCRIPTOR_FILE>
133+
File to write to the gpu EEPROM
134+
--dump-gpu-descriptor-file <DUMP_GPU_DESCRIPTOR_FILE>
135+
File to dump the gpu EEPROM to
136+
-h, --help
137+
Print help
138+
```
139+
3140
## Check firmware versions
4141

5142
### BIOS (Mainboard, UEFI, EC, PD, Retimer)

README.md

Lines changed: 19 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,32 @@ All of these need EC communication support in order to work.
137137
- [x] Using [Framework EC Windows driver](https://github.com/FrameworkComputer/crosecbus) based on [coolstar's](https://github.com/coolstar/crosecbus)
138138
- [x] Using [DHowett's Windows CrosEC driver](https://github.com/DHowett/FrameworkWindowsUtils)
139139

140-
## Prerequisites
140+
## Building
141141

142-
Only [Rustup](https://rustup.rs/) is needed. Based on `rust-toolchain.toml` it
143-
will install the right toolchain and version for this project.
142+
### Dependencies
144143

145-
## Building
144+
[Rustup](https://rustup.rs/) is convenient for setting up the right Rust version.
145+
Based on `rust-toolchain.toml` it will install the right toolchain and version for this project.
146146

147147
MSRV (Minimum Supported Rust Version):
148148

149149
- 1.74 for Linux/Windows
150150
- 1.74 for UEFI
151151

152+
System dependencies
153+
154+
```
155+
# NixOS
156+
nix-shell --run fish -p cargo systemd udev hidapi pkg-config
157+
direnv shell
158+
159+
# Fedora
160+
sudo dnf install systemd-devel hidapi-devel
161+
162+
# FreeBSD
163+
sudo pkg install hidapi
164+
```
165+
152166
```sh
153167
# Running linter
154168
cargo clippy
@@ -175,17 +189,6 @@ make -C framework_uefi
175189
ls -l framework_uefi/build/x86_64-unknown-uefi/boot.efi
176190
```
177191

178-
### Dependencies
179-
180-
```
181-
# NixOS
182-
nix-shell --run fish -p cargo systemd udev hidapi pkg-config
183-
direnv shell
184-
185-
# FreeBSD
186-
sudo pkg install hidapi
187-
```
188-
189192
## Install local package
190193

191194
```
@@ -196,75 +199,10 @@ sudo pkg install hidapi
196199

197200
## Running
198201

199-
Run without any arguments to see the help:
200-
201-
```
202-
> cargo run
203-
Swiss army knife for Framework laptops
204-
205-
Usage: framework_tool [OPTIONS]
206-
207-
Options:
208-
-v, --verbose... More output per occurrence
209-
-q, --quiet... Less output per occurrence
210-
--versions List current firmware versions version
211-
--esrt Display the UEFI ESRT table
212-
--power Show current power status (battery and AC)
213-
--pdports Show information about USB-C PD ports
214-
--info Show info from SMBIOS (Only on UEFI)
215-
--pd-info Show details about the PD controllers
216-
--dp-hdmi-info Show details about connected DP or HDMI Expansion Cards
217-
--dp-hdmi-update <UPDATE_BIN> Update the DisplayPort or HDMI Expansion Card
218-
--audio-card-info Show details about connected Audio Expansion Cards (Needs root privileges)
219-
--privacy Show privacy switch statuses (camera and microphone)
220-
--pd-bin <PD_BIN> Parse versions from PD firmware binary file
221-
--ec-bin <EC_BIN> Parse versions from EC firmware binary file
222-
--capsule <CAPSULE> Parse UEFI Capsule information from binary file
223-
--dump <DUMP> Dump extracted UX capsule bitmap image to a file
224-
--h2o-capsule <H2O_CAPSULE> Parse UEFI Capsule information from binary file
225-
--intrusion Show status of intrusion switch
226-
--inputdeck Show status of the input deck
227-
--input-deck-mode <INPUT_DECK_MODE>
228-
Set input deck power mode [possible values: auto, off, on] (Framework 16 only) [possible values: auto, off, on]
229-
--expansion-bay Show status of the expansion bay (Framework 16 only)
230-
--charge-limit [<CHARGE_LIMIT>]
231-
Get or set max charge limit
232-
--get-gpio [<GET_GPIO>]
233-
Get GPIO value by name or all, if no name provided
234-
--fp-led-level [<FP_LED_LEVEL>]
235-
Get or set fingerprint LED brightness level [possible values: high, medium, low, ultra-low, auto]
236-
--fp-brightness [<FP_BRIGHTNESS>]
237-
Get or set fingerprint LED brightness percentage
238-
--kblight [<KBLIGHT>] Set keyboard backlight percentage or get, if no value provided
239-
--tablet-mode <TABLET_MODE> Set tablet mode override [possible values: auto, tablet, laptop]
240-
--touchscreen-enable <TOUCHSCREEN_ENABLE>
241-
Enable/disable touchscreen [possible values: true, false]
242-
--console <CONSOLE> Get EC console, choose whether recent or to follow the output [possible values: recent, follow]
243-
--reboot-ec <REBOOT_EC> Control EC RO/RW jump [possible values: reboot, jump-ro, jump-rw, cancel-jump, disable-jump]
244-
--hash <HASH> Hash a file of arbitrary data
245-
--driver <DRIVER> Select which driver is used. By default portio is used [possible values: portio, cros-ec, windows]
246-
--pd-addrs <PD_ADDRS> <PD_ADDRS>
247-
Specify I2C addresses of the PD chips (Advanced)
248-
--pd-ports <PD_PORTS> <PD_PORTS>
249-
Specify I2C ports of the PD chips (Advanced)
250-
-t, --test Run self-test to check if interaction with EC is possible
251-
-h, --help Print help information
252-
```
202+
Run without any arguments to see the help.
253203

254204
Many actions require root. First build with cargo and then run the binary with sudo:
255205

256206
```sh
257207
cargo build && sudo ./target/debug/framework_tool
258208
```
259-
260-
##### Running on ChromeOS
261-
262-
The application can run on ChromeOS but most commands rely on custom host
263-
commands that we built into the EC firmware of non-Chromebook Framework laptops.
264-
In theory you could add those patches to the Chromebook platform, build your
265-
own EC firmware and flash it.
266-
267-
## Tests
268-
269-
- [x] Basic unit tests
270-
- [x] Test parsing real binaries

0 commit comments

Comments
 (0)