From 13073011b98ab0a7e8c273c5bfdb6b7d75a4f8ca Mon Sep 17 00:00:00 2001 From: Janusz Dziedzic Date: Fri, 4 Mar 2016 10:20:39 +0100 Subject: [PATCH] wpaspy: Add support for TERMINATE command This can be used to terminate the wpa_supplicant/hostapd process. Signed-off-by: Janusz Dziedzic --- wpaspy/wpaspy.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wpaspy/wpaspy.py b/wpaspy/wpaspy.py index 861bee6ee..809b4ce00 100644 --- a/wpaspy/wpaspy.py +++ b/wpaspy/wpaspy.py @@ -109,6 +109,16 @@ class Ctrl: return None 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): [r, w, e] = select.select([self.s], [], [], timeout) if r: