Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
docs:user-guide:led_configuration [2017/06/06 15:43] – [Net filter] jamest42docs:guide-user:base-system:led_configuration [2022/02/07 22:52] – [How to add Leds to this section] added luci reference palebloodsky
Line 1: Line 1:
-====== Led configuration ====== +====== LED Configuration ====== 
-The Led configuration is located in **system** uci subsystem, and written in the **///etc/config/system//** file.+The LED configuration is located in **system** uci subsystem, and written in the **///etc/config/system//** file.
  
-===== Leds section ===== +===== Led section ===== 
-The leds section contains settings that apply to non-default leds\\  +The led section contains settings that apply to non-default leds.\\  
-(default leds are usually "power connected" led"system alive" led, leds showing ethernet port activity and leds showing wifi radio statusTheir settings are defined somewhere else, see development guides)+Default leds are usually power on, ethernet port activity, usb port activity, and wifi radio activity.
  
 This is an example of leds on a tp-link router with usb port. This is an example of leds on a tp-link router with usb port.
Line 34: Line 34:
  
 ===== How to add Leds to this section ===== ===== How to add Leds to this section =====
-All LEDs are represented by entries in the //sys// filesystem. You can check which LEDs are available in the ///sys/class/leds// directory.\\ +All LEDs are represented by entries in the //sys// filesystem. You can check which LEDs are available in the **///sys/class/leds//** directory.\\  
 The name of an entry typically consists of the name of the hardware providing the LED (the router model), the color of the LED, and it’s designation (usually the label on the case).\\  The name of an entry typically consists of the name of the hardware providing the LED (the router model), the color of the LED, and it’s designation (usually the label on the case).\\ 
 Some LEDs can show different colors. In this case, you will find one entry per color. Some LEDs can show different colors. In this case, you will find one entry per color.
Line 40: Line 41:
 tp-link:green:qss     tp-link:green:usb tp-link:green:qss     tp-link:green:usb
 tp-link:green:system  tp-link:green:wlan tp-link:green:system  tp-link:green:wlan
-</code>\\+</code>
  
 The LED can be controlled by various events in the system, which is selected by the //trigger// option. Depending on the trigger, additional options must be specified. The LED can be controlled by various events in the system, which is selected by the //trigger// option. Depending on the trigger, additional options must be specified.
Line 81: Line 82:
   EOF   EOF
   uci commit   uci commit
 +  
 +You can confirm the changes by running ''service led restart''.
  
 +Basic led configuration is also available via LuCI on the System > LED Configuration page.
 ===== Led triggers ===== ===== Led triggers =====
 Now we explain in detail what each trigger does. Now we explain in detail what each trigger does.
  
 ==== None ==== ==== None ====
-The LED is always in default state. Unlisted LED are default OFF, so this is only useful to declare LED to be always ON.+The LED is always in default state. Unlisted LEDs are default OFF, so this is only useful to declare an LED to be always ON.
  
 ^Name       ^Type   ^Required^Default   ^Description                                                 ^ ^Name       ^Type   ^Required^Default   ^Description                                                 ^
Line 93: Line 97:
 |//trigger//|string |yes     |//(none)//|//none//                                                    | |//trigger//|string |yes     |//(none)//|//none//                                                    |
  
 +==== Switch Connectivity ====
 +The LED is on if a link on one of the configured switch ports is established. 
 +
 +^Name         ^Type   ^Required^Default   ^Description                                                    ^
 +|//default//  |integer|no      |0         |LED state before trigger: //0// means OFF and //1// means ON   |
 +|//sysfs//    |string |yes     |//(none)//|LED device name                                                |
 +|//port_mask//|integer|no      |0         |Hexadecimal bit mask that encodes the regarded switch ports    |
 +|//speed_mask//|integer |no    |//(none)//|Hexadecimal bit mask that filters ethernet speeds              |
 +|//trigger//  |string |yes     |//(none)//|//switch0//                                                    |
 +
 +Consider for example a ''port_mask'' of ''0x1e'', which is ''00011110'' in binary. From right to left, this excludes CPU, includes four switch ports and sets the remaining bits to 0 to exclude further ports (e.g. because there are no more physical ports).
 +
 +''speed_mask'' assigns a bit for standard BASE-T speeds. With this it's possible to trigger an LED only on specific speeds, for example amber for 100mbps and green for gigabit.
 +
 +Bit assignments for ''speed_mask'' are as follows:
 +  * [0] 0x01 - Unknown speed or cable/link problem
 +  * [1] 0x02 - 10BASE-T
 +  * [2] 0x04 - 100BASE-T
 +  * [3] 0x08 - 1000BASE-T
 +  * bits 4-7 reserved for future expansion and dont do anything.
 +
 +For example a ''speed_mask'' of ''0x0C'', which is ''00001100'' in binary, will only trigger the LED when the speed is 100BASE-T or 1000BASE-T. We can then apply the inverse ''0x03'' (binary ''00000011'') to another LED, effectively getting different colors/leds to flash depending on the connection speed.
 ==== Timer ==== ==== Timer ====
 The LED blinks with the configured on/off frequency.\\ The LED blinks with the configured on/off frequency.\\
Line 144: Line 170:
 |//sysfs//  |string |yes     |//(none)//|LED device name                                                | |//sysfs//  |string |yes     |//(none)//|LED device name                                                |
 |//trigger//|string |yes     |//(none)//|//netdev//                                                     | |//trigger//|string |yes     |//(none)//|//netdev//                                                     |
 +|//interval//|integer|no     |//(none)//|The duration of the LED blink in milliseconds. For example: //50//|
  
 ==== WiFi Activity triggers ==== ==== WiFi Activity triggers ====
Line 165: Line 192:
  
 ^Name        ^Type   ^Required^Default   ^Description                                                 ^ ^Name        ^Type   ^Required^Default   ^Description                                                 ^
-|//default// |integer|no      |0         |LED state before trigger: //0// means OFF and //1// means ON| +| //default//    | integer   | no    | 0            | LED state before trigger: //0// means OFF and //1// means ON   
-|//dev//     |string |yes     |//(none)//|Name of USB device to monitor (in this example //1-1//).    +| //dev//        | string    | yes   | //(none)//   | Name of USB device to monitor (in this example //1-1//).       
-|//interval//|integer|yes     |//(none)//|Interval in ms when device is active.                       +| //interval//   | integer   | yes   | //(none)//   | Interval in ms when device is active.                          
-|//sysfs//   |string |yes     |//(none)//|LED device name                                             +| //sysfs//      | string    | yes   | //(none)//   | LED device name                                                
-|//trigger// |string |yes     |//(none)//|//usbdev//                                                  |+| //trigger//    | string    | yes   | //(none)//   | //usbdev -- **//This may be ''usbport'' (March 2019)//**//     |
  
-To find out device name use //logread// to search for it or list ///sys/bus/usb/devices// (for this example, there would be ///sys/bus/usb/devices/1-1// device). +To find out device name use //logread// to search for it or list ///sys/bus/usb/devices// (for this example, there would be ///sys/bus/usb/devices/1-1// device). \\ 
- +Within lets say ///sys/bus/usb/devices/1-1//, you should have a **manufacturer** and **product** files, simply use ''cat'' to reveal their contents, which will help identify the device.
-==== Morse Code ==== +
-The LED signals a message using Morse code. +
-If not installed already, install it with: +
-<code>root@lede:/# opkg install kmod-ledtrig-morse</code> +
- +
-^Name       ^Type   ^Required^Default   ^Description                                                 ^ +
-|//default//|integer|no      |0         |LED state before trigger: //0// means OFF and //1// means ON| +
-|//delay//  |integer|no      |150       |Dit length in milliseconds                                  | +
-|//dev//    |string |yes     |//(none)//|Name of USB device to monitor (in this example //1-1//).    | +
-|//message//|string |no      |//(none)//|The message to signal                                       | +
-|//sysfs//  |string |yes     |//(none)//|LED device name                                             | +
-|//trigger//|string |yes     |//(none)//|//morse//                                                   |+
  
 ==== GPIO ==== ==== GPIO ====
  • Last modified: 2022/02/07 22:54
  • by palebloodsky