Rock It 《Armbian》四

之前《都是檔案惹的禍?》裡,我們提過︰

在 Raspbian 的世界裡,一切都是『檔案』。這是真的嗎?從古早的 Unix 系統開始,就用著一種『統一』unified 的觀點來看待檔案。假如說 『程式』是執行檔很好了解,可是講到『硬體裝置』不過是特殊檔呢?……

就讓我們透過『 Sysfs── 是 Linux 2.6 所提供的一種『虛擬檔案系統』 VFS virtual files system 。這個檔案系統不僅可以把『裝置』 devices 和『驅動程式』 device drivers 的資訊從『核心』 kernel 內部輸出到『使用者空間』 user space ,也可以用來對裝置和驅動程式做『設定』。── 來控制『系統 ACT LED』,與 GPIO 建立聯繫』吧!

# 為什麼一定得是 root 呢?可以只用 sudo 嗎??
sudo -s

echo none > /sys/class/leds/led0/trigger
echo 1 >/sys/class/leds/led0/brightness
echo 0 >/sys/class/leds/led0/brightness
echo 1 >/sys/class/leds/led0/brightness
echo 0 >/sys/class/leds/led0/brightness
exit

 

Ah Ha!!這樣想要有顆『閃爍』的『小星星』,怕是不可得的了,何不閱讀《 Advanced Bash-Scripting Guide 》一下,寫個『 Shell 』程式呢??

─── 《PHYSICAL COMPUTING ︰《二》 GPIO 初探

 

承上篇,燒錄 SPI Flash 時發生的白色 LED 閃閃閃事件,使作者注意到 Armbian 開機後,只是白、紅兩個 LED 亮著,沒有任何用途耶?

rock64@rock64:~cd /sys/class/leds/ rock64@rock64:/sys/class/leds ls
input1::capslock  input1::kana     input1::scrolllock  standby-led
input1::compose   input1::numlock  power-led           usb-switch
rock64@rock64:/sys/class/leds</pre>   <pre class="lang:default decode:true">rock64@rock64:~ cat /sys/class/leds/{standby-led,power-led}/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 oneshot heartbeat default-on 
[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 oneshot heartbeat default-on

 

由於查不到有關說明文件,故而直接考之以『電路圖』呦!

ROCK64_Schematic_v2.0_20171019.pdf

 

這時一目了然,綠色 LED 只是插了電沒的指示燈☺

sudo reboot ︰ 白亮、紅滅、綠亮

sudo poweroff ︰ 白滅、紅滅、綠亮

 

其後於 PINE64 論壇裡偶讀

LED Status Rock64

t4_4t 

Controllable LEDs are red and white LEDs
The green LED is a power supply lamp, it lights up when power is supplied.

 

Lighting can not be controlled.> flash when there is disk activity
I think that it refers to things such as “USB-HDD”, but it can not be done at present.

 

You need to add code to realize the function to the kernel.—-
With the latest Ver dts (4.4.120)
linux, default-trigger = “disk-activity”

 

It already has the above setting.But, the 4.4.xx kernel does not support this keyword(“”disk-activity”).

 

It is supported keyword  at Main-line-kernel (Ver 4.16.xx, ..)
But, this keyword is for activity of “ata-disk”.For this reason, in the current rock64, setting “disk-activity” is meaningless for any kernel.

 

只能莞爾一笑了◎