How to Control User-Defined LEDs on the EG5200 via Command Line

How to Control User-Defined LEDs on the EG5200 via Command Line

Overview

This guide is for users of the Robustel EG5200 gateway who want to use the user1 and user2 LEDs as custom indicators. You may be in a scenario where you need a visual cue for a specific application status, script success, or network event. By default, these LEDs may be controlled by other system processes. This document provides the step-by-step commands to take manual control of these LEDs to turn them on, turn them off, or make them blink based on system triggers.

What You'll Need

  • Hardware List:
    • 1 x Robustel EG5200 Gateway
    • 1 x Power supply for the gateway
    • 1 x PC with an Ethernet cable or console cable
  • Software/Firmware:
    • RobustOS Pro firmware (any version supporting /sys/class/leds/ control)
    • An SSH client (like PuTTY) or terminal access to the gateway's command line interface (CLI).
    • Administrator (root) or Sudo access to the gateway's CLI and Web UI.
  • Other Precautions:
    • LED status configured manually via the command line will not persist after the gateway is rebooted. If you require persistent control, these commands must be added to a startup script.

Step-by-Step Configuration Guide

Step 1: Disable System LED Control in the Web UI

Before you can control the LEDs from the command line, you must first release them from any system-level control via the Web UI.

  1. Log in to the EG5200's Web UI.
  2. Navigate to the LED configuration page
  3. Locate the settings for Service-Advanced-System
  4. Set the User LED Type to "none".
  5. Click "Submit" or "Save" to apply the changes.

Step 2: Access the Gateway's Command Line (CLI)
  1. Connect to your EG5200 gateway using an SSH client (e.g., PuTTY) or via the console port.
  2. Log in using your root credentials.
  3. All LED control nodes are located in the /sys/class/leds/ directory.
Step 3: Define Variable and Turn LED On / Off

To simplify operations, we will first define a variable. We will use user1 for all examples.

  1. Define the LED name as a variable:
LED_NAME=user1   # or use LED_NAME=user2
  1. To Turn the LED ON:
    • First, disable any active trigger to switch to manual mode:
echo none > /sys/class/leds/${LED_NAME}/trigger
    • Second, set the brightness to 1 (ON):
echo 1 > /sys/class/leds/${LED_NAME}/brightness
  1. To Turn the LED OFF:
    • Ensure the trigger is still set to none.
    • Set the brightness to 0 (OFF):
echo 0 > /sys/class/leds/${LED_NAME}/brightness
Step 4: Configure Advanced LED Triggers

You can also set the LEDs to react to system events, such as a timer (blinking) or network activity.

  1. To Make the LED Blink (Timer Trigger):
    • Set the trigger to timer:
echo timer > /sys/class/leds/${LED_NAME}/trigger
    • Set the "on" duration in milliseconds (e.g., 1000ms):
echo 1000 > /sys/class/leds/${LED_NAME}/delay_on
    • Set the "off" duration in milliseconds (e.g., 1000ms):
echo 1000 > /sys/class/leds/${LED_NAME}/delay_off
    • This will result in the LED blinking with a 1-second on, 1-second off pattern.
  1. To Trigger the LED by Network Interface Activity:
    • Set the trigger to netdev (network device):
echo netdev > /sys/class/leds/${LED_NAME}/trigger
    • Specify the network interface to monitor (e.g.,wwan0):
echo wwan0 > /sys/class/leds/${LED_NAME}/device_name
    • Choose which activity to monitor. You can enable one or more:
    • Trigger on packet transmit (tx):
echo 1 > /sys/class/leds/${LED_NAME}/tx
    • Trigger on packet receive (rx):
echo 1 > /sys/class/leds/${LED_NAME}/rx
    • Trigger on network link status (link):
echo 1 > /sys/class/leds/${LED_NAME}/link

Verification & Testing

You can verify your configuration by observing the physical user1 or user2 LED on the front panel of the EG5200.

  • For Manual On/Off:
    • Run the command:echo 1 > /sys/class/leds/user1/brightness
    • Success: The user1 LED on the device should immediately light up and stay solid.
    • Run the command:echo 0 > /sys/class/leds/user1/brightness
    • Success: The user1 LED on the device should immediately turn off.
  • For Timer (Blinking):
    • Run the timer commands from Step 4.
    • Success: The user1 LED should immediately begin blinking at the interval you specified (e.g., 1 second on, 1 second off).
  • For Network Activity:
    • Run the netdev commands from Step 4, using wwan0 and enabling tx and rx.
    • Generate some cellular traffic (e.g., run a ping command to an internet address:ping 8.8.8.8).
    • Success: The user1 LED should flash in sync with the transmit and receive packets over the wwan0 interface.

Below is an example of the CLI commands being executed successfully:

Bash

root@Router:~# # Example: Turn on user1 LED
root@Router:~# echo none > /sys/class/leds/user1/trigger
root@Router:~# echo 1 > /sys/class/leds/user1/brightness

root@Router:~# # Example: Make user1 LED blink
root@Router:~# echo timer > /sys/class/leds/user1/trigger
root@Router:~# echo 1000 > /sys/class/leds/user1/delay_on
root@Router:~# echo 1000 > /sys/class/leds/user1/delay_off

root@Router:~# # Example: Make user1 blink on wwan0 activity
root@Router:~# echo netdev > /sys/class/leds/user1/trigger
root@Router:~# echo wwan0 > /sys/class/leds/user1/device_name
root@Router:~# echo 1 > /sys/class/leds/user1/tx
root@Router:~# echo 1 > /sys/class/leds/user1/rx

Troubleshooting / FAQ

Q: I ran the commands, but the LED is not changing. What's wrong?

A: The most common reason is that a system process still has control of the LED. Double-check Step 1 and ensure the "User LED" setting in the Web UI is set to "none". After setting it to "none", save and apply the changes, and then try the command line steps again.

Q: My LED settings disappeared after I rebooted the gateway. How do I make them permanent?

A: These command-line settings are not saved to non-volatile memory and will be lost on reboot. To make them permanent, you must add the desired echo commands to a custom startup script. This can often be done in the Web UI under a "System" or "Custom Scripts" section.

Q: Can I control the other LEDs, like 'run' or 'rssi'?

A: No. The run,rssi,modem, and vpn LEDs are typically hard-coded to system functions and are not intended for user control. This guide only applies to the user1 and user2 LEDs.

Q: I set the trigger to 'timer', but now I want to turn the LED off manually. How?

A: You must first set the trigger back to none before you can manually control the brightness.

# Set trigger back to manual
echo none > /sys/class/leds/user1/trigger
# Now you can turn it off
echo 0 > /sys/class/leds/user1/brightness

Revision History

Version

Date

Author

Changes

1.0

2025-10-24

Hubery

Initial document creation.


    • Related Articles

    • How to Set NTP via Command Line

      Understanding the Configuration Structure First, it's helpful to understand how to access the complete configuration structure: 1. You can download the XML configuration from: Web UI → System → Profile → XML Configuration File → Generate → Download ...
    • How to create a sudo user with SSH access on an EG series device?

      Overview For security and user management purposes, it is often necessary to create a non-root user that still has administrative privileges. This guide provides instructions on how to create a sudo user on a Robustel gateway running RobustOS Pro. ...
    • How to obtain and set DIDO in one's own application on the EG series devices?

      Overview When using Robustel's EG series gateways (like the EG5120 or EG3110) running RobustOS Pro, you often need to interact with the physical world through Digital Inputs (DI) and Digital Outputs (DO). For instance, you might need to read the ...
    • How to Control Digital Output (DO) via SMS

      Overview Remote control of Digital Outputs (DOs) offers flexibility and convenience in managing connected devices. One commmon method is through a centralized management system, such as RCMS, which provides a web-based interface to monitor and ...
    • How to install the MQTT broker service on EG series devices?

      Overview This article provides a step-by-step guide for installing and configuring the Mosquitto MQTT broker on a Robustel EG series gateway (e.g., EG5120, EG5200) running RobustOS Pro. This setup is ideal for scenarios where you need a reliable, ...