2 LuCI - Lua Configuration Interface
4 Copyright 2015 Cezary Jackiewicz <cezary.jackiewicz@gmail.com>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
13 local map, section, net = ...
15 local device, apn, service, pincode, username, password
16 local ipv6, delay, defaultroute, metric, peerdns, dns
19 device = section:taboption("general", Value, "device", translate("Modem device"))
20 device.rmempty = false
23 for dev in nixio.fs.glob("/dev/ttyUSB*") do
26 for dev in nixio.fs.glob("/dev/cdc-wdm*") do
30 mode = section:taboption("general", Value, "mode", translate("Service Type"))
31 mode:value("", translate("Modem default"))
32 mode:value("preferlte", translate("Prefer LTE"))
33 mode:value("preferumts", translate("Prefer UMTS"))
34 mode:value("lte", "LTE")
35 mode:value("umts", "UMTS/GPRS")
36 mode:value("gsm", translate("GPRS only"))
37 mode:value("auto", translate("auto"))
40 mode = section:taboption("general", Value, "pdptype", translate("IP Protocol"))
42 mode:value("IP", translate("IPv4"))
43 mode:value("IPV4V6", translate("IPv4+IPv6"))
44 mode:value("IPV6", translate("IPv6"))
47 apn = section:taboption("general", Value, "apn", translate("APN"))
50 pincode = section:taboption("general", Value, "pincode", translate("PIN"))
53 username = section:taboption("general", Value, "username", translate("PAP/CHAP username"))
56 password = section:taboption("general", Value, "password", translate("PAP/CHAP password"))
57 password.password = true
60 if luci.model.network:has_ipv6() then
62 ipv6 = section:taboption("advanced", ListValue, "ipv6")
63 ipv6:value("auto", translate("Automatic"))
64 ipv6:value("0", translate("Disabled"))
65 ipv6:value("1", translate("Manual"))
71 delay = section:taboption("advanced", Value, "delay",
72 translate("Modem init timeout"),
73 translate("Maximum amount of seconds to wait for the modem to become ready"))
75 delay.placeholder = "10"
76 delay.datatype = "min(1)"
79 defaultroute = section:taboption("advanced", Flag, "defaultroute",
80 translate("Use default gateway"),
81 translate("If unchecked, no default route is configured"))
83 defaultroute.default = defaultroute.enabled
85 metric = section:taboption("advanced", Value, "metric",
86 translate("Use gateway metric"))
88 metric.placeholder = "0"
89 metric.datatype = "uinteger"
90 metric:depends("defaultroute", defaultroute.enabled)
93 peerdns = section:taboption("advanced", Flag, "peerdns",
94 translate("Use DNS servers advertised by peer"),
95 translate("If unchecked, the advertised DNS server addresses are ignored"))
97 peerdns.default = peerdns.enabled
100 dns = section:taboption("advanced", DynamicList, "dns",
101 translate("Use custom DNS servers"))
103 dns:depends("peerdns", "")
104 dns.datatype = "ipaddr"