tools: fix json output of pmdinfo

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: c67c9a5c64 ("tools: query binaries for HW and other support information")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
Olivier Matz 2016-08-26 15:15:32 +02:00 committed by Thomas Monjalon
parent c5917f3918
commit 5e3e5f0b56

View File

@ -319,7 +319,7 @@ def parse_pmd_info_string(self, mystring):
pmdinfo = json.loads(mystring)
if raw_output:
print(pmdinfo)
print(json.dumps(pmdinfo))
return
print("PMD NAME: " + pmdinfo["name"])