Browse Source

wpaspy: Add support for TERMINATE command

This can be used to terminate the wpa_supplicant/hostapd process.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Janusz Dziedzic 9 years ago
parent
commit
13073011b9
1 changed files with 10 additions and 0 deletions
  1. 10 0
      wpaspy/wpaspy.py

+ 10 - 0
wpaspy/wpaspy.py

@@ -109,6 +109,16 @@ class Ctrl:
             return None
             return None
         raise Exception("DETACH failed")
         raise Exception("DETACH failed")
 
 
+    def terminate(self):
+        if self.attached:
+            try:
+                self.detach()
+            except Exception, e:
+                # Need to ignore this to allow the socket to be closed
+                self.attached = False
+        self.request("TERMINATE")
+        self.close()
+
     def pending(self, timeout=0):
     def pending(self, timeout=0):
         [r, w, e] = select.select([self.s], [], [], timeout)
         [r, w, e] = select.select([self.s], [], [], timeout)
         if r:
         if r: