From 0b34cc15047815640c6c91c012f3e90a2883eb38 Mon Sep 17 00:00:00 2001 From: "Lionel D. Hummel" Date: Tue, 2 Sep 2025 15:10:29 -0700 Subject: [PATCH 1/3] supply: charge_current_max -> constant_charge_current_max The driver adheres to the power-supply framework, and property name (for the maximum charge current that may be requested) is `POWER_SUPPLY_CONSTANT_CHARGE_CURRENT_MAX`. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # On branch main # Your branch is up to date with 'origin/main'. # # Changes to be committed: # modified: src/supply.rs # # Changes not staged for commit: # modified: Cargo.toml # modified: debian/service # # Untracked files: # Cargo.toml~ # debian/service~ # src/supply.rs~ # --- src/supply.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/supply.rs b/src/supply.rs index eb327c0..fa20cf1 100644 --- a/src/supply.rs +++ b/src/supply.rs @@ -158,7 +158,7 @@ impl Supply { let res = self.sysfs_write_u32(key, value); self.log_attr_result(key, value, res); } else if let Some(startup_charge_current_pct) = cfg.startup_charge_current_pct { - let max_ma = self.sysfs_read_u32("charge_current_max")?; + let max_ma = self.sysfs_read_u32("constant_charge_current_max")?; let key = "startup_charge_current_ma"; let value = (startup_charge_current_pct.saturating_mul(max_ma) / 100).clamp(0, max_ma); let res = self.sysfs_write_u32(key, value); From 76b13a3fa5211a176d2dd0f68a8df4d00e9cc5fd Mon Sep 17 00:00:00 2001 From: "Lionel D. Hummel" Date: Tue, 2 Sep 2025 15:20:33 -0700 Subject: [PATCH 2/3] Cargo.toml: usr/bin -> usr/sbin; clarify shutdown threashold Moved install location to the directory for things that run as root. Also, tweak the extended-description to be clear that we only initiate a shutdown when power has failed *and* the threshold condition is met. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # On branch main # Your branch is ahead of 'origin/main' by 1 commit. # (use "git push" to publish your local commits) # # Changes to be committed: # modified: Cargo.toml # # Changes not staged for commit: # modified: debian/service # # Untracked files: # Cargo.toml~ # debian/service~ # src/supply.rs~ # --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d110e9e..e94c319 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,14 +31,14 @@ extended-description = """ silod is a minimal Rust daemon for embedded Linux that listens to kernel uevents from the TS-SILO super-capacitor driver. It applies user-specified charging limits, runs hook scripts on power events, and initiates a clean -shutdown when capacity reaches a critical threshold. +shutdown when power has failed and capacity is below a critical threshold. """ section = "utils" priority = "optional" systemd-units = { enable = true, restart-after-upgrade = true } assets = [ - ["target/release/silod", "usr/bin/", "755"], + ["target/release/silod", "usr/sbin/", "755"], ["silo.toml.example", "etc/silod/silo.toml", "644"], ] conf-files = ["/etc/silod/silo.toml"] From 3d7d1fe035e8b8eb0c59b7713edd432e8211b92a Mon Sep 17 00:00:00 2001 From: "Lionel D. Hummel" Date: Tue, 2 Sep 2025 15:23:52 -0700 Subject: [PATCH 3/3] debian: /usr/bin/silod -> /usr/sbin The service should find `silod` in `/usr/sbin`, which is the directory for things that run as root. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # On branch main # Your branch is ahead of 'origin/main' by 1 commit. # (use "git push" to publish your local commits) # # Changes to be committed: # modified: Cargo.toml # # Changes not staged for commit: # modified: debian/service # # Untracked files: # Cargo.toml~ # debian/service~ # src/supply.rs~ # --- debian/service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/service b/debian/service index 967414c..78d5295 100644 --- a/debian/service +++ b/debian/service @@ -4,7 +4,7 @@ After=multi-user.target [Service] Type=simple -ExecStart=/usr/bin/silod +ExecStart=/usr/sbin/silod Restart=always User=root Group=root