BeagleBone Black 板载 4 个 LED(USER LED),默认是以下功能:
- USER0 – 心跳指示
- USER1 – SD 卡读写指示
- USER2 – 活动指示
- USER3 – eMMC 读写指示
有时晚上觉着它闪的太亮了想关掉,这里说下怎么配置。
BeagleBone Black Built-In LEDs
我的环境是:BeagleBone Black + Ubuntu 20.04,4 个 LED 可以在 /sys/class/leds/ 目录下查看。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ ll /sys/class/leds/
lrwxrwxrwx 1 root root 0 Jan 1 2000 beaglebone:green:usr0 -> ../../devices/platform/leds/leds/beaglebone:green:usr0/
lrwxrwxrwx 1 root root 0 Jan 1 2000 beaglebone:green:usr1 -> ../../devices/platform/leds/leds/beaglebone:green:usr1/
lrwxrwxrwx 1 root root 0 Jan 1 2000 beaglebone:green:usr2 -> ../../devices/platform/leds/leds/beaglebone:green:usr2/
lrwxrwxrwx 1 root root 0 Jan 1 2000 beaglebone:green:usr3 -> ../../devices/platform/leds/leds/beaglebone:green:usr3/
$ ll /sys/class/leds/beaglebone:green:usr0/
-rw-r--r-- 1 root root 4.0K Jun 12 15:14 brightness
lrwxrwxrwx 1 root root 0 Jun 12 15:14 device -> ../../../leds/
-r--r--r-- 1 root root 4.0K Jun 12 15:14 max_brightness
drwxr-xr-x 2 root root 0 Jun 12 15:14 power/
lrwxrwxrwx 1 root root 0 Jan 1 2000 subsystem -> ../../../../../class/leds/
-rw-r--r-- 1 root root 0 Jun 12 15:26 trigger
-rw-r--r-- 1 root root 4.0K Jan 1 2000 uevent
- brightness – 当前亮度
- max_brightness – 最大亮度
- trigger – 触发原因,
cat trigger
用来查看当前的触发原因,中括号所在表示其当前的触发点。
1
2
$ cat trigger
none usb-gadget usb-host rfkill-any rfkill-none kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock mmc1 timer oneshot disk-activity disk-read disk-write ide-disk mtd nand-disk [heartbeat] backlight gpio cpu cpu0 activity default-on panic netdev mmc0 4a101000.mdio:00:link 4a101000.mdio:00:100Mbps 4a101000.mdio:00:10Mbps
因此,想要关闭某个 LED,把 trigger 改掉就行:echo none > trigger
,想手动触发时,再写入 brightness:while true; do echo 255 > brightness ; sleep 1; echo 0 > brightness; sleep 1; done;