如何在运行Linux的Dragonboard 410c上切换LED板载

时间:2018-01-03 23:57:46

标签: shell embedded-linux qualcomm

Dragonboard 410c上有4个小绿色LED指示灯,右侧的心跳指示灯不断闪烁,如何通过命令行切换其他指示灯。

2 个答案:

答案 0 :(得分:3)

首先要注意的是,目前4个LED中有3个是actively being used,但LED_4未使用,可以通过命令行打开

// turn on
echo 1 > /sys/class/leds/apq8016-sbc\:green\:user4/brightness

// turn off
echo 0 > /sys/class/leds/apq8016-sbc\:green\:user4/brightness

答案 1 :(得分:0)

首先要注意的是,如何访问位于两个USB连接器之间的板载LED或用户LED以及可用的数量取决于您所使用的操作系统,Android或Linux。 / p>

对于Android和Linux,用户LED均列在文件夹/sys/class/leds中,因此您可以使用adb实用程序进行远程访问,然后使用ls文件夹查看实际的内容。伪文件名是。

对于这两种方式,您都将更改用户LED伪文件夹中brightness伪文件中的值,以将LED点亮(值为1或熄灭,值为0)。 / p>

还有其他与每个LED关联的伪文件,其中一个为trigger,可用于设置内核事件以触发LED。请参阅Raspberry Pi StackExchange中针对How do I control the system LEDs using my software?的答案。

在Android下,查看trigger中多个伪目录中的几个/sys/class/leds伪文件,得出boot伪目录的以下输出(用户LED 4用于Android的启动指示灯),led1(用户LED 1(Android可用,但Linux不可用)和wlann(LAN活动指示灯)。

root@msm8916_64:/sys/class/leds # cat boot/trigger
none bkl-trigger [boot-indication] usb-online mmc0 mmc1 battery-charging-or-full battery-charging battery-full battery-charging-blink-full-solid wlan-indication-led
root@msm8916_64:/sys/class/leds # cat led1/trigger
[none] bkl-trigger boot-indication usb-online mmc0 mmc1 battery-charging-or-full battery-charging battery-full battery-charging-blink-full-solid wlan-indication-led
root@msm8916_64:/sys/class/leds # cat wlan/trigger
none bkl-trigger boot-indication usb-online mmc0 mmc1 battery-charging-or-full battery-charging battery-full battery-charging-blink-full-solid [wlan-indication-led]

注意:为了对伪文件使用文件I / O,文件许可权必须允许您要使用的访问类型(读,写,读/写)。 LED伪文件的默认设置似乎已被读取,因此需要像chmod中一样使用sudo chmod 777 /sys/class/leds/led1/brightness命令。

https://www.96boards.org/documentation/consumer/dragonboard/dragonboard410c/guides/led-connectors.md.html

USB端口旁边是一系列LED,用于提供 给用户的信息。其用法定义如下:

Debian图片

在安装基于Debian的映像时,下表定义了 LED的使用/行为。

+----------------------+----------------------+--------------------------+
| LED Board Identifier | Description          | Behavior                 |
+----------------------+----------------------+--------------------------+
| User LED 1           | Heartbeat            | Green: This LED is       |
|                      |                      | should always be         |
|                      |                      | blinking about once a    |
|                      |                      | second. If solid off or  |
|                      |                      | solid on, the board is   |
|                      |                      | not executing correctly  |
+----------------------+----------------------+--------------------------+
| User LED 2           | eMMC                 | Green: This LED blinks   |
|                      |                      | during accesses to eMMC  |
+----------------------+----------------------+--------------------------+
| User LED 3           | SD                   | Green: This LED blinks   |
|                      |                      | during accesses to SD    |
|                      |                      | Card                     |
+----------------------+----------------------+--------------------------+
| User LED 4           | currently unassigned | N/A                      |
+----------------------+----------------------+--------------------------+
| Wifi                 | Wifi                 | Yellow: This LED blinks  |
|                      |                      | during network accesses  |
|                      |                      | over Wifi                |
+----------------------+----------------------+--------------------------+
| BT                   | Bluetooth            | Yellow: This LED blinks  |
|                      |                      | when Bluetooth is being  |
|                      |                      | used                     |
+----------------------+----------------------+--------------------------+

Android图片

在安装基于Android的图像时,下表定义了 LED的使用/行为。

+----------------------+----------------------+--------------------------+
| LED Board Identifier | Description          | Behavior                 |
+----------------------+----------------------+--------------------------+
| User LED 1           | currently unassigned | Green:                   |
+----------------------+----------------------+--------------------------+
| User LED 2           | currently unassigned | Green:                   |
|                      |                      |                          |
+----------------------+----------------------+--------------------------+
| User LED 3           | currently unassigned | Green:                   |
|                      |                      |                          |
|                      |                      |                          |
+----------------------+----------------------+--------------------------+
| User LED 4           | Boot                 | This LED illuminates at  |
|                      |                      | at the start of boot     |
|                      |                      | and turns of after       |
|                      |                      | completion of boot.      |
+----------------------+----------------------+--------------------------+
| Wifi                 | Wifi                 | Yellow: TDB              |
+----------------------+----------------------+--------------------------+
| BT                   | Bluetooth            | Yellow: TBD              |
+----------------------+----------------------+--------------------------+

对于Linux,当前4个用户LED中的3个正由OS使用,但是用户LED 4未使用,可以通过以下命令行打开:

// turn on user LED 4 on Linux.
//     use backslash to escape the colon which is part
//     of the pseudo file name of "apq8016-sbc:green:user4".
echo 1 > /sys/class/leds/apq8016-sbc\:green\:user4/brightness

// turn off user LED 4 on Linux
echo 0 > /sys/class/leds/apq8016-sbc\:green\:user4/brightness

对于Android 5.1,4个用户LED中的3个可用。通过路径/sys/class/leds访问用户LED,其中存在三个用户LED的伪文件:led1led2led3。例如,要打开和关闭用户LED 1,请使用以下命令行。对于用户LED 2,将路径中的led1替换为led2,同样,对于用户LED 3,将路径中的led替换为led3

// turn on LED 1 on Android
echo 1 > /sys/class/leds/led1/brightness

// turn off LED 1 Android
echo 0 > /sys/class/leds/led1/brightness