mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 17:59:25 +01:00
tools/ios_convert: parse DisplayedOperatorName
Some hotspot networks do not contain SSID_STR, which was required for both naming the provisioning file as well as the 'Name' key. The DisplayedOperatorName is a better option for this 'Name' key and could also be used for the filename. Now, DisplayedOperatorName is preferred, and if not found SSID_STR is used.
This commit is contained in:
parent
9e81a8115a
commit
ab0c8cae3c
@ -17,6 +17,7 @@ class Network:
|
|||||||
self.username = None
|
self.username = None
|
||||||
self.password = None
|
self.password = None
|
||||||
self.ssid = None
|
self.ssid = None
|
||||||
|
self.display_name = None
|
||||||
|
|
||||||
def process_eap_config(eap_conf, network):
|
def process_eap_config(eap_conf, network):
|
||||||
for m in range(len(eap_conf)):
|
for m in range(len(eap_conf)):
|
||||||
@ -50,6 +51,8 @@ def process_payload_array(parray):
|
|||||||
network.is_hotspot = False
|
network.is_hotspot = False
|
||||||
elif parray[l].text == "SSID_STR":
|
elif parray[l].text == "SSID_STR":
|
||||||
network.ssid = parray[l + 1].text
|
network.ssid = parray[l + 1].text
|
||||||
|
elif parray[l].text == "DisplayedOperatorName":
|
||||||
|
network.display_name = parray[l + 1].text
|
||||||
elif parray[l].text == "EAPClientConfiguration":
|
elif parray[l].text == "EAPClientConfiguration":
|
||||||
process_eap_config(parray[l + 1], network)
|
process_eap_config(parray[l + 1], network)
|
||||||
|
|
||||||
@ -119,9 +122,16 @@ def write_network(network, root_ca_path):
|
|||||||
output += "EAP-%s-Phase2-Password=%s\n" % \
|
output += "EAP-%s-Phase2-Password=%s\n" % \
|
||||||
(eap, network.password)
|
(eap, network.password)
|
||||||
|
|
||||||
|
if network.display_name:
|
||||||
|
name = network.display_name
|
||||||
|
elif network.ssid:
|
||||||
|
name = network.ssid
|
||||||
|
else:
|
||||||
|
name = "NameUnknown"
|
||||||
|
|
||||||
if network.is_hotspot:
|
if network.is_hotspot:
|
||||||
conf_file = iwd_dir + '/hotspot/' + \
|
conf_file = iwd_dir + '/hotspot/' + \
|
||||||
os.path.splitext(args.input)[0] + '.conf'
|
name + '.conf'
|
||||||
output += "[Hotspot]\n"
|
output += "[Hotspot]\n"
|
||||||
output += "NAIRealmNames="
|
output += "NAIRealmNames="
|
||||||
|
|
||||||
@ -132,10 +142,10 @@ def write_network(network, root_ca_path):
|
|||||||
output += ','
|
output += ','
|
||||||
|
|
||||||
output += "\n"
|
output += "\n"
|
||||||
output += "Name=%s\n" % network.ssid
|
output += "Name=%s\n" % name
|
||||||
|
|
||||||
else:
|
else:
|
||||||
conf_file = iwd_dir + '/' + network.ssid + '.8021x'
|
conf_file = iwd_dir + '/' + name + '.8021x'
|
||||||
|
|
||||||
# Some AP's require older protocol versions. There should be no harm in
|
# Some AP's require older protocol versions. There should be no harm in
|
||||||
# setting this all the time.
|
# setting this all the time.
|
||||||
|
Loading…
Reference in New Issue
Block a user