summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2017-01-26 00:08:43 +0100
committerJo-Philipp Wich <jo@mein.io>2017-01-26 00:08:43 +0100
commit1640d141913367827ab442276a943b0a3bba2e20 (patch)
tree999b94f586b37beb46db52a6f3b9ee8d97088e7c /modules/luci-mod-admin-full/luasrc/model/cbi/admin_system
parentae7c6f48df6cfcad7dfc3274e0ead272c8d33cfc (diff)
luci-mod-admin-full: support configuring usbport LED triggers
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-admin-full/luasrc/model/cbi/admin_system')
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/leds.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/leds.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/leds.lua
index 8d9bcb1371..4b6f397e6a 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/leds.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/leds.lua
@@ -109,6 +109,13 @@ function usbdev.remove(self, section)
end
end
+
+usbport = s:option(MultiValue, "ports", translate("USB Ports"))
+usbport:depends("trigger", "usbport")
+usbport.rmempty = true
+usbport.widget = "checkbox"
+usbport.size = 1
+
for p in nixio.fs.glob("/sys/bus/usb/devices/[0-9]*/manufacturer") do
local id = p:match("%d+-%d+")
local mf = nixio.fs.readfile("/sys/bus/usb/devices/" .. id .. "/manufacturer") or "?"
@@ -116,4 +123,12 @@ for p in nixio.fs.glob("/sys/bus/usb/devices/[0-9]*/manufacturer") do
usbdev:value(id, "%s (%s - %s)" %{ id, mf, pr })
end
+for p in nixio.fs.glob("/sys/bus/usb/devices/[0-9]*") do
+ local bus, port = p:match("(%d+)-(%d+)")
+ if bus and port then
+ usbport:value("usb%u-port%u" %{ tonumber(bus), tonumber(port) },
+ "Hub %u, Port %u" %{ tonumber(bus), tonumber(port) })
+ end
+end
+
return m