]> git.droids-corp.org - dpdk.git/commitdiff
tools: fix json output of pmdinfo
authorOlivier Matz <olivier.matz@6wind.com>
Fri, 26 Aug 2016 13:15:32 +0000 (15:15 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 4 Oct 2016 09:52:10 +0000 (11:52 +0200)
Using dpdk-pmdinfo with the '-r' flag does not produce a json output as
documented. Instead, the python representation of the json object is
shown, which is nearly the same, but cannot be properly parsed by a json
parser.

python repr (before):
  {u'pci_ids': [[5549, 1968, 65535, 65535]], u'name': u'vmxnet3'}
json (after):
  {"pci_ids": [[5549, 1968, 65535, 65535]], "name": "vmxnet3"}

Fixes: c67c9a5c646a ("tools: query binaries for HW and other support information")
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
tools/dpdk-pmdinfo.py

index dcc8db864dd52bc7c905f87e6775c716993d8a68..3db9819c61d3331dc9d3fd99fcb2bdd657e5ca10 100755 (executable)
@@ -319,7 +319,7 @@ class ReadElf(object):
         pmdinfo = json.loads(mystring)
 
         if raw_output:
-            print(pmdinfo)
+            print(json.dumps(pmdinfo))
             return
 
         print("PMD NAME: " + pmdinfo["name"])