1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
--[[
Configuration file for qcontrol (LUA syntax)
Supports the HP Media Vault mv2120.
--]]
register("system-status")
function system_status( status )
logprint("System status: "..status)
if status == "start" then
-- Nothing...
elseif status == "stop" then
-- Nothing
else
logprint("Unknown system status")
end
end
-- Requires CONFIG_KEYBOARD_GPIO enabled in the kernel and
-- the kernel module gpio_keys to be loaded.
-- Different kernel versions use platform-gpio_keys-event or
-- platform-gpio-keys-event, find the right one.
function find_device( options )
for index,option in ipairs(options) do
local f=io.open(option)
if f then
f:close()
return option
end
end
return nil
end
evdev = find_device ( { "/dev/input/by-path/platform-gpio_keys-event",
"/dev/input/by-path/platform-gpio-keys-event" } )
if evdev then
logprint("Register evdev on "..evdev)
register("evdev", evdev,
116, "power_button",
408, "restart_button")
else
logprint("No evdev device found")
end
function power_button( time )
os.execute("poweroff")
end
function restart_button( time )
os.execute("reboot")
end
confdir("/etc/qcontrol.d")
--
-- Local variables:
-- mode: lua
-- indent-level: 8
-- End:
|