diff --git a/frontend/device.lua b/frontend/device.lua index f9184fb93..77f848a0a 100644 --- a/frontend/device.lua +++ b/frontend/device.lua @@ -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 diff --git a/setupkoenv.lua b/setupkoenv.lua index 7b370e578..cad24d9b7 100644 --- a/setupkoenv.lua +++ b/setupkoenv.lua @@ -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)