OpenWRT USB接入时亮灯

Created: June 12, 2018, 11:09 p.m. Updated: June 12, 2018, 11:30 p.m.

改板子增加了USB口的扩展,这时U口的指示灯就对不上了, 在hotplug.d里增加个脚本去亮指定的led灯

#!/bin/sh

echo "1" > /sys/class/leds/led_usb3/brightness    

if [ ! -d "/sys/bus/usb/devices/1-1" ];then       
    echo "0" > /sys/class/leds/led_usb1/brightness
else                                              
    echo "1" > /sys/class/leds/led_usb1/brightness
fi                                           

if [ ! -d "/sys/bus/usb/devices/3-1.1" ];then            
    echo "0" > /sys/class/leds/status_led_pass/brightness
else                                                     
    echo "1" > /sys/class/leds/status_led_pass/brightness
fi

增加了2个USB接口,脚本根据飞线的情况控制对应的led灯