Skip to content
Contents
GuidesOpenWrt

How to trace a router LED or button to its controller in the OpenWrt device tree

Trace the device tree to identify GPIO controllers, key event codes, and I²C LED channels, then verify the physical mappings using reversible observation.

When organizing new board card documentation, record one line for each indicator light and each button. In addition to the names marked on the device body, also note the controller, internal wire or channel number within that controller, effective logic level, and the corresponding device tree or schematic diagram. The same numeric designation across different controllers may refer to entirely different pins.

Follow the board’s device tree to its controller

First, read the DTS of the target device and its included DTSI files, and locate the compatible strings for gpio-leds, gpio-keys, and external LED controllers. When encountering a gpios property, trace to the controller it references, then interpret the subsequent nodes according to the binding specifications for that controller. GPIO_ACTIVE_LOW typically indicates that the signal is active low; the linux,code property within a key node refers to the input event code and should not be interpreted as a GPIO line number.

For example, the common device tree for the Linksys WHW03 connects the three-color LED to the I²C LED driver PCA9633. The channel 2 of the blue subnode describes the output channel of this chip. If directly mapped to SoC GPIO 2, a different signal path will be detected. When cross-referencing source code, simultaneously record repository revisions and board numbers to avoid treating similar-model wiring as physical evidence.

Verify the mapping with observations you can reverse

On the matching board running Linux, read /sys/class/leds and inspect brightness, max_brightness and trigger. Observe which light changes during a known activity. If an input event viewer is available, test a regular button and verify the code reported on press and release. First make sure the button cannot reset the device or restore factory settings. If there is no input device, check the driver and node status before drawing any conclusion about the circuit.

Retain the original bootable image and configuration. When the controller is unclear, polarity has no basis, or only similar hardware photos are available, mark the item as "pending confirmation" and do not individually write values to unknown GPIOs. Only after the read values, code definitions, and physical behavior are consistent, shall the mapping be written into the adaptation submission.

Reference

What to include in your first OpenWrt device support submission

Explore hardware

Comments