Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
this patch discovers battery status directory in sysfs based on the
type
attribute, avoiding the need to specify driver names for different models / firmware versions.Some background: I’m using postmarketOS with the (close to) mainline kernel on Kobo Clara HD. I’ve been able to compile and run Plato on it, and it works beautifully. Some changes to the code are needed though; one is addressed by this PR.
The upstreamed battery driver has been renamed to
rn5t618-battery
. With this patch the same code should work on all devices and kernels, even if a new driver name is used in the future (I don’t have other devices to test with though). The only downside is a couple more syscalls at start.Some other tweaks are needed to run Plato on a mainline kernel and a non-glibc distribution. I’m submitting this first because avoiding hardcoded names (and a dependency on environment values) seems useful in itself. If you agree, I’d like to send further patches to improve compatibility with mainline, at least where it’s possible to do so without affecting the current use cases.
Thanks!