Skip to content

Commit aa63e26

Browse files
authored
add pkill wpa_supplicant
1 parent 17bb5f0 commit aa63e26

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

wifi.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,10 @@ def start_as_client(cls):
153153
time.sleep(1.0)
154154
out = os.system("wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf > /dev/null 2>&1")
155155
out += os.system("dhclient -1 wlan0")
156-
print(out)
156+
print("start_as_client: " + str(out))
157157
ipaddr = cls.get_ipaddr("wlan0")
158158
if ipaddr is None or "169.254" in ipaddr:
159+
os.system("sudo pkill wpa_supplicant")
159160
raise Exception()
160161
try:
161162
cls.register_ipaddr(cls.get_macaddr("wlan0"), cls.get_config().get('bot_name', 'CoderBot'), cls.get_ipaddr("wlan0"), "roberto.previtera@gmail.com")
@@ -178,7 +179,7 @@ def start_as_ap(cls):
178179
out += str(subprocess.check_output(["ip", "a", "add", "10.0.0.1/24", "dev", "wlan0"]))
179180
out += str(subprocess.check_output(["ip", "link", "set", "dev", "wlan0", "up"]))
180181
out += str(subprocess.check_output(["ifconfig"]))
181-
print(out)
182+
print("start_as_ap: " + str(out))
182183
cls.start_hostapd()
183184
cls.start_dnsmasq()
184185

0 commit comments

Comments
 (0)