[PATCH v5 17/25] wpaspy: add debug support for Ctrl UDP class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add debug support for Ctrl class. This is
useful for debuging purpose for UDP connection.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@xxxxxxxxx>
---
 wpaspy/wpaspy.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/wpaspy/wpaspy.py b/wpaspy/wpaspy.py
index 30bb652..76ac785 100644
--- a/wpaspy/wpaspy.py
+++ b/wpaspy/wpaspy.py
@@ -10,7 +10,9 @@ import os
 import stat
 import socket
 import select
+import logging
 
+logger = logging.getLogger()
 counter = 0
 
 class Ctrl:
@@ -54,7 +56,7 @@ class Ctrl:
                 self.cookie = reply
                 self.port = port
             except:
-                print "connect exception ", path, str(port)
+                logger.debug("connect exception " + str(path) + "/" + str(port))
                 if self.s != None:
                     self.s.close()
                 raise
@@ -79,12 +81,13 @@ class Ctrl:
 
     def request(self, cmd, timeout=10):
         if self.udp == True:
+            logger.debug(self.path + "/" + str(self.port) + " request: " + cmd)
             self.s.sendto(self.cookie + cmd, self.sockaddr)
         else:
             self.s.send(cmd)
         [r, w, e] = select.select([self.s], [], [], timeout)
         if r:
-            return self.s.recv(4096)
+            return self.recv()
         raise Exception("Timeout on waiting response")
 
     def attach(self):
@@ -115,4 +118,6 @@ class Ctrl:
 
     def recv(self):
         res = self.s.recv(4096)
+        if self.udp == True:
+           logger.debug(self.path + "/" + str(self.port) + " recv: " + res)
         return res
-- 
1.9.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux