diff --git a/frontend/ui/elements/common_settings_menu_table.lua b/frontend/ui/elements/common_settings_menu_table.lua index 556bc9654..51097460f 100644 --- a/frontend/ui/elements/common_settings_menu_table.lua +++ b/frontend/ui/elements/common_settings_menu_table.lua @@ -11,6 +11,19 @@ local T = require("ffi/util").template local common_settings = {} +if Device:isCervantes() then + local util = require("util") + if util.pathExists("/usr/bin/restart.sh") then + common_settings.start_bq = { + text = T(_("Start %1 reader app"), "BQ"), + callback = function() + UIManager:quit() + UIManager._exit_code = 87 + end, + } + end +end + if Device:hasFrontlight() then local ReaderFrontLight = require("apps/reader/modules/readerfrontlight") common_settings.frontlight = { diff --git a/frontend/ui/elements/filemanager_menu_order.lua b/frontend/ui/elements/filemanager_menu_order.lua index 9847439d6..418b02df8 100644 --- a/frontend/ui/elements/filemanager_menu_order.lua +++ b/frontend/ui/elements/filemanager_menu_order.lua @@ -149,6 +149,7 @@ local order = { "poweroff", -- if Device:isKobo() "reboot", -- if Device:isKobo() "----------------------------", + "start_bq", "exit", } } diff --git a/frontend/ui/elements/reader_menu_order.lua b/frontend/ui/elements/reader_menu_order.lua index 678b91833..31e56a884 100644 --- a/frontend/ui/elements/reader_menu_order.lua +++ b/frontend/ui/elements/reader_menu_order.lua @@ -172,6 +172,7 @@ local order = { "poweroff", -- if Device:isKobo() "reboot", -- if Device:isKobo() "----------------------------", + "start_bq", "exit", } } diff --git a/platform/cervantes/koreader.sh b/platform/cervantes/koreader.sh index ebd3c56b1..ea6774f31 100755 --- a/platform/cervantes/koreader.sh +++ b/platform/cervantes/koreader.sh @@ -73,7 +73,7 @@ fi # check if QBookApp was started before us, then # restart the application after leaving KOReader export STANDALONE="true" -if pkill -0 QBookpp; then +if pkill -0 QBookApp; then STANDALONE="false" fi @@ -86,6 +86,7 @@ fi # any number lower than that will exit this script. RESTART_KOREADER=85 ENTER_USBMS=86 +ENTER_QBOOKAPP=87 RETURN_VALUE="${RESTART_KOREADER}" # Loop forever until KOReader requests a normal exit. @@ -105,6 +106,19 @@ while [ "${RETURN_VALUE}" -ge "${RESTART_KOREADER}" ]; do safemode storage --force 2>/dev/null # waiting forever for home button events. + + elif [ "${RETURN_VALUE}" -eq "${ENTER_QBOOKAPP}" ]; then + # iface is down and wpa killed. Start connman + [ -x /etc/init.d/connman ] && /etc/init.d/connman start + + # (re)start the reading application in the background + restart.sh >/dev/null 2>&1 + sleep 2 + + # loop while BQ app is running. + while pkill -0 QBookApp; do + sleep 10 + done fi done