mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
NOT WORKING initial kobo light support.
This commit is contained in:
@@ -3,6 +3,7 @@ require "ui/device"
|
||||
ReaderFrontLight = InputContainer:new{
|
||||
steps = {0,1,2,3,4,5,6,7,8,9,10},
|
||||
intensity = nil,
|
||||
ld = nil,
|
||||
}
|
||||
|
||||
function ReaderFrontLight:init()
|
||||
@@ -13,20 +14,23 @@ function ReaderFrontLight:init()
|
||||
if self.lipc_handle then
|
||||
self.intensity = self.lipc_handle:get_int_property("com.lab126.powerd", "flIntensity")
|
||||
end
|
||||
self.ges_events = {
|
||||
Adjust = {
|
||||
GestureRange:new{
|
||||
ges = "two_finger_pan",
|
||||
range = Geom:new{
|
||||
x = 0, y = 0,
|
||||
w = Screen:getWidth(),
|
||||
h = Screen:getHeight(),
|
||||
},
|
||||
rate = 2.0,
|
||||
}
|
||||
},
|
||||
}
|
||||
end
|
||||
if Device:isKobo() then
|
||||
self.ld = kobolight.open()
|
||||
end
|
||||
self.ges_events = {
|
||||
Adjust = {
|
||||
GestureRange:new{
|
||||
ges = "two_finger_pan",
|
||||
range = Geom:new{
|
||||
x = 0, y = 0,
|
||||
w = Screen:getWidth(),
|
||||
h = Screen:getHeight(),
|
||||
},
|
||||
rate = 2.0,
|
||||
}
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
function ReaderFrontLight:onAdjust(arg, ges)
|
||||
@@ -57,5 +61,22 @@ function ReaderFrontLight:setIntensity(intensity, msg)
|
||||
timeout = 1
|
||||
})
|
||||
end
|
||||
if Device:isKobo() then
|
||||
if self.ld == nil then
|
||||
return true
|
||||
end
|
||||
self.intensity = intensity
|
||||
self.ld:setBrightness(intensity)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function ReaderFrontLight:toggle()
|
||||
if Device:isKobo() then
|
||||
if self.ld == nil then
|
||||
return true
|
||||
end
|
||||
self.ld:toggle()
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user