Open nhahnetsrot opened 1 year ago
Commit message should always contain a reason WHY we want this change.
We may also think about who to make this tool discoverable to our users.
Another improvement could be calling this tool from a systemd timer once a week or so and log a system error if a low battery is detected.
Commit message should always contain a reason WHY we want this change.
Ok, i added this
We may also think about who to make this tool discoverable to our users.
What do you mean with that ?
Another improvement could be calling this tool from a systemd timer once a week or so and log a system error if a low battery is detected.
Yes, sounds like a good idea ... shall i do that (ask Volker about that)? My information was, that somehow this tool is intended to be called from some orcla module and then the battery-warning may show up in some high-level tool / health-gui.
General remark: Please fold changes to the patches into the existing ones (interactive rebase), rather than patching on top.
We may also think about who to make this tool discoverable to our users.
What do you mean with that ?
Having it mentioned in the README e.g.
Another improvement could be calling this tool from a systemd timer once a week or so and log a system error if a low battery is detected.
Yes, sounds like a good idea ... shall i do that (ask Volker about that)? My information was, that somehow this tool is intended to be called from some orcla module and then the battery-warning may show up in some high-level tool / health-gui.
We don't have those tools included here. This layer is supposed to be free-standing first of all, providing guidance / examples / re-usable bits how to make use of the hardware.
hi
If no battery or voltage is low, using the existing tool hwclock
also can show the status.
hwclock
[ 107.495137] rtc-pcf8563 2-0051: low voltage detected, date/time is not reliable.
hwclock: ioctl(RTC_RD_TIME) to /dev/rtc0 to read the time failed: Invalid argument
hi
If no battery or voltage is low, using the existing tool
hwclock
also can show the status.hwclock [ 107.495137] rtc-pcf8563 2-0051: low voltage detected, date/time is not reliable. hwclock: ioctl(RTC_RD_TIME) to /dev/rtc0 to read the time failed: Invalid argument
hwclock is apparently not using RTC_VL_READ
while only that IOCTL is triggering the readout of the RTC status bit we need.
A customer analyzed a problem with the current implementation of RTC_VL_READ in our RTC driver: Every write clears the INVALID bit, and that prevents checking the state after, e.g., a write-back done on NTP adjustment during boot. Unfortunately, he didn't report his findings to the upstream kernel.
So I'm trying to resolve that there, see https://lore.kernel.org/lkml/da84b6b1-a9d8-ce46-16a9-e1a2d495240c@siemens.com/T/#u. A simple python script to read the ioctl proved it's working on our hardware.
Seems the hardware does not permit proper read-out, and the kernel does not allow working around that limitation. I'm not sure if it still makes sense to follow this path, given that Linux has no framework to report the battery state via some userspace service. Users could still evaluate the system boot log for warnings about the battery state.
The patch adds the readrtcbattery commandline tool that prints the current status of the rtc battery (1 == faulty, 0 == ok).