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

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

Loading…
Cancel
Save