27 lines
609 B
Bash
Executable File
27 lines
609 B
Bash
Executable File
#!/bin/sh
|
|
|
|
GPIO_PIN=4
|
|
GPIO_PATH="/sys/class/gpio/gpio$GPIO_PIN"
|
|
|
|
case "$1" in
|
|
poweron)
|
|
echo $GPIO_PIN > /sys/class/gpio/export
|
|
echo out > $GPIO_PATH/direction
|
|
echo 1 > $GPIO_PATH/value
|
|
echo host > /sys/devices/platform/ff3e0000.usb2-phy/otg_mode
|
|
;;
|
|
poweroff)
|
|
echo $GPIO_PIN > /sys/class/gpio/export
|
|
echo 0 > $GPIO_PATH/value
|
|
echo $GPIO_PIN > /sys/class/gpio/unexport
|
|
echo otg > /sys/devices/platform/ff3e0000.usb2-phy/otg_mode
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {poweron|poweroff}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|
|
|