mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
Kindle: Add a hasLightSensor devcap, and use it in the AutoFrontlight plugin (#11255)
Add the Scribe to the list while we're there
This commit is contained in:
@@ -160,6 +160,8 @@ local Kindle = Generic:extend{
|
||||
isNightModeChallenged = no,
|
||||
-- NOTE: While this ought to behave on Zelda/Rex, turns out, nope, it really doesn't work on *any* of 'em :/ (c.f., ko#5884).
|
||||
canHWDither = no,
|
||||
-- Device has an Ambient Light Sensor
|
||||
hasLightSensor = no,
|
||||
-- The time the device went into suspend
|
||||
suspend_time = 0,
|
||||
framework_lipc_handle = frameworkStopped(),
|
||||
@@ -508,6 +510,7 @@ local KindleVoyage = Kindle:extend{
|
||||
isTouchDevice = yes,
|
||||
hasFrontlight = yes,
|
||||
canTurnFrontlightOff = no,
|
||||
hasLightSensor = yes,
|
||||
hasKeys = yes,
|
||||
display_dpi = 300,
|
||||
touch_dev = "/dev/input/event1",
|
||||
@@ -526,6 +529,7 @@ local KindleOasis = Kindle:extend{
|
||||
model = "KindleOasis",
|
||||
isTouchDevice = yes,
|
||||
hasFrontlight = yes,
|
||||
hasLightSensor = yes,
|
||||
hasKeys = yes,
|
||||
hasGSensor = yes,
|
||||
display_dpi = 300,
|
||||
@@ -543,6 +547,7 @@ local KindleOasis2 = Kindle:extend{
|
||||
isZelda = yes,
|
||||
isTouchDevice = yes,
|
||||
hasFrontlight = yes,
|
||||
hasLightSensor = yes,
|
||||
hasKeys = yes,
|
||||
hasGSensor = yes,
|
||||
display_dpi = 300,
|
||||
@@ -556,6 +561,7 @@ local KindleOasis3 = Kindle:extend{
|
||||
hasFrontlight = yes,
|
||||
hasNaturalLight = yes,
|
||||
hasNaturalLightMixer = yes,
|
||||
hasLightSensor = yes,
|
||||
hasKeys = yes,
|
||||
hasGSensor = yes,
|
||||
display_dpi = 300,
|
||||
@@ -629,6 +635,7 @@ local KindleScribe = Kindle:extend{
|
||||
-- but the mix is device-specific, we don't have access to the LUT for the mix powerd is using,
|
||||
-- and the widget is designed for the Kobo Aura One anyway, so, hahaha, nope.
|
||||
hasNaturalLightMixer = yes,
|
||||
hasLightSensor = yes,
|
||||
hasGSensor = yes,
|
||||
display_dpi = 300,
|
||||
touch_dev = "/dev/input/by-path/platform-1001e000.i2c-event",
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
local Device = require("device")
|
||||
|
||||
if not Device:isKindle() or
|
||||
(Device.model ~= "KindleVoyage" and
|
||||
Device.model ~= "KindleOasis" and
|
||||
Device.model ~= "KindleOasis2" and
|
||||
Device.model ~= "KindleOasis3") then
|
||||
if not (Device:isKindle() and Device:hasLightSensor()) then
|
||||
return { disabled = true, }
|
||||
end
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ describe("AutoFrontlight widget tests", function()
|
||||
Device.model = "KindleVoyage"
|
||||
Device.brightness = 0
|
||||
Device.hasFrontlight = function() return true end
|
||||
Device.hasLightSensor = function() return true end
|
||||
Device.powerd = PowerD:new{
|
||||
device = Device,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user