Dragonboard 410c 上有 4 个绿色小 LED,右侧的一个心跳一直在闪烁,如何通过命令行切换其他的。
2 回答
首先要注意的是,当前正在使用4 个 LED 中的 3 个,但 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
首先要注意的是,如何访问位于两个 USB 连接器之间的板载 LED 或用户 LED 以及可用的数量取决于您使用的操作系统,Android 或 Linux。
对于 Android 和 Linux,用户 LED 都列在文件夹中,/sys/class/leds
因此您可以使用该adb
实用程序进行远程访问,然后ls
使用该文件夹查看实际的伪文件名是什么。
对于这两者,您将更改brightness
位于用户 LED 的伪文件夹中的伪文件中的值,以打开 LED,值为 1 或关闭,值为 0。
还有其他与每个 LED 相关的伪文件,其中一个trigger
允许您设置内核事件以触发 LED。在 Raspberry Pi StackExchange 中查看如何使用我的软件控制系统 LED?.
在 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
.
位于 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 的图像时,下表定义了 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 个正在被操作系统使用,但用户 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 个可用。用户 LED 可通过/sys/class/leds
三个用户 LED 的伪文件路径访问:led1
、led2
和led3
. 例如,要打开和关闭用户 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