[LINUX] Banana Pi (M1)如何灌系統後,用綠燈閃爍代表讀寫SD卡

重新學習的過程中,做個紀錄和經驗。

Banana Pi的LED綠燈定義放在這個檔案,指令呼叫:
cat /sys/class/leds/bananapi:green:usr/trigger
出現[]的那一欄,表示目前燈號的功能是什麼,如現在是[none]所以燈沒有功能。
[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 usbport disk-activity disk-read disk-write ide-disk mtd nand-disk heartbeat cpu cpu0 cpu1 activity default-on panic mmc0 rc-feedback axp20x-usb-online rfkill-any rfkill-none bluetooth-power hci0-power rfkill0 stmmac-0:01:link stmmac-0:01:1Gbps stmmac-0:01:100Mbps stmmac-0:01:10Mbps

我想要讓有檔案讀取SD記憶卡的時候會有綠燈閃爍,所以指令呼叫:
echo mmc0 > /sys/class/leds/bananapi:green:usr/trigger
輸入後,可以故意下載檔案或用sync指令,看板子的綠燈狀態有變化嗎。

寫在開機時候執行此功能。
nano /etc/rc.local
#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.
## added by JIR 新增在下面這個顯示LED綠燈(SD卡)
echo mmc0 > /sys/class/leds/bananapi:green:usr/trigger
exit 0

存檔後重開機就會有此功能為預設了。

其他參考:
http://blog.ilc.edu.tw/blog/index.php?op=printView&articleId=522909&blogId=25793
https://linux-sunxi.org/LeMaker_Banana_Pi#LEDs

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

請輸入下列驗證碼計算後阿拉伯數字 (Translate it, if not Taiwanese to post reply) *