For the light level, I updated it to this, otherwise the light level will not persists after the device goes to sleep:
Code:
menu_item : library : Light On : cmd_output : 500: quiet :/bin/sh -c 'if [ "$(cat /sys/class/backlight/mxc_msp430.0/actual_brightness)" -eq "0" ]; then exit 1; else exit 0; fi'
chain_success:skip:4
chain_failure : cmd_spawn : quiet :ioctl /dev/ntx_io 241 -v 8
chain_success : cmd_spawn : quiet :sed -i '/^## Light Toggle/ { n; s/^\([^:]*:[^:]*:\)[^:]*\(:.*\)$/\1 Light Off \2/ }' /mnt/onboard/.adds/nm/config
chain_success : cmd_spawn : quiet :sed -i-E 's/^FrontLightLevel=[0-9]+/FrontLightLevel=8/' '/mnt/onboard/.kobo/Kobo/Kobo eReader.conf'
chain_always:skip:-1
chain_success : cmd_spawn : quiet :ioctl /dev/ntx_io 241 -v 0
chain_success : cmd_spawn : quiet :sed -i '/^## Light Toggle/ { n; s/^\([^:]*:[^:]*:\)[^:]*\(:.*\)$/\1 Light On \2/ }' /mnt/onboard/.adds/nm/config
chain_success : cmd_spawn : quiet :sed -i-E 's/^FrontLightLevel=[0-9]+/FrontLightLevel=0/' '/mnt/onboard/.kobo/Kobo/Kobo eReader.conf'