2016-01-31 22:57:54 +00:00
|
|
|
local isAndroid, _ = pcall(require, "android")
|
2014-10-30 18:42:18 +00:00
|
|
|
local util = require("ffi/util")
|
|
|
|
|
|
|
|
local function probeDevice()
|
2015-10-03 06:18:47 +00:00
|
|
|
if util.isSDL() then
|
|
|
|
return require("device/sdl/device")
|
2014-10-30 18:42:18 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
if isAndroid then
|
|
|
|
return require("device/android/device")
|
|
|
|
end
|
|
|
|
|
|
|
|
local kindle_sn = io.open("/proc/usid", "r")
|
|
|
|
if kindle_sn then
|
|
|
|
kindle_sn:close()
|
|
|
|
return require("device/kindle/device")
|
|
|
|
end
|
|
|
|
|
2015-04-27 11:10:16 +00:00
|
|
|
local kg_test_stat = lfs.attributes("/bin/kobo_config.sh")
|
|
|
|
if kg_test_stat then
|
2014-10-30 18:42:18 +00:00
|
|
|
return require("device/kobo/device")
|
|
|
|
end
|
|
|
|
|
2015-04-27 11:10:16 +00:00
|
|
|
local pbook_test_stat = lfs.attributes("/ebrmain")
|
|
|
|
if pbook_test_stat then
|
2015-01-09 14:10:25 +00:00
|
|
|
return require("device/pocketbook/device")
|
|
|
|
end
|
|
|
|
|
2020-02-08 00:58:10 +00:00
|
|
|
local remarkable_test_stat = lfs.attributes("/usr/bin/xochitl")
|
|
|
|
if remarkable_test_stat then
|
|
|
|
return require("device/remarkable/device")
|
|
|
|
end
|
|
|
|
|
2018-09-07 23:37:04 +00:00
|
|
|
local sony_prstux_test_stat = lfs.attributes("/etc/PRSTUX")
|
|
|
|
if sony_prstux_test_stat then
|
|
|
|
return require("device/sony-prstux/device")
|
|
|
|
end
|
|
|
|
|
2018-10-31 22:48:36 +00:00
|
|
|
local cervantes_test_stat = lfs.attributes("/usr/bin/ntxinfo")
|
|
|
|
if cervantes_test_stat then
|
|
|
|
return require("device/cervantes/device")
|
|
|
|
end
|
|
|
|
|
2015-01-09 14:10:25 +00:00
|
|
|
-- add new ports here:
|
2016-02-10 07:01:52 +00:00
|
|
|
--
|
|
|
|
-- if --[[ implement a proper test instead --]] false then
|
|
|
|
-- return require("device/newport/device")
|
|
|
|
-- end
|
2015-01-09 14:10:25 +00:00
|
|
|
|
2018-03-14 16:00:01 +00:00
|
|
|
error("Could not find hardware abstraction for this platform. If you are trying to run the emulator, please ensure SDL is installed.")
|
2014-10-30 18:42:18 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local dev = probeDevice()
|
|
|
|
dev:init()
|
|
|
|
return dev
|