From 2187f57db6f55d41d68704179d309fbb6199b08e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 19 Oct 2016 13:05:53 +0200 Subject: base-files: add ucidef_set_led_usbport for full usbport support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../base-files/files/lib/functions/uci-defaults.sh | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'package/base-files/files/lib') diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index a88308bbd0..e39b0a5776 100755 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -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" -- cgit v1.2.3