Play the board, light up a light first! There are two lights on the signboard, one is the power light and the other is the status light. After the system is refreshed, the normal startup status light will flash once and again. The default status light is the heartbeat light of the system clock, and it keeps flashing, indicating that the system is operating normally.
Next, let's see how to control this light.
Most of the operating interfaces of the hardware are in /sys/class.
There are ru following directories in the /sys/class/leds directory:
root@NanoPC-T4:/sys/class/leds# ls
input0::capslock input0::numlock input0::scrolllock mmc1:: status_led
Obviously, the status_led directory is used to control the status lights, enter the status_led directory.
root@NanoPC-T4:/sys/class/leds/status_led# ls
brightness device max_brightness power subsystem trigger uevent
The brightness is used to control the on and off of the status light, and the trigger is used to set the trigger condition of the status light:
root@NanoPC-T4:/sys/class/leds/status_led# cat trigger
none rc-feedback kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock mmc0 mmc1 timer [heartbeat] rfkill0 mmc2 rfkill1 rfkill2 rfkill3
Wow, there are so many things...actually these are all trigger conditions. Only the ones selected with [] are currently valid. There are many trigger conditions that can be used to control the status lights, such as kbd-capslock, which is the case of the keyboard. Now it is heartbeart. If we want to control the status light, we need to change the trigger condition to none.
root@NanoPC-T4:/sys/class/leds/status_led# echo none > trigger
root@NanoPC-T4:/sys/class/leds/status_led# cat trigger
[none] rc-feedback kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock mmc0 mmc1 timer heartbeat rfkill0 mmc2 rfkill1 rfkill2 rfkill3
Next, you can use the brightness file to control the status lights.
root@NanoPC-T4:/sys/class/leds/status_led# echo 1 > brightness
root@NanoPC-T4:/sys/class/leds/status_led# echo 0 > brightness
Enter 1 to turn on the light, and enter 0 to turn off the light.
Restore the status light to the original heartbeat light, you should be able to do it.
————————————————
Copyright statement: This article is the original article of the CSDN blogger "Dika Weiman Yiqijun", and it follows the CC 4.0 BY-SA copyright agreement. Please attach it for reprinting. Link to the original source and this statement.
Original link: https://blog.csdn.net/tunqimai9331/article/details/82898752