Kobo: Only probe necessary entries in automagic_sysfs codepath

e.g., on the Sage, only the power_dev stuff changes between HW revs,
the rest of the hardcoded stuff is still relevant, so skip probing
those.
reviewable/pr9909/r1
NiLuJe 1 year ago
parent b16b215cbb
commit 8a16518918

@ -627,15 +627,18 @@ function Kobo:init()
-- Automagic sysfs discovery
if self.automagic_sysfs then
-- Battery
if not self.battery_sysfs then
if util.pathExists("/sys/class/power_supply/battery") then
-- Newer devices (circa sunxi)
self.battery_sysfs = "/sys/class/power_supply/battery"
else
self.battery_sysfs = "/sys/class/power_supply/mc13892_bat"
end
end
-- Frontlight
if self:hasNaturalLight() then
if not self.frontlight_settings.frontlight_mixer then
if util.fileExists("/sys/class/leds/aw99703-bl_FL1/color") then
-- HWConfig FL_PWM is AW99703x2
self.frontlight_settings.frontlight_mixer = "/sys/class/leds/aw99703-bl_FL1/color"
@ -647,8 +650,10 @@ function Kobo:init()
self.frontlight_settings.frontlight_mixer = "/sys/class/backlight/tlc5947_bl/color"
end
end
end
-- Input
-- Touch panel input
if not self.touch_dev then
if util.fileExists("/dev/input/by-path/platform-1-0010-event") then
-- Elan (HWConfig TouchCtrl is ekth6) on i2c bus 1
self.touch_dev = "/dev/input/by-path/platform-1-0010-event"
@ -658,7 +663,10 @@ function Kobo:init()
else
self.touch_dev = "/dev/input/event1"
end
end
-- Physical buttons & synthetic NTX events
if not self.ntx_dev then
if util.fileExists("/dev/input/by-path/platform-gpio-keys-event") then
-- Libra 2 w/ a BD71828 PMIC
self.ntx_dev = "/dev/input/by-path/platform-gpio-keys-event"
@ -671,15 +679,19 @@ function Kobo:init()
else
self.ntx_dev = "/dev/input/event0"
end
end
-- Power button (this usually ends up in ntx_dev, except with some PMICs)
if not self.power_dev then
if util.fileExists("/dev/input/by-path/platform-bd71828-pwrkey-event") then
-- Libra 2 w/ a BD71828 PMIC
self.power_dev = "/dev/input/by-path/platform-bd71828-pwrkey-event"
elseif util.fileExists("/dev/input/by-path/platform-bd71828-pwrkey.4.auto-event") then
-- Fix for Kobo Sage, presumably w/ a BD71828 PMIC?
-- Sage w/ a BD71828 PMIC
self.power_dev = "/dev/input/by-path/platform-bd71828-pwrkey.4.auto-event"
end
end
end
-- NOTE: i.MX5 devices have a wonky RTC that doesn't like alarms set further away that UINT16_MAX seconds from now...
-- (c.f., WakeupMgr for more details).

Loading…
Cancel
Save