|
|
@ -1,5 +1,6 @@
|
|
|
|
local Event = require("ui/event")
|
|
|
|
local Event = require("ui/event")
|
|
|
|
local Generic = require("device/generic/device")
|
|
|
|
local Generic = require("device/generic/device")
|
|
|
|
|
|
|
|
local SDL = require("ffi/SDL2_0")
|
|
|
|
local logger = require("logger")
|
|
|
|
local logger = require("logger")
|
|
|
|
|
|
|
|
|
|
|
|
local function yes() return true end
|
|
|
|
local function yes() return true end
|
|
|
@ -51,6 +52,7 @@ local Device = Generic:new{
|
|
|
|
model = "SDL",
|
|
|
|
model = "SDL",
|
|
|
|
isSDL = yes,
|
|
|
|
isSDL = yes,
|
|
|
|
home_dir = os.getenv("HOME"),
|
|
|
|
home_dir = os.getenv("HOME"),
|
|
|
|
|
|
|
|
hasBattery = SDL.getPowerInfo(),
|
|
|
|
hasKeyboard = yes,
|
|
|
|
hasKeyboard = yes,
|
|
|
|
hasKeys = yes,
|
|
|
|
hasKeys = yes,
|
|
|
|
hasDPad = yes,
|
|
|
|
hasDPad = yes,
|
|
|
@ -96,9 +98,15 @@ local AppImage = Device:new{
|
|
|
|
isDesktop = yes,
|
|
|
|
isDesktop = yes,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local Desktop = Device:new{
|
|
|
|
|
|
|
|
model = SDL.getPlatform(),
|
|
|
|
|
|
|
|
isDesktop = yes,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local Emulator = Device:new{
|
|
|
|
local Emulator = Device:new{
|
|
|
|
model = "Emulator",
|
|
|
|
model = "Emulator",
|
|
|
|
isEmulator = yes,
|
|
|
|
isEmulator = yes,
|
|
|
|
|
|
|
|
hasBattery = yes,
|
|
|
|
hasEinkScreen = yes,
|
|
|
|
hasEinkScreen = yes,
|
|
|
|
hasFrontlight = yes,
|
|
|
|
hasFrontlight = yes,
|
|
|
|
hasWifiToggle = yes,
|
|
|
|
hasWifiToggle = yes,
|
|
|
@ -108,16 +116,6 @@ local Emulator = Device:new{
|
|
|
|
canSuspend = yes,
|
|
|
|
canSuspend = yes,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local Linux = Device:new{
|
|
|
|
|
|
|
|
model = "Linux",
|
|
|
|
|
|
|
|
isDesktop = yes,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local Mac = Device:new{
|
|
|
|
|
|
|
|
model = "Mac",
|
|
|
|
|
|
|
|
isDesktop = yes,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local UbuntuTouch = Device:new{
|
|
|
|
local UbuntuTouch = Device:new{
|
|
|
|
model = "UbuntuTouch",
|
|
|
|
model = "UbuntuTouch",
|
|
|
|
hasFrontlight = yes,
|
|
|
|
hasFrontlight = yes,
|
|
|
@ -144,6 +142,7 @@ function Device:init()
|
|
|
|
|
|
|
|
|
|
|
|
self.hasClipboard = yes
|
|
|
|
self.hasClipboard = yes
|
|
|
|
self.screen = require("ffi/framebuffer_SDL2_0"):new{device = self, debug = logger.dbg}
|
|
|
|
self.screen = require("ffi/framebuffer_SDL2_0"):new{device = self, debug = logger.dbg}
|
|
|
|
|
|
|
|
self.powerd = require("device/sdl/powerd"):new{device = self}
|
|
|
|
|
|
|
|
|
|
|
|
local ok, re = pcall(self.screen.setWindowIcon, self.screen, "resources/koreader.png")
|
|
|
|
local ok, re = pcall(self.screen.setWindowIcon, self.screen, "resources/koreader.png")
|
|
|
|
if not ok then logger.warn(re) end
|
|
|
|
if not ok then logger.warn(re) end
|
|
|
@ -334,15 +333,13 @@ function Emulator:initNetworkManager(NetworkMgr)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
io.write("Starting SDL in " .. SDL.getBasePath() .. "\n")
|
|
|
|
|
|
|
|
|
|
|
|
-------------- device probe ------------
|
|
|
|
-------------- device probe ------------
|
|
|
|
if os.getenv("APPIMAGE") then
|
|
|
|
if os.getenv("APPIMAGE") then
|
|
|
|
return AppImage
|
|
|
|
return AppImage
|
|
|
|
elseif os.getenv("KO_MULTIUSER") then
|
|
|
|
elseif os.getenv("KO_MULTIUSER") then
|
|
|
|
if jit.os == "OSX" then
|
|
|
|
return Desktop
|
|
|
|
return Mac
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return Linux
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
elseif os.getenv("UBUNTU_APPLICATION_ISOLATION") then
|
|
|
|
elseif os.getenv("UBUNTU_APPLICATION_ISOLATION") then
|
|
|
|
return UbuntuTouch
|
|
|
|
return UbuntuTouch
|
|
|
|
else
|
|
|
|
else
|
|
|
|