mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 23:42:43 +00:00
base-files: add ucidef_set_led_usbport for full usbport support
This helper allows using usbport trigger directly. It requires usbport compatible syntax and supports specifying multiple USB ports, e.g.: ucidef_set_led_usbport "usb" "USB" "devicename:colour:function" "usb1-port1" "usb2-port1" This adds a proper object to the board.json, e.g. "usb": { "name": "USB", "type": "usbport", "sysfs": "devicename:colour:function", "ports": [ "usb1-port1", "usb2-port1" ] } and supports translating it into uci section. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
This commit is contained in:
parent
32c28a78f7
commit
2187f57db6
@ -335,6 +335,15 @@ generate_led() {
|
||||
EOF
|
||||
;;
|
||||
|
||||
usbport)
|
||||
local ports port
|
||||
json_get_values ports ports
|
||||
uci set system.$cfg.trigger='usbport'
|
||||
for port in $ports; do
|
||||
uci add_list system.$cfg.port=$port
|
||||
done
|
||||
;;
|
||||
|
||||
rssi)
|
||||
local iface minq maxq offset factor
|
||||
json_get_vars iface minq maxq offset factor
|
||||
|
@ -19,6 +19,7 @@ load_led() {
|
||||
config_get name $1 name "$sysfs"
|
||||
config_get trigger $1 trigger "none"
|
||||
config_get dev $1 dev
|
||||
config_get ports $1 port
|
||||
config_get mode $1 mode "link"
|
||||
config_get_bool default $1 default "nil"
|
||||
config_get delayon $1 delayon
|
||||
|
@ -390,6 +390,30 @@ ucidef_set_led_usbdev() {
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_set_led_usbport() {
|
||||
local obj="$1"
|
||||
local name="$2"
|
||||
local sysfs="$3"
|
||||
shift
|
||||
shift
|
||||
shift
|
||||
|
||||
json_select_object led
|
||||
|
||||
json_select_object "$obj"
|
||||
json_add_string name "$name"
|
||||
json_add_string type usbport
|
||||
json_add_string sysfs "$sysfs"
|
||||
json_select_array ports
|
||||
for port in "$@"; do
|
||||
json_add_string port "$port"
|
||||
done
|
||||
json_select ..
|
||||
json_select ..
|
||||
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_set_led_wlan() {
|
||||
local cfg="led_$1"
|
||||
local name="$2"
|
||||
|
Loading…
Reference in New Issue
Block a user