pre_checking_hook.sh
Code:
#! /bin/sh
# script for Pre Cheching Hook.
source /etc/upstart/functions
f_log I pre_checking_hook ssd "Stop sshd Deamon"
stop sshd
f_log I pre_checking_hook ssd "End"
f_log I pre_checking_hook custom_login "mntroot rw"
mntroot rw
f_log I pre_checking_hook custom_login "Pushing new custom_login"
echo "#! /bin/sh
echo '--- SORRY, LOGIN IS DISABLED ON DEVICE ---'
# Disable Ctrl-C
trap '' 2
# Sleep indefinitely
while true; do sleep 86400; done" > /etc/upstart/custom-login
sync
f_log I pre_checking_hook custom_login "mntroot ro"
mntroot ro
sleep 1
f_log I pre_checking_hook custom_login "End"
post_checking_hook.sh :
Code:
#! /bin/sh
# script for post Cheching Hook.
source /etc/upstart/functions
f_log I post_checking_hook "Disable all PMIC interrupts-1"
i2cutil -d /dev/i2c/0 -w 0x4b 0x8b 0
i2cutil -d /dev/i2c/0 -w 0x4b 0x8c 0
i2cutil -d /dev/i2c/0 -w 0x4b 0x8d 0
sleep 1
f_log I post_checking_hook "Disable all PMIC interrupts-2"
i2cutil -d /dev/i2c/0 -w 0x4b 0x8e 0
i2cutil -d /dev/i2c/0 -w 0x4b 0x8f 0
i2cutil -d /dev/i2c/0 -w 0x4b 0x90 0
sleep 1
f_log I post_checking_hook "Disable all PMIC interrupts-3"
i2cutil -d /dev/i2c/0 -w 0x4b 0x91 0
i2cutil -d /dev/i2c/0 -w 0x4b 0x92 0
i2cutil -d /dev/i2c/0 -w 0x4b 0x93 0
sleep 1
f_log I post_checking_hook "Disable all PMIC interrupts-4"
i2cutil -d /dev/i2c/0 -w 0x4b 0x94 0
i2cutil -d /dev/i2c/0 -w 0x4b 0x95 0
i2cutil -d /dev/i2c/0 -w 0x4b 0x96 0
i2cutil -d /dev/i2c/0 -w 0x4b 0xf8 0
sleep 1
f_log I post_checking_hook "Set power key and USB as wakeup source.."
i2cutil -d /dev/i2c/0 -w 0x4b 0xAE 0x3
sleep 1
val=300
while [ $val -gt 250 ]; do
f_log I post_checking_hook "Checking DCIN..."
hihex=`i2cutil -d /dev/i2c/0 -r 0x4b 0x61 2>&1 |cut -d':' -f4`
lohex=`i2cutil -d /dev/i2c/0 -r 0x4b 0x62 2>&1 |cut -d':' -f4`
sleep 1
val1=$(($hihex))
val2=$(($lohex))
val=$(( val1 * 256 + val2 ))
f_log I post_checking_hook "DCIN val=$val * 5mV"
done
f_log I post_checking_hook "DCIN is below threshold"
f_log I post_checking_hook "post_checking_hook completed successfully"
sleep 1