]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - tests/hwsim/tshark.py
tests: Work around tshark bug in wpas_mesh_max_peering
[thirdparty/hostap.git] / tests / hwsim / tshark.py
index c3b8f36d436fbb4be20e5e35142065151c403319..b90f66258672a537be8c9a443d2f476f5c2b9286 100644 (file)
@@ -99,3 +99,19 @@ def run_tshark(filename, filter, display=None, wait=True):
         return _run_tshark(filename, filter.replace('wlan_mgt', 'wlan'),
                            [x.replace('wlan_mgt', 'wlan') for x in display],
                            wait)
+
+def run_tshark_json(filename, filter):
+    arg = [ "tshark", "-r", filename,
+            _tshark_filter_arg, filter ]
+    arg.append('-Tjson')
+    arg.append('-x')
+    try:
+        cmd = subprocess.Popen(arg, stdout=subprocess.PIPE,
+                               stderr=subprocess.PIPE)
+    except Exception, e:
+        logger.info("Could run run tshark: " + str(e))
+        return None
+    output = cmd.communicate()
+    out = output[0]
+    res = cmd.wait()
+    return out