mirror of
https://github.com/koreader/koreader
synced 2024-11-18 03:25:46 +00:00
1e9346aec6
It turns out that the kernel needs a little push now that the dedicated wifi power control module is gone ;). Issue was only exposed if you booted KOReader while the Wi-Fi was down.
19 lines
528 B
Lua
19 lines
528 B
Lua
-- Stupid wrapper so that we can send simple ntx_io ioctls from shell scripts...
|
|
|
|
local ffi = require("ffi")
|
|
local bor = bit.bor
|
|
local C = ffi.C
|
|
|
|
require("ffi/posix_h")
|
|
|
|
assert(#arg == 2, "must pass an ioctl command & an ioctl argument")
|
|
local ioc_cmd = tonumber(arg[1])
|
|
local ioc_arg = tonumber(arg[2])
|
|
|
|
local fd = C.open("/dev/ntx_io", bor(C.O_RDONLY, C.O_NONBLOCK, C.O_CLOEXEC))
|
|
assert(fd ~= -1, "cannot open ntx_io character device")
|
|
|
|
assert(C.ioctl(fd, ioc_cmd, ffi.cast("int", ioc_arg)) == 0, "ioctl failed")
|
|
|
|
C.close(fd)
|