fix lost of frontlight intensity after exiting kobo

This should fix #243.
pull/419/head
chrox 11 years ago
parent 1288be7b95
commit 3ee2c758ec

@ -221,13 +221,12 @@ function Device:getFrontlight()
elseif self:hasFrontlight() then
local model = self:getModel()
if model == "KindlePaperWhite" or model == "KindlePaperWhite2" then
self.frontlight = KindleFrontLight
self.frontlight = KindleFrontLight:new()
elseif self:isKobo() then
self.frontlight = KoboFrontLight
self.frontlight = KoboFrontLight:new()
else -- emulated FrontLight
self.frontlight = BaseFrontLight
self.frontlight = BaseFrontLight:new()
end
self.frontlight:init()
end
return self.frontlight
end

@ -3,6 +3,14 @@ local BaseFrontLight = {
intensity = nil,
}
function BaseFrontLight:new(o)
local o = o or {}
setmetatable(o, self)
self.__index = self
if o.init then o:init() end
return o
end
function BaseFrontLight:init() end
function BaseFrontLight:toggle() end
function BaseFrontLight:setIntensityHW() end

@ -1,7 +1,7 @@
local BaseFrontLight = require("ui/device/basefrontlight")
-- liblipclua, see require below
local KindleFrontLight = {
local KindleFrontLight = BaseFrontLight:new{
min = 0, max = 24,
-- FIXME: Check how to handle this on the PW2, initial reports on IRC suggest that this isn't possible anymore
kpw_fl = "/sys/devices/system/fl_tps6116x/fl_tps6116x0/fl_intensity",
@ -28,8 +28,6 @@ function KindleFrontLight:toggle()
end
end
KindleFrontLight.setIntensity = BaseFrontLight.setIntensity
function KindleFrontLight:setIntensityHW()
if self.lipc_handle ~= nil then
self.lipc_handle:set_int_property("com.lab126.powerd", "flIntensity", self.intensity)

@ -1,6 +1,6 @@
local BaseFrontLight = require("ui/device/basefrontlight")
local KoboFrontLight = {
local KoboFrontLight = BaseFrontLight:new{
min = 1, max = 100,
intensity = 20,
restore_settings = true,
@ -17,8 +17,6 @@ function KoboFrontLight:toggle()
end
end
KoboFrontLight.setIntensity = BaseFrontLight.setIntensity
function KoboFrontLight:setIntensityHW()
if self.fl ~= nil then
self.fl:setBrightness(self.intensity)

Loading…
Cancel
Save