Try to inhibit USBMS on Kindles (#3957)

re: #3955
pull/3961/head
NiLuJe 6 years ago committed by GitHub
parent 68c1246575
commit 0dbdd2f61f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -83,10 +83,12 @@ function Kindle:setDateTime(year, month, day, hour, min, sec)
end
function Kindle:usbPlugIn()
-- NOTE: We do NOT support running in USBMS mode (we cannot, we live there).
-- And, AFAICT, we have no sane way of disabling USBMS mode without breaking either us or the framework,
-- c.f., https://github.com/koreader/koreader/issues/3220
-- That means shit will blow up in fun and interesting ways if someone actually tries that.
-- NOTE: We cannot support running in USBMS mode (we cannot, we live on the partition being exported!).
-- But since that's the default state of the Kindle system, we have to try to make nice...
-- To that end, we're currently SIGSTOPping volumd to inhibit the system's USBMS mode handling.
-- It's not perfect (f.g., if the system is setup for USBMS and not USBNet,
-- the frontlight will be turned off when plugged in), but it at least prevents users from completely
-- shooting themselves in the foot (c.f., https://github.com/koreader/koreader/issues/3220)!
-- On the upside, we don't have to bother waking up the WM to show us the USBMS screen :D.
-- NOTE: If the device is put in USBNet mode before we even start, everything's peachy, though :).
self.charging_mode = true

@ -42,6 +42,7 @@ fi
# Keep track of what we do with pillow...
export AWESOME_STOPPED="no"
export VOLUMD_STOPPED="no"
PILLOW_HARD_DISABLED="no"
PILLOW_SOFT_DISABLED="no"
PASSCODE_DISABLED="no"
@ -243,6 +244,13 @@ if [ "${STOP_FRAMEWORK}" = "no" ] && [ "${INIT_TYPE}" = "sysv" ]; then
killall -stop cvm
fi
# SIGSTOP volumd, to inhibit USBMS (sysv & upstart)
if [ -e "/etc/init.d/volumd" ] || [ -e "/etc/upstart/volumd.conf" ]; then
logmsg "Stopping volumd . . ."
killall -stop volumd
VOLUMD_STOPPED="yes"
fi
# finally call reader
logmsg "Starting KOReader . . ."
# That's not necessary when using KPVBooklet ;).
@ -292,6 +300,12 @@ if grep ${KOREADER_DIR}/fonts/linkfonts /proc/mounts >/dev/null 2>&1; then
umount ${KOREADER_DIR}/fonts/linkfonts
fi
# Resume volumd, if need be
if [ "${VOLUMD_STOPPED}" = "yes" ]; then
logmsg "Resuming volumd . . ."
killall -cont volumd
fi
# Resume cvm (only if we stopped it)
if [ "${STOP_FRAMEWORK}" = "no" ] && [ "${INIT_TYPE}" = "sysv" ]; then
logmsg "Resuming cvm . . ."

Loading…
Cancel
Save