#------------------------------------------------------------------------------ # /etc/rc.d/rc995.hwsupp - init buttons __FLI4LVER__ # # Creation: 11.10.2014 cspiess # Last Update: $Id$ #------------------------------------------------------------------------------ if [ "$OPT_HWSUPP" = "yes" ] then # init buttons if [ 0$HWSUPP_BUTTON_N -gt 0 ] then begin_script HWSUPP "init buttons" for i in `seq 1 $HWSUPP_BUTTON_N` do eval device=\$HWSUPP_BUTTON_${i}_DEVICE type=`echo $device | cut -d ':' -f 1` if [ "$type" = "/gpio" ] then activelow=1 fi : ${activelow:=0} case $type in /gpio|gpio) gpio=`echo $device | cut -d ':' -f 3` echo $gpio > /sys/class/gpio/export if [ -d /sys/class/gpio/gpio$gpio ] then echo in > /sys/class/gpio/gpio$gpio/direction echo $activelow > /sys/class/gpio/gpio$gpio/active_low ln -s /sys/class/gpio/gpio$gpio /var/run/hwsuppd/hwsupp-button$i else if [ -d /sys/class/gpio/GPIO$gpio ] then echo in > /sys/class/gpio/GPIO$gpio/direction echo $activelow > /sys/class/gpio/GPIO$gpio/active_low ln -s /sys/class/gpio/GPIO$gpio /var/run/hwsuppd/hwsupp-button$i else log_error "/sys/class/gpio/gpio$gpio or GPIO$gpio not found" fi fi ;; esac done # write hwsupp_cmd { echo "#!/bin/sh" echo "case \$1 in" for i in `seq 1 $HWSUPP_BUTTON_N` do eval action=\$HWSUPP_BUTTON_${i} eval param=\"\$HWSUPP_BUTTON_${i}_PARAM\" echo "$i)" if [ "$action" = "user" ] then echo "$param" else echo /usr/bin/${action}_keyprog $param fi echo ";;" done echo "esac" } > /usr/bin/hwsupp_cmd chmod +x /usr/bin/hwsupp_cmd log_info "starting hardware support daemon ..." hwsuppd -b $HWSUPP_BUTTON_N end_script fi # init buttons fi