From bfd55c76c29860988a83e9863e55383d61557246 Mon Sep 17 00:00:00 2001 From: David Engster Date: Sun, 11 Mar 2018 10:35:36 +0100 Subject: [PATCH] device/kobo/powerd: Read natural light configuration Define 'frontlight_settings' table for all Kobo devices, and read configuration from settings file. --- frontend/device/kobo/device.lua | 1 + frontend/device/kobo/powerd.lua | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/frontend/device/kobo/device.lua b/frontend/device/kobo/device.lua index 9072f9291..8da82d097 100644 --- a/frontend/device/kobo/device.lua +++ b/frontend/device/kobo/device.lua @@ -32,6 +32,7 @@ local Kobo = Generic:new{ internal_storage_mount_point = "/mnt/onboard/", -- currently only Aura One has coloured frontlight hasNaturalLight = no, + frontlight_settings = {}, } -- TODO: hasKeys for some devices? diff --git a/frontend/device/kobo/powerd.lua b/frontend/device/kobo/powerd.lua index c449ca6eb..a4acaa536 100644 --- a/frontend/device/kobo/powerd.lua +++ b/frontend/device/kobo/powerd.lua @@ -97,6 +97,12 @@ function KoboPowerD:init() -- If this device has natural light (currently only KA1) -- use the SysFS interface, and ioctl otherwise. if self.device.hasNaturalLight() then + local nl_config = G_reader_settings:readSetting("natural_light_config") + if nl_config then + for key,val in pairs(nl_config) do + self.device.frontlight_settings[key] = val + end + end self.fl = SysfsLight:new(self.device.frontlight_settings) self.fl_warmth = 0 self:_syncKoboLightOnStart()