ASUS Laptop 上的 LED

我這台 ASUS 的 Laptop M24NE C5PDR 上面有四個 LED 燈,分別代表了 power,
battery, email, wireless ,在使用 windows driver 時會自動控制這幾個燈
號,很幸運的,從 Linux 下面也可以透過 asus_acpi 控制這幾個燈號,例如要
讓 email 燈亮,只要 echo 1 > /proc/acpi/asus/mled 就可以,所以我分
別設定了有新郵件時,讓 mled 亮,搜尋到 AP 時,讓 wled 亮,非常的方便
😉

底下是 wifi led 設定 script:

#!/bin/sh
#set -x
WIFI_STATE#a71d5d;">=off
TOGGLE#a71d5d;">=false
#62a35c;">trap 'leave' INT QUIT TERM

#795da3;">leave()
{
    #62a35c;">echo 0 #a71d5d;">> /proc/acpi/asus/wled
    #62a35c;">echo "Wifi Led Monitor: off"
    #62a35c;">exit 0
}
#a71d5d;">while true
#a71d5d;">do
    #a71d5d;">if #62a35c;">[ `cat /proc/net/wireless #a71d5d;">|sed '1,2d'#a71d5d;">|awk '{print $4}'#a71d5d;">|bc` -gt 0 #62a35c;">]
    #a71d5d;">then
        #a71d5d;">if #62a35c;">[ $WIFI_STATE #a71d5d;">= off #62a35c;">]
        #a71d5d;">then
            WIFI_STATE#a71d5d;">=on
            TOGGLE#a71d5d;">=true
        #a71d5d;">else
            TOGGLE#a71d5d;">=false
        #a71d5d;">fi
    #a71d5d;">elif #62a35c;">[ $WIFI_STATE #a71d5d;">= on #62a35c;">]
    #a71d5d;">then
        WIFI_STATE#a71d5d;">=off
        TOGGLE#a71d5d;">=true
    #a71d5d;">fi

    #a71d5d;">if #62a35c;">[ $TOGGLE #a71d5d;">= true #62a35c;">]
    #a71d5d;">then
        #a71d5d;">if #62a35c;">[ $WIFI_STATE #a71d5d;">= on #62a35c;">]
        #a71d5d;">then
            #62a35c;">echo 1 #a71d5d;">> /proc/acpi/asus/wled
        #a71d5d;">else
            #62a35c;">echo 0 #a71d5d;">> /proc/acpi/asus/wled
        #a71d5d;">fi
    #a71d5d;">fi
    sleep 1
#a71d5d;">done

已發佈

分類:

,

作者:

標籤: