luci-proto-qmi: Added support for QMI Cellular
[project/luci.git] / protocols / luci-proto-qmi / luasrc / model / cbi / admin_network / proto_qmi.lua
1 -- Copyright 2016 David Thornley <david.thornley@touchstargroup.com>
2 -- Licensed to the public under the Apache License 2.0.
3
4 local map, section, net = ...
5
6 local device, apn, pincode, username, password
7 local auth, ipv6
8
9
10 device = section:taboption("general", Value, "device", translate("Modem device"))
11 device.rmempty = false
12
13 local device_suggestions = nixio.fs.glob("/dev/cdc-wdm*")
14
15 if device_suggestions then
16         local node
17         for node in device_suggestions do
18                 device:value(node)
19         end
20 end
21
22
23 apn = section:taboption("general", Value, "apn", translate("APN"))
24
25
26 pincode = section:taboption("general", Value, "pincode", translate("PIN"))
27
28
29 username = section:taboption("general", Value, "username", translate("PAP/CHAP username"))
30
31
32 password = section:taboption("general", Value, "password", translate("PAP/CHAP password"))
33 password.password = true
34
35 auth = section:taboption("general", Value, "auth", translate("Authentication Type"))
36 auth:value("", translate("-- Please choose --"))
37 auth:value("both", "PAP/CHAP (both)")
38 auth:value("pap", "PAP")
39 auth:value("chap", "CHAP")
40 auth:value("none", "NONE")
41
42 if luci.model.network:has_ipv6() then
43     ipv6 = section:taboption("advanced", Flag, "ipv6", translate("Enable IPv6 negotiation"))
44     ipv6.default = ipv6.disabled
45 end