git clone https://garage44.eu/jeroen/pinnacle.gitcartopolis-agent · 2026-11-30T14:38:50Z
fix: put the brightness hunks where they belong 110a0c6 was staged from a zero-context patch, which git placed by the new file's line numbers: BRIGHTNESS outside abi's call module, its syscall arm inside LOG's, rt's wrappers inside the Battery struct's region, Settings' Brightness arms in the wrong match, two module lines swapped, three doc lines moved, and the brightness slider's min attribute left out. The worktree, tested by cargo xtask pc, laptop and ARM clippy, had them right; this commits it.
abi/src/lib.rs | 2 +-
docs/hardware.md | 6 +++---
kernel/src/drivers/mod.rs | 4 ++--
kernel/src/syscall.rs | 10 +++++-----
programs/src/bin/settings.rs | 18 +++++++++---------
rt/src/lib.rs | 8 ++++----
6 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/abi/src/lib.rs b/abi/src/lib.rs
index d8de86e..31b3ef2 100644
--- a/abi/src/lib.rs
+++ b/abi/src/lib.rs
@@ -305,7 +305,6 @@ pub mod call {
/// 0 on a machine with none of them. Not for confined or sealed
/// programs.
pub const POWER: u64 = 71;
-}
/// `brightness(op, value)`: the built-in screen's brightness, 0 to 100
/// (Intel's graphics, or the firmware's ACPI methods). Op 0 returns
/// it; op 1 sets it to `value` (never below 5, a black screen being
@@ -313,6 +312,7 @@ pub mod call {
/// [`ERROR`](super::ERROR) when the screen has no brightness to set.
/// Not for confined or sealed programs.
pub const BRIGHTNESS: u64 = 72;
+}
/// Where the network is, as [`NET_SWITCH`](call::NET_SWITCH) answers.
pub mod net {
diff --git a/docs/hardware.md b/docs/hardware.md
index 529a0ad..a764c06 100644
--- a/docs/hardware.md
+++ b/docs/hardware.md
@@ -213,13 +213,13 @@ internal disk its driver cannot read, is said on the screen and the system
goes on.
What to look for, line by line: `framebuffer:` (the firmware's screen),
-`apic: x2APIC mode` (with `xapic` on the command line as the fallback to
-try), `acpi: a laptop, in ACPI mode; off by \_S5 …; the power button
-heard`, `ps2: a keyboard and a mouse or touchpad` (absent: the keyboard is
`display: a whole frame … us write-combining, … us uncached` (how much
the write-combining window gains on this machine), `i915: Intel graphics
…, backlight by the chipset's PWM …: N %` or why not, then
`backlight: by ACPI …` or `backlight: none to set`,
+`apic: x2APIC mode` (with `xapic` on the command line as the fallback to
+try), `acpi: a laptop, in ACPI mode; off by \_S5 …; the power button
+heard`, `ps2: a keyboard and a mouse or touchpad` (absent: the keyboard is
not on the controller, or the touchpad is I²C-only), `i2c: 2 DesignWare
controllers` and `touchpad: ELAN0001 at 0x15 on \_SB.PC00.I2C1, HID
04f3:3140, polled` (or why not: no controller of this kernel's, no
diff --git a/kernel/src/drivers/mod.rs b/kernel/src/drivers/mod.rs
index b051949..984e102 100644
--- a/kernel/src/drivers/mod.rs
+++ b/kernel/src/drivers/mod.rs
@@ -5,8 +5,8 @@
//! (`iwlwifi`); a board's come board by board.
pub mod ahci;
-pub mod block;
pub mod backlight;
+pub mod block;
pub mod display;
pub mod e1000;
pub mod gpu;
@@ -16,9 +16,9 @@ pub mod hda;
pub mod i2c_dw;
#[cfg(target_arch = "x86_64")]
pub mod i2c_hid;
-pub mod input;
#[cfg(target_arch = "x86_64")]
pub mod i915;
+pub mod input;
pub mod iwlwifi;
pub mod net;
pub mod nvme;
diff --git a/kernel/src/syscall.rs b/kernel/src/syscall.rs
index d8b5279..24a3a8e 100644
--- a/kernel/src/syscall.rs
+++ b/kernel/src/syscall.rs
@@ -333,11 +333,6 @@ fn handle_call(frame: *mut Frame) -> *mut Frame {
FAILED
}
}
- call::PROCESSES | call::KILL_ID | call::LOG if confined() => FAILED,
- call::PROCESSES => processes(a[0], a[1] as usize, a[2] as usize),
- call::KILL_ID => kill_id(a[0]),
- call::LOG => {
- let mut kept = Vec::with_capacity(crate::console::KEPT);
call::BRIGHTNESS if confined() => FAILED,
call::BRIGHTNESS => {
let level = match a[0] {
@@ -347,6 +342,11 @@ fn handle_call(frame: *mut Frame) -> *mut Frame {
};
level.map_or(FAILED, |l| (u64::from(l), 0, 0))
}
+ call::PROCESSES | call::KILL_ID | call::LOG if confined() => FAILED,
+ call::PROCESSES => processes(a[0], a[1] as usize, a[2] as usize),
+ call::KILL_ID => kill_id(a[0]),
+ call::LOG => {
+ let mut kept = Vec::with_capacity(crate::console::KEPT);
crate::console::CONSOLE.lock().kept(&mut kept);
// The newest part, when the buffer is smaller.
let from = kept.len().saturating_sub(a[1] as usize);
diff --git a/programs/src/bin/settings.rs b/programs/src/bin/settings.rs
index 539185f..4a987c6 100644
--- a/programs/src/bin/settings.rs
+++ b/programs/src/bin/settings.rs
@@ -1588,6 +1588,7 @@ fn name_of(action: Action) -> String {
Action::Contrast => "contrast".into(),
Action::Reader => "reader".into(),
Action::Volume(_) => "volume".into(),
+ Action::Brightness(_) => "brightness".into(),
}
}
@@ -1611,7 +1612,6 @@ fn play_tone() {
player.drain();
}
- Action::Brightness(_) => "brightness".into(),
/// The tone's loudest sample before the mixer: `cargo xtask sound-demo`
/// finds it scaled by the volume in what QEMU heard.
const TONE_LEVEL: f32 = 8000.0;
@@ -1664,7 +1664,7 @@ fn page(title: &str, sections: &[Section], tapped: &Signal<Option<Action>>) -> V
el("input")
.class("m-slider__native")
.attr("type", "range")
- .attr("min", "0")
+ .attr("min", alloc::format!("{min}"))
.attr("max", "100")
.attr("step", "5")
.attr("aria-label", kind.label())
@@ -2363,6 +2363,13 @@ fn main(_argument: u64) -> u64 {
// does not wait for it.
pinnacle_rt::thread::spawn(play_tone);
}
+ Some(Action::Brightness(v)) => {
+ let set = pinnacle_rt::set_brightness(v);
+ if !pinnacle_ui::brightness::keep(set.unwrap_or(v)) {
+ pinnacle_rt::println!("settings: the brightness was not kept");
+ }
+ pinnacle_rt::println!("settings: brightness {} %", set.unwrap_or(v));
+ }
Some(Action::NetworkSwitch) => {
let on = net::state() == NET_OFF;
let state = net::switch(on);
@@ -2386,13 +2393,6 @@ fn main(_argument: u64) -> u64 {
}
Some(Action::InstallConfirm) => {
let disks = pinnacle_rt::install::disks();
- Some(Action::Brightness(v)) => {
- let set = pinnacle_rt::set_brightness(v);
- if !pinnacle_ui::brightness::keep(set.unwrap_or(v)) {
- pinnacle_rt::println!("settings: the brightness was not kept");
- }
- pinnacle_rt::println!("settings: brightness {} %", set.unwrap_or(v));
- }
if let Some(d) = install_choice.and_then(|i| disks.get(i)) {
let started = pinnacle_rt::install::start(&d.name);
pinnacle_rt::println!(
diff --git a/rt/src/lib.rs b/rt/src/lib.rs
index 2196c0f..afdcf65 100644
--- a/rt/src/lib.rs
+++ b/rt/src/lib.rs
@@ -509,10 +509,6 @@ pub fn log() -> String {
String::from_utf8_lossy(&buffer).into_owned()
}
-/// A battery, as [`power`] reads it.
-#[derive(Clone, Debug, Default, PartialEq)]
-pub struct Battery {
- /// `charging`, `discharging`, `full` or `absent`.
/// The built-in screen's brightness, 0 to 100: None when it has none to
/// set (no driver for its graphics or firmware that sets it; QEMU), or for
/// a confined program.
@@ -528,6 +524,10 @@ pub fn set_brightness(percent: u8) -> Option<u8> {
(v != ERROR).then_some(v as u8)
}
+/// A battery, as [`power`] reads it.
+#[derive(Clone, Debug, Default, PartialEq)]
+pub struct Battery {
+ /// `charging`, `discharging`, `full` or `absent`.
pub state: String,
pub percent: Option<u8>,
/// To empty, discharging; to full, charging.