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:guide-user:base-system:led_configuration [2018/03/03 20:13] – ↷ Page moved from docs:user-guide:base-system:led_configuration to docs:guide-user:base-system:led_configuration bobafetthotmaildocs:guide-user:base-system:led_configuration [2022/02/07 22:45] – [Leds section] clean-up 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 81: Line 81:
   EOF   EOF
   uci commit   uci commit
 +  
 +You can confirm the changes by running ''service led restart''.
  
 ===== Led triggers ===== ===== Led triggers =====
Line 86: Line 88:
  
 ==== 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 95:
 |//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 168:
 |//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 190:
  
 ^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