Commit 91232547 authored by Pete Tucker's avatar Pete Tucker
Browse files

Merge branch 'feature/hostapd-name' into 'master'

ES-324 Create custom ssid for Wireless Access Point

See merge request !6
parents bfc729e1 b70a69c3
......@@ -177,7 +177,7 @@ def changeName(newName):
if WSREGEX.search(newName):
print "New name contains whitespaces. Ignoring"
return
_changeHostName(newName)
#_changeHostName(newName)
#_changeP2PSSID(newName)
_changeAPSSID(newName)
......@@ -188,9 +188,10 @@ def _changeHostName(newName):
subprocess.call("hostname -F /etc/hostname", shell=True)
def _changeAPSSID(newName):
saveDefaultSSID()
#saveDefaultSSID()
subprocess.call(["sed", "-i", "s/^ssid=.*/ssid=" + re.escape(newName) + "/", "/etc/hostapd.conf"])
subprocess.call("/etc/init.d/avahi-daemon restart && sleep 2", shell=True)
#subprocess.call("/etc/init.d/avahi-daemon restart && sleep 2", shell=True)
def _changeP2PSSID(newName):
subprocess.call(["sed", "-i", "s/^p2p_ssid_postfix=.*/p2p_ssid_postfix=" + re.escape(newName) + "/", "/etc/wpa_supplicant/p2p_supplicant.conf"])
......@@ -647,6 +648,11 @@ def getDefaultSSID():
def enableOneTimeSetup(persist):
subprocess.call("/usr/rigado/scripts/led_control.sh green flash", shell=True)
#create unique ssid for Wireless Access Point
unit_number=subprocess.check_output(["unit_serial_number"]).rstrip()
ssid_AP="IoT-Gateway-Setup"+unit_number[-6:]
_changeAPSSID(ssid_AP)
hostname = subprocess.check_output('hostname').strip()
print "Scanning and saving WiFi networks..."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment