mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
Terminal: Make sure devpts is mounted on Kobo (#8998)
* Terminal: Make sure devpts is mounted on Kobo Fix #8986
This commit is contained in:
@@ -195,13 +195,15 @@ function AutoSuspend:_schedule_standby()
|
||||
end
|
||||
|
||||
-- When we're in a state where entering suspend is undesirable, we simply postpone the check by the full delay.
|
||||
local standby_delay = self.auto_standby_timeout_seconds
|
||||
local standby_delay
|
||||
if NetworkMgr:isWifiOn() then
|
||||
-- Don't enter standby if wifi is on, as this will break in fun and interesting ways (from Wi-Fi issues to kernel deadlocks).
|
||||
--logger.dbg("AutoSuspend: WiFi is on, delaying standby")
|
||||
standby_delay = self.auto_standby_timeout_seconds
|
||||
elseif Device.powerd:isCharging() and not Device:canPowerSaveWhileCharging() then
|
||||
-- Don't enter standby when charging on devices where charging prevents entering low power states.
|
||||
--logger.dbg("AutoSuspend: charging, delaying standby")
|
||||
standby_delay = self.auto_standby_timeout_seconds
|
||||
else
|
||||
local now_tv = UIManager:getElapsedTimeSinceBoot()
|
||||
standby_delay = self.auto_standby_timeout_seconds - (now_tv - self.last_action_tv):tonumber()
|
||||
|
||||
@@ -25,6 +25,15 @@ int tcflush(int fd, int queue_selector) __attribute__((nothrow, leaf));
|
||||
]]
|
||||
|
||||
local function check_prerequisites()
|
||||
-- We of course need to be able to manipulate pseudoterminals,
|
||||
-- but Kobo's init scripts fail to set this up...
|
||||
if Device:isKobo() then
|
||||
os.execute([[if [ ! -d "/dev/pts" ] ; then
|
||||
mkdir -p /dev/pts
|
||||
mount -t devpts devpts /dev/pts
|
||||
fi]])
|
||||
end
|
||||
|
||||
local ptmx = C.open("/dev/ptmx", bit.bor(C.O_RDWR, C.O_NONBLOCK, C.O_CLOEXEC))
|
||||
if ptmx == -1 then
|
||||
logger.warn("Terminal: can not open /dev/ptmx:", ffi.string(C.strerror(ffi.errno())))
|
||||
|
||||
Reference in New Issue
Block a user