blob: d82733e5e170e335a78947d9a666abe357fd2800 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/bin/sh
set -e
SLOT=$1
MODE=$2
GPIO_CHIP=$(basename "/sys/bus/i2c/devices/28-0024/"*gpiochip*)
if [ "$MODE" = "main" ]
then
gpio_val=1
elif [ "$MODE" = "aux" ]
then
gpio_val=0
else
echo "Mode must be either main or aux instead of \"$MODE\"."
exit 255
fi
if test -z "$SLOT"
then
echo "Slot number(1st parameter) is required."
exit 255
elif [ "$SLOT" -gt 4 ]
then
echo "Slot number must between 1~4."
exit 255
fi
# nic1~4 = gpio pin 4~7
gpio_pin=$(( SLOT + 3 ))
gpioset "$GPIO_CHIP" $gpio_pin=$gpio_val
exit 0
|