baskerville / plato

Document reader
Other
1.26k stars 105 forks source link

Battery subsystem causes fatal error on Kobo Libra 2 #237

Closed ticky closed 2 years ago

ticky commented 2 years ago

On my Kobo Libra 2, Plato 0.9.27 fails to start, and I get the following in info.log:

Error: can't build context

Caused by:
    0: can't create battery
    1: No such file or directory (os error 2)

This appears to be down to an oversight in the battery reading code; as a Mark 9 device, the Libra 2 exposes the battery device at /sys/class/power_supply/battery, not /sys/class/power_supply/mc13892_bat, but the battery code is treating it as if it were an earlier device:

https://github.com/baskerville/plato/blob/0f7fdea597a9d2e557c25f37c772f660433ef74a/src/battery/kobo.rs#L34

I believe this could be fixed by merging #185, or by changing the above line to < instead of !=