Truly silence the attempt at loading SDL2

Expanding on https://github.com/koreader/koreader/pull/7682
ffi/input, loaded by the Device singleton, also needs to know that in
order to setup the proper input backend for SDL2.

Requires https://github.com/koreader/koreader-base/pull/1372 because
that's where the machinery for those checks live.
reviewable/pr7711/r1
NiLuJe 3 years ago
parent d56a944b79
commit 7c7f9e6ebb

@ -1,51 +1,60 @@
local isAndroid, _ = pcall(require, "android")
local lfs = require("libs/libkoreader-lfs")
local util = require("ffi/util")
local function probeDevice()
if isAndroid then
util.noSDL()
return require("device/android/device")
end
local kindle_sn = io.open("/proc/usid", "r")
if kindle_sn then
kindle_sn:close()
local kindle_test_stat = lfs.attributes("/proc/usid")
if kindle_test_stat then
util.noSDL()
return require("device/kindle/device")
end
local kg_test_stat = lfs.attributes("/bin/kobo_config.sh")
if kg_test_stat then
local kobo_test_stat = lfs.attributes("/bin/kobo_config.sh")
if kobo_test_stat then
util.noSDL()
return require("device/kobo/device")
end
local pbook_test_stat = lfs.attributes("/ebrmain")
if pbook_test_stat then
util.noSDL()
return require("device/pocketbook/device")
end
local remarkable_test_stat = lfs.attributes("/usr/bin/xochitl")
if remarkable_test_stat then
util.noSDL()
return require("device/remarkable/device")
end
local sony_prstux_test_stat = lfs.attributes("/etc/PRSTUX")
if sony_prstux_test_stat then
util.noSDL()
return require("device/sony-prstux/device")
end
local cervantes_test_stat = lfs.attributes("/usr/bin/ntxinfo")
if cervantes_test_stat then
util.noSDL()
return require("device/cervantes/device")
end
if util.isSDL() then
return require("device/sdl/device")
end
-- add new ports here:
--
-- if --[[ implement a proper test instead --]] false then
-- util.noSDL()
-- return require("device/newport/device")
-- end
if util.isSDL() then
return require("device/sdl/device")
end
error("Could not find hardware abstraction for this platform. If you are trying to run the emulator, please ensure SDL is installed.")
end

@ -24,7 +24,7 @@ ffi.load = function(lib)
if not lib_path then
io.write("ffi.load (warning): ", re, "\n")
error('Not able to load dynamic library: ' .. lib)
error("Not able to load dynamic library: " .. lib)
else
io.write("ffi.load (assisted searchpath): ", lib_path, "\n")
return ffi_load(lib_path)

Loading…
Cancel
Save