only open frontlight device on Kobo devices that actually have light

This commit is contained in:
Hans-Werner Hilse
2014-12-02 11:15:23 +01:00
parent 4fb6eae358
commit 3d73ff5ae7

View File

@@ -13,9 +13,11 @@ local KoboPowerD = BasePowerD:new{
}
function KoboPowerD:init()
local kobolight = require("ffi/kobolight")
local ok, light = pcall(kobolight.open)
if ok then self.fl = light end
if self.device.hasFrontlight() then
local kobolight = require("ffi/kobolight")
local ok, light = pcall(kobolight.open)
if ok then self.fl = light end
end
end
function KoboPowerD:toggleFrontlight()