mirror of https://github.com/koreader/koreader
commit
f4cd12a48c
@ -1 +1 @@
|
|||||||
Subproject commit 50baead13c61a4c9a81f0b90f348879f49653530
|
Subproject commit 00749f6861372dbebcc7cf464402a90bb2f9c47e
|
@ -0,0 +1,18 @@
|
|||||||
|
-- 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)
|
Loading…
Reference in New Issue