FunKey-OS/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/test-led

27 lines
420 B
Plaintext
Raw Normal View History

#!/bin/sh
if [ $# -ne 1 ];then
echo "ERROR LED ARGS"
exit;
fi
case ${1} in
0) value=0x0a;;
1) value=0x3a;;
*) echo "ERROR LED VALUE"; exit 1;;
esac
# Load I2C modules
modprobe i2c-dev
modprobe i2c-mv64xxx
# Turn on/off the LED
i2cset -y 0 0x34 0x32 ${value}
if [ $? -ne 0 ]; then
echo "ERROR LED I2C"
else
echo "OK"
fi
# Unload I2C modules
modprobe -r i2c_mv64xxx i2c_dev >/dev/null 2>&1