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,57 +627,69 @@ function Kobo:init()
-- Automagic sysfs discovery -- Automagic sysfs discovery
if self.automagic_sysfs then if self.automagic_sysfs then
-- Battery -- Battery
if util.pathExists("/sys/class/power_supply/battery") then if not self.battery_sysfs then
-- Newer devices (circa sunxi) if util.pathExists("/sys/class/power_supply/battery") then
self.battery_sysfs = "/sys/class/power_supply/battery" -- Newer devices (circa sunxi)
else self.battery_sysfs = "/sys/class/power_supply/battery"
self.battery_sysfs = "/sys/class/power_supply/mc13892_bat" else
self.battery_sysfs = "/sys/class/power_supply/mc13892_bat"
end
end end
-- Frontlight -- Frontlight
if self:hasNaturalLight() then if self:hasNaturalLight() then
if util.fileExists("/sys/class/leds/aw99703-bl_FL1/color") then if not self.frontlight_settings.frontlight_mixer then
-- HWConfig FL_PWM is AW99703x2 if util.fileExists("/sys/class/leds/aw99703-bl_FL1/color") then
self.frontlight_settings.frontlight_mixer = "/sys/class/leds/aw99703-bl_FL1/color" -- HWConfig FL_PWM is AW99703x2
elseif util.fileExists("/sys/class/backlight/lm3630a_led/color") then self.frontlight_settings.frontlight_mixer = "/sys/class/leds/aw99703-bl_FL1/color"
-- HWConfig FL_PWM is LM3630 elseif util.fileExists("/sys/class/backlight/lm3630a_led/color") then
self.frontlight_settings.frontlight_mixer = "/sys/class/backlight/lm3630a_led/color" -- HWConfig FL_PWM is LM3630
elseif util.fileExists("/sys/class/backlight/tlc5947_bl/color") then self.frontlight_settings.frontlight_mixer = "/sys/class/backlight/lm3630a_led/color"
-- HWConfig FL_PWM is TLC5947 elseif util.fileExists("/sys/class/backlight/tlc5947_bl/color") then
self.frontlight_settings.frontlight_mixer = "/sys/class/backlight/tlc5947_bl/color" -- HWConfig FL_PWM is TLC5947
self.frontlight_settings.frontlight_mixer = "/sys/class/backlight/tlc5947_bl/color"
end
end end
end end
-- Input -- Touch panel input
if util.fileExists("/dev/input/by-path/platform-1-0010-event") then if not self.touch_dev then
-- Elan (HWConfig TouchCtrl is ekth6) on i2c bus 1 if util.fileExists("/dev/input/by-path/platform-1-0010-event") then
self.touch_dev = "/dev/input/by-path/platform-1-0010-event" -- Elan (HWConfig TouchCtrl is ekth6) on i2c bus 1
elseif util.fileExists("/dev/input/by-path/platform-0-0010-event") then self.touch_dev = "/dev/input/by-path/platform-1-0010-event"
-- Elan (HWConfig TouchCtrl is ekth6) on i2c bus 0 elseif util.fileExists("/dev/input/by-path/platform-0-0010-event") then
self.touch_dev = "/dev/input/by-path/platform-0-0010-event" -- Elan (HWConfig TouchCtrl is ekth6) on i2c bus 0
else self.touch_dev = "/dev/input/by-path/platform-0-0010-event"
self.touch_dev = "/dev/input/event1" else
self.touch_dev = "/dev/input/event1"
end
end end
if util.fileExists("/dev/input/by-path/platform-gpio-keys-event") then -- Physical buttons & synthetic NTX events
-- Libra 2 w/ a BD71828 PMIC if not self.ntx_dev then
self.ntx_dev = "/dev/input/by-path/platform-gpio-keys-event" if util.fileExists("/dev/input/by-path/platform-gpio-keys-event") then
elseif util.fileExists("/dev/input/by-path/platform-ntx_event0-event") then -- Libra 2 w/ a BD71828 PMIC
-- sunxi & Mk. 7 self.ntx_dev = "/dev/input/by-path/platform-gpio-keys-event"
self.ntx_dev = "/dev/input/by-path/platform-ntx_event0-event" elseif util.fileExists("/dev/input/by-path/platform-ntx_event0-event") then
elseif util.fileExists("/dev/input/by-path/platform-mxckpd-event") then -- sunxi & Mk. 7
-- circa Mk. 5 i.MX self.ntx_dev = "/dev/input/by-path/platform-ntx_event0-event"
self.ntx_dev = "/dev/input/by-path/platform-mxckpd-event" elseif util.fileExists("/dev/input/by-path/platform-mxckpd-event") then
else -- circa Mk. 5 i.MX
self.ntx_dev = "/dev/input/event0" self.ntx_dev = "/dev/input/by-path/platform-mxckpd-event"
else
self.ntx_dev = "/dev/input/event0"
end
end end
if util.fileExists("/dev/input/by-path/platform-bd71828-pwrkey-event") then -- Power button (this usually ends up in ntx_dev, except with some PMICs)
-- Libra 2 w/ a BD71828 PMIC if not self.power_dev then
self.power_dev = "/dev/input/by-path/platform-bd71828-pwrkey-event" if util.fileExists("/dev/input/by-path/platform-bd71828-pwrkey-event") then
elseif util.fileExists("/dev/input/by-path/platform-bd71828-pwrkey.4.auto-event") then -- Libra 2 w/ a BD71828 PMIC
-- Fix for Kobo Sage, presumably w/ a BD71828 PMIC? self.power_dev = "/dev/input/by-path/platform-bd71828-pwrkey-event"
self.power_dev = "/dev/input/by-path/platform-bd71828-pwrkey.4.auto-event" elseif util.fileExists("/dev/input/by-path/platform-bd71828-pwrkey.4.auto-event") then
-- Sage w/ a BD71828 PMIC
self.power_dev = "/dev/input/by-path/platform-bd71828-pwrkey.4.auto-event"
end
end end
end end

Loading…
Cancel
Save