mirror of
https://github.com/koreader/koreader
synced 2024-11-10 01:10:34 +00:00
0b29e73e2e
* Start battery stat plugin * BatteryStat & kobolight * Several minor improvements * Remove a useless function * flush settings * Some review feedbacks * Resolve review comments * Remaining Minutes -> Remaining Hours * Add dump_file * typo * realpath * realpath on folder * Remove useless os.time() * Resolve review comments * warning * Add BatteryStat.debugging flag * treat log as txt * Minor improvement * Charging hour should be positive * Use warn instead of info * onSuspend in Kobo * Charging events for kobo and kindle * More events * dumpOrLog * Warnings * Typo * More space * Singleton * slightly format change * BatteryStat singleton * Init * Remove debugging flag * sleeping percentage is still negative * Read settings * Do not need to change was_suspending and was_charging * Typo * Remove debugging flag * Not charging should happen before suspend * Resolve review comments * was_suspend and was_charging should be updated each time in onCallback()
30 lines
870 B
Lua
30 lines
870 B
Lua
local BasePowerD = require("device/generic/powerd")
|
|
local ffi = require("ffi")
|
|
-- local inkview = ffi.load("inkview")
|
|
|
|
ffi.cdef[[
|
|
int IsCharging();
|
|
]]
|
|
|
|
local PocketBookPowerD = BasePowerD:new{
|
|
is_charging = nil,
|
|
batt_capacity_file = "/sys/devices/platform/sun5i-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/battery/capacity",
|
|
is_charging_file = "/sys/devices/platform/sun5i-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/battery/status",
|
|
}
|
|
|
|
function PocketBookPowerD:init()
|
|
end
|
|
|
|
function PocketBookPowerD:getCapacityHW()
|
|
return self:read_int_file(self.batt_capacity_file)
|
|
end
|
|
|
|
function PocketBookPowerD:isChargingHW()
|
|
self.is_charging = self:read_str_file(self.is_charging_file)
|
|
return self.is_charging == "Charging"
|
|
-- or we can query using SDK method `IsCharging`
|
|
--return inkview.IsCharging() == 1
|
|
end
|
|
|
|
return PocketBookPowerD
|