X-Git-Url: https://git.rvb.name/weathermon.git/blobdiff_plain/7edb3771717d15f7c36d8459fa12b3d6f76d7d9a..e32107a7fe79ce34f3bdf860410a6d5455efdca7:/bin/weather-init diff --git a/bin/weather-init b/bin/weather-init new file mode 100755 index 0000000..d009c67 --- /dev/null +++ b/bin/weather-init @@ -0,0 +1,33 @@ +# Put your custom commands here that should be executed once +# the system init finished. By default this file does nothing. + +I2C_BUS=0 +DS3221=68 + +echo heartbeat > /sys/class/leds/linkit-smart-7688:orange\:wifi/trigger + +if [ ! -e /dev/lcdi2c ]; then + insmod lcdi2c busno=0 address=0x27 cursor=0 blink=0 topo=1 +fi + +echo 1 > /sys/class/alphalcd/lcdi2c/clear +echo \00\00 > /sys/class/alphalcd/lcdi2c/position + +if [ ! -e /dev/rtc0 ]; then + + modprobe rtc-ds1307 + echo ds1307 0x$DS3221 > /sys/class/i2c-dev/i2c-$I2C_BUS/device/new_device + sleep 1 + if [ -e /dev/rtc0 ]; then + ln -sf /dev/rtc0 /dev/rtc + logger -t hardware RTC initialized + fi + +fi + +if [ -e /dev/rtc0 ]; then + /sbin/hwclock -u --rtc=/dev/rtc0 --hctosys + echo "Hardware RTC OK" > /dev/lcdi2c +else + echo "Hardware RTC FAIL" > /dev/lcdi2c +fi