Future-proof the frontlight handling on Kindle.

Guard against trying to get any kind of frontlight info on devices
without one.

So far the flIntensity prop has always been there, even on devices
without one, but better not assume that'll always be the case ;).

That, and be consistent with the other lipc_handle tests.
pull/1513/head
NiLuJe 9 years ago
parent 276f432274
commit 8a8697c382

@ -15,10 +15,12 @@ function KindlePowerD:init()
if lipc then if lipc then
self.lipc_handle = lipc.init("com.github.koreader.kindlepowerd") self.lipc_handle = lipc.init("com.github.koreader.kindlepowerd")
end end
if self.lipc_handle then if self.device.hasFrontlight() then
self.flIntensity = self.lipc_handle:get_int_property("com.lab126.powerd", "flIntensity") if self.lipc_handle ~= nil then
else self.flIntensity = self.lipc_handle:get_int_property("com.lab126.powerd", "flIntensity")
self.flIntensity = self:read_int_file(self.fl_intensity_file) else
self.flIntensity = self:read_int_file(self.fl_intensity_file)
end
end end
end end

Loading…
Cancel
Save