diff --git a/frontend/device.lua b/frontend/device.lua index 683467226..52765b9d7 100644 --- a/frontend/device.lua +++ b/frontend/device.lua @@ -12,7 +12,7 @@ local function probeDevice() return require("device/kindle/device") end - local kobo_test_stat = lfs.attributes("/bin/kobo_config.sh") or lfs.attributes("/usr/bin/hwdetect.sh") + local kobo_test_stat = lfs.attributes("/bin/kobo_config.sh") or lfs.attributes("/usr/bin/hwdetect.sh") or lfs.attributes("/usr/bin/hwdetect") if kobo_test_stat then return require("device/kobo/device") end diff --git a/frontend/device/kobo/device.lua b/frontend/device/kobo/device.lua index bc6dbe53b..33ba78029 100644 --- a/frontend/device/kobo/device.lua +++ b/frontend/device/kobo/device.lua @@ -987,7 +987,7 @@ function Kobo:otaModel() local model = "kobo" -- Switch to the proper packages on FW 5.x -- NOTE: We don't distribute kobov4 binaries, the omission is on purpose. - if util.fileExists("/usr/bin/hwdetect.sh") then + if util.fileExists("/usr/bin/hwdetect.sh") or util.fileExists("/usr/bin/hwdetect") then model = "kobov5" end return model, "ota" @@ -1174,6 +1174,26 @@ local function getCodeName() std_out:close() end end + -- If that fails, try binary hwdetect (since firmware 5.18) + if not codename then + local std_out_device = io.popen("/usr/bin/hwdetect device-name", "re") + local std_out_branding = io.popen("/usr/bin/hwdetect branding", "re") + local std_out_screen = io.popen("/usr/bin/hwdetect screen-variant", "re") + if std_out_device and std_out_branding and std_out_screen then + local device = std_out_device:read("*line") + local branding = std_out_branding:read("*line") + local screen = std_out_screen:read("*line") + local branding_first = string.sub(branding, 1, 1) + local branding_rest = string.sub(branding, 2) + + branding = string.upper(branding_first) .. branding_rest + codename = device .. branding .. screen + + std_out_device:close() + std_out_branding:close() + std_out_screen:close() + end + end return codename end diff --git a/platform/kobo/koreader.sh b/platform/kobo/koreader.sh index 0d87b7ef2..7aff47e07 100755 --- a/platform/kobo/koreader.sh +++ b/platform/kobo/koreader.sh @@ -250,7 +250,16 @@ if [ -z "${PRODUCT}" ]; then fi if [ -z "${PRODUCT}" ]; then - PRODUCT="$(/usr/bin/hwdetect.sh 2>/dev/null)" + # FW >= 5.18 uses a binary hwdetect instead of the hwdetect.sh script. If hwdetect is available, we can use + # utils.sh for convenience. + if [ -e "/usr/bin/hwdetect" ]; then + # shellcheck disable=SC1091 + . /usr/libexec/platform/utils.sh + PRODUCT="$(get_product_name)" + else + PRODUCT="$(/usr/bin/hwdetect.sh 2>/dev/null)" + fi + export PRODUCT fi diff --git a/platform/kobo/nickel.sh b/platform/kobo/nickel.sh index d50282fdb..a8b75c19d 100755 --- a/platform/kobo/nickel.sh +++ b/platform/kobo/nickel.sh @@ -20,7 +20,16 @@ unset FBINK_FORCE_ROTA # kobo v5 animation is originally done in display-init, we copy the neccessary parts here. if [ -e "/etc/init.d/display-init.sh" ]; then - PRODUCT=$(hwdetect.sh) + # FW >= 5.18 uses a binary hwdetect instead of the hwdetect.sh script. If hwdetect is available, we can use + # utils.sh for convenience. + if [ -e "/usr/bin/hwdetect" ]; then + # shellcheck disable=SC1091 + . /usr/libexec/platform/utils.sh + PRODUCT="$(get_product_name)" + else + PRODUCT=$(hwdetect.sh) + fi + export PRODUCT echo "Starting boot animation..." animator.sh /etc/images/"${PRODUCT}"-on-*.raw.gz & @@ -145,6 +154,9 @@ if [ -e "/etc/init.d/z-nickel-hardware-status" ]; then if grep "pulseaudio" "/etc/rc.local"; then killall pulseaudio fi + if grep "speech-dispatcher" "/etc/rc.local"; then + killall speech-dispatcher + fi /etc/init.d/z-nickel-hardware-status sync /etc/rc.local