@ -57,24 +57,52 @@ local PocketBook = Generic:new{
}
function PocketBook : init ( )
self.screen = require ( " ffi/framebuffer_mxcfb " ) : new { device = self , debug = logger.dbg }
self.powerd = require ( " device/pocketbook/powerd " ) : new { device = self }
self.input = require ( " device/input " ) : new {
device = self ,
event_map = {
[ KEY_MENU ] = " Menu " ,
[ KEY_PREV ] = " LPgBack " ,
[ KEY_NEXT ] = " LPgFwd " ,
} ,
handleMiscEv = function ( this , ev )
if ev.code == EVT_BACKGROUND then
self.isInBackGround = true
return " Suspend "
elseif ev.code == EVT_FOREGROUND then
if self.isInBackGround then
self.isInBackGround = false
return " Resume "
end
end
end ,
}
-- in contrast to kobo/kindle, pocketbook-devices do not use linux/input
-- events directly. To be able to use input.lua nevertheless, we make
-- inkview-events look like linux/input events or handle them directly
-- here.
-- Unhandled events will leave Input:waitEvent() as "GenericInput"
self.input : registerEventAdjustHook ( function ( _input , ev )
if ev.type == EVT_KEYDOWN or ev.type == EVT_KEYUP then
ev.code = ev.code
ev.value = ev.type == EVT_KEYDOWN and 1 or 0
ev.type = 1 -- EV_KEY
elseif ev.type == EVT_BACKGROUND then
self.isInBackGround = true
self : onPowerEvent ( " Power " )
elseif self.isInBackGround and ev.type == EVT_FOREGROUND then
self.isInBackGround = false
self : onPowerEvent ( " Power " )
elseif ev.type == EVT_EXIT then
-- auto shutdown event from inkview framework, gracefully close
-- everything and let the framework shutdown the device
ev.type = 1 -- linux/input.h Key-Event
end
-- handle EVT_BACKGROUND and EVT_FOREGROUND as MiscEvent as this makes
-- it easy to return a string directly which can be used in
-- uimanager.lua as event_handler index.
if ev.type == EVT_BACKGROUND or ev.type == EVT_FOREGROUND then
ev.code = ev.type
ev.type = 4 -- handle as MiscEvent, see above
end
-- auto shutdown event from inkview framework, gracefully close
-- everything and let the framework shutdown the device
if ev.type == EVT_EXIT then
require ( " ui/uimanager " ) : broadcastEvent (
require ( " ui/event " ) : new ( " Close " ) )
elseif not self.isInBackGround and ev.type == EVT_FOREGROUND then
self.screen : refreshPartial ( )
end
end )
@ -84,6 +112,8 @@ function PocketBook:init()
Generic.init ( self )
end
function PocketBook : supportsScreensaver ( ) return true end
function PocketBook : setDateTime ( year , month , day , hour , min , sec )
if hour == nil or min == nil then return true end
local command
@ -163,77 +193,6 @@ local PocketBook623 = PocketBook:new{
emu_events_dev = " /var/dev/shm/emu_events " ,
}
function PocketBook840 : init ( )
self.screen = require ( " ffi/framebuffer_mxcfb " ) : new { device = self , debug = logger.dbg }
self.powerd = require ( " device/pocketbook/powerd " ) : new { device = self }
self.input = require ( " device/input " ) : new {
device = self ,
event_map = {
[ 24 ] = " LPgBack " ,
[ 25 ] = " LPgFwd " ,
[ 1002 ] = " Power " ,
}
}
PocketBook.init ( self )
end
function PocketBook631 : init ( )
self.screen = require ( " ffi/framebuffer_mxcfb " ) : new { device = self , debug = logger.dbg }
self.powerd = require ( " device/pocketbook/powerd " ) : new { device = self }
self.input = require ( " device/input " ) : new {
device = self ,
event_map = {
[ 23 ] = " Menu " ,
[ 24 ] = " LPgBack " ,
[ 25 ] = " LPgFwd " ,
[ 1002 ] = " Power " ,
}
}
PocketBook.init ( self )
end
function PocketBook626 : init ( )
self.screen = require ( " ffi/framebuffer_mxcfb " ) : new { device = self , debug = logger.dbg }
self.powerd = require ( " device/pocketbook/powerd " ) : new { device = self }
self.input = require ( " device/input " ) : new {
device = self ,
event_map = {
[ 24 ] = " LPgBack " ,
[ 25 ] = " LPgFwd " ,
[ 1002 ] = " Power " ,
}
}
PocketBook.init ( self )
end
function PocketBook624 : init ( )
self.screen = require ( " ffi/framebuffer_mxcfb " ) : new { device = self , debug = logger.dbg }
self.powerd = require ( " device/pocketbook/powerd " ) : new { device = self }
self.input = require ( " device/input " ) : new {
device = self ,
event_map = {
[ 24 ] = " LPgBack " ,
[ 25 ] = " LPgFwd " ,
[ 1002 ] = " Power " ,
}
}
PocketBook.init ( self )
end
function PocketBook623 : init ( )
self.screen = require ( " ffi/framebuffer_mxcfb " ) : new { device = self , debug = logger.dbg }
self.powerd = require ( " device/pocketbook/powerd " ) : new { device = self }
self.input = require ( " device/input " ) : new {
device = self ,
event_map = {
[ 24 ] = " LPgBack " ,
[ 25 ] = " LPgFwd " ,
[ 1002 ] = " Power " ,
}
}
PocketBook.init ( self )
end
logger.info ( ' SoftwareVersion: ' , PocketBook : getSoftwareVersion ( ) )
local codename = PocketBook : getDeviceModel ( )