Bug 2229562 - FR: Add targets for batterystate, charging state and maybe network
Summary: FR: Add targets for batterystate, charging state and maybe network
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 38
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-08-07 02:30 UTC by Fedora-user
Modified: 2023-08-07 08:56 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-08-07 08:56:24 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Fedora-user 2023-08-07 02:30:03 UTC
Using udev rules you can create systemd targets for batterystate or AC-state. This is really useful, as services can then depend on these targets.

Example; only autoupdate dnf when battery is full or AC is attached.

This is even more important for "grandma devices" where you want automatic firmware updates.

Having the base targets "ac" and "battery", "battery full" and "battery empty" would make it easy for these services to be implemented or easily deployed, as they work on every system.

If it is possible to detect network states easily, this would be great too. On Android you csn safe cell data a lot, as good apps dont load images, there are no updates and all. At least automatic updates should be easy to pause on cell networks, and using a config file also other networks for example a phone hotspot.

Reproducible: Always

Actual Results:  
There are no ways to control services only running at a certain battery state or network

Expected Results:  
More control and easy possibility to depend on these markers for dependencies in systemd services

Some udev rules, maybe combined services "critical state" (low battery AND no charger) or "save state" (high battery OR low battery AND charger)

Some way to detect metered connections and also state other connections manually

Comment 1 Zbigniew Jędrzejewski-Szmek 2023-08-07 08:56:24 UTC
For RFE's, please open an upstream ticket (https://github.com/systemd/systemd/issues) or even better write to systemd-devel.org to discuss those ideas. The Fedora tracker is not the best place for such things, because most upstream developers will not see the discussion here.


Note You need to log in before you can comment on or make changes to this bug.