Control Gateway GPIOs & LEDs
1. Products LEDs Mapping
| Model | OS | Global LED | PWR LED | LAN LED | WAN LED | WIFI LED | SENSOR LED | 4G control (Second +3.3v) | USB POWER (+5v) Control |
|---|---|---|---|---|---|---|---|---|---|
| LPS8 | Openwrt | GPIO28(BLUE), GPIO21(RED), GPIO22(GREEN ) | +3.3v | GPIO17(RED) | |||||
| LPS8N | Openwrt | GPIO28(BLUE), GPIO21(RED), GPIO22(GREEN ) | +3.3v | GPIO17(RED) | GPIO16(BLUE), GPIO26(RED), GPIO27(GREEN ) | GPIO15 | |||
| LG308 | Openwrt | GPIO28(RED) | +3.3v | GPIO13(RED) | GPIO17(RED) | GPIO0(RED) | GPIO15 | GPIO1 | |
| DLOS8 | Openwrt | GPIO28(GREEN) | +3.3v | GPIO17(GREEN) | GPIO0(GREEN) | GPIO15 | GPIO1 | ||
| HP0C LPS8V2 | Armbian | PA8(GREEN), PA9(RED ) | +3.3v | EPHY-LINK-LED(GREEN), PA17(BLUE) | PA7(RED ) | ||||
| HP0A | Armbian | PA8(GREEN) | +3.3v | EPHY-LINK-LED | PA9(RED) | PA7(RED) | PA17 | ||
| IBB | Openwrt | GPIO28(GREEN) | +3.3v | GPIO13(GREEN) | GPIO17(GREEN) | GPIO0(GREEN) | SENSOR_LED | GPIO1 | |
| LIG16 | Openwrt | GPIO28(RED) | +3.3v | GPIO22(GREEN) | GPIO17(GREEN) | GPIO0(GREEN) | GPIO21(GREEN) | ||
| MS14N | Openwrt | GPIO28(GREEN) | +3.3v | GPIO13(GREEN) | GPIO17(GREEN) | GPIO0(GREEN) | SENSOR_LED | GPIO1 |
2. Control LEDs & GPIOs
2.1 OpenWrt Base OS
Control a General GPIO:
echo 18 > /sys/class/gpio/export
// Export gpio 18 so we can use it
echo "high" > /sys/class/gpio/gpio18/direction
// Set direction to out and set level to high. Use "low" to set direction to output and level to low
echo 0 > /sys/class/gpio/gpio18/value
// Set output to 0 or 1
echo "in" > /sys/class/gpio/gpio18/direction
// Set GPIO18 as input
cat /sys/class/gpio/gpio18/value
// Get GPIO18 value if set input
Control a GPIO already exported as SYSTEM LEDs .
echo 1 > /sys/class/leds/dragino2\:red\:system/brightness
// Turn On LED dragino2:red:system
echo 0 > /sys/class/leds/dragino2\:red\:system/brightness
// Turn off LED dragino2:red:system
Reference: http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO#gpio-sysfs
Accessible reference: Linux GPIO sysfs interface