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, dialnum
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 dialnum = section:taboption("general", Value, "dialnum", translate("Dial number"))
61 dialnum.placeholder = "*99#"
64 if luci.model.network:has_ipv6() then
66 ipv6 = section:taboption("advanced", ListValue, "ipv6")
67 ipv6:value("auto", translate("Automatic"))
68 ipv6:value("0", translate("Disabled"))
69 ipv6:value("1", translate("Manual"))
75 delay = section:taboption("advanced", Value, "delay",
76 translate("Modem init timeout"),
77 translate("Maximum amount of seconds to wait for the modem to become ready"))
79 delay.placeholder = "10"
80 delay.datatype = "min(1)"
83 defaultroute = section:taboption("advanced", Flag, "defaultroute",
84 translate("Use default gateway"),
85 translate("If unchecked, no default route is configured"))
87 defaultroute.default = defaultroute.enabled
89 metric = section:taboption("advanced", Value, "metric",
90 translate("Use gateway metric"))
92 metric.placeholder = "0"
93 metric.datatype = "uinteger"
94 metric:depends("defaultroute", defaultroute.enabled)
97 peerdns = section:taboption("advanced", Flag, "peerdns",
98 translate("Use DNS servers advertised by peer"),
99 translate("If unchecked, the advertised DNS server addresses are ignored"))
101 peerdns.default = peerdns.enabled
104 dns = section:taboption("advanced", DynamicList, "dns",
105 translate("Use custom DNS servers"))
107 dns:depends("peerdns", "")
108 dns.datatype = "ipaddr"