summaryrefslogtreecommitdiff
path: root/recipes-bsp/multitech/mtre-leds/mtre-leds-monitor.sh
blob: 087d8f3142501f2b84e2c40be33624e67713808d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

gpio=/sys/devices/platform/mts-io/reset
#gpio=/tmp/pb

status="0"

while :
do
  usleep 150000
  if [[ -r "$gpio" ]]; then
    read -n 1 val < $gpio
    if [[ ! -z "$val" && "$val" != "$status" ]]; then
        if [[ "$val" == "1" ]]; then
          mtre-leds start-test
          status=$val
        elif [[ "$val" == "0" ]]; then
          mtre-leds stop-test
          status=$val
        fi
    fi
  fi
done