Bad JSON format for 'lshw'

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

 



I tried to submit this as a ticket to
https://ezix.org/project/newticket#ticket but it wouldn't accept the
captcha test. Posting here in case I can get to the 'lshw' dev (or
package maintainer) through Fedora. This is tested on Fedora 33 (and
CentOS Stream 8, fwiw).

I'm working on a program to process lshw data, and the XML data is fine,
but the JSON output format is invalid.

Example in XML;

# lshw -class disk -class storage -xml
====
<?xml version="1.0" standalone="yes" ?>
<!-- generated by lshw-B.02.19.2 -->
<!-- GCC 10.2.1 20200723 (Red Hat 10.2.1-1) -->
<!-- Linux 5.10.21-200.fc33.x86_64 #1 SMP Mon Mar 8 00:24:40 UTC 2021
x86_64 -->
<!-- GNU libc 2 (glibc 2.32) -->
<list>
  <node id="nvme" claimed="true" class="storage" handle="PCI:0000:55:00.0">
   <description>NVMe device</description>
   <product>INTEL SSDPEKNW020T9</product>
   <vendor>Intel Corporation</vendor>
   <physid>0</physid>
   <subproduct>Intel Corporation</subproduct>
   <subvendor>Intel Corporation</subvendor>
   <businfo>pci@0000:55:00.0</businfo>
   <logicalname>/dev/nvme0</logicalname>
   <version>001C</version>
   <serial>xxxxx</serial>
   <width units="bits">64</width>
   <clock units="Hz">33000000</clock>
   <configuration>
    <setting id="driver" value="nvme" />
    <setting id="latency" value="0" />
    <setting id="nqn"
value="nqn.2010-01.com.intel:nvm-subsystem-sn-btnr00161vch2p0c" />
    <setting id="state" value="live" />
   </configuration>
   <capabilities>
    <capability id="nvme" />
    <capability id="pm" >Power Management</capability>
    <capability id="msi" >Message Signalled Interrupts</capability>
    <capability id="pciexpress" >PCI Express</capability>
    <capability id="msix" >MSI-X</capability>
    <capability id="nvm_express" />
    <capability id="bus_master" >bus mastering</capability>
    <capability id="cap_list" >PCI capabilities listing</capability>
   </capabilities>
   <resources>
    <resource type="irq" value="16" />
    <resource type="memory" value="ae100000-ae103fff" />
   </resources>
   <hints>
    <hint name="icon" value="disc" />
    <hint name="pci.class" value="0x108" />
    <hint name="pci.device" value="0xFAF0" />
    <hint name="pci.subdevice" value="0x390E" />
    <hint name="pci.subvendor" value="0x8086" />
    <hint name="pci.vendor" value="0x8086" />
   </hints>
    <node id="namespace" claimed="true" class="disk"
handle="GUID:766cd8a2-26c2-4983-9f02-60817e74f3a5">
     <description>NVMe disk</description>
     <physid>1</physid>
     <businfo>nvme@0:1</businfo>
     <logicalname>/dev/nvme0n1</logicalname>
     <size units="bytes">2048408248320</size>
     <configuration>
      <setting id="guid" value="766cd8a2-26c2-4983-9f02-60817e74f3a5" />
      <setting id="logicalsectorsize" value="512" />
      <setting id="sectorsize" value="512" />
      <setting id="wwid" value="eui.0000000001000000e4d25c2316cf5101" />
     </configuration>
     <capabilities>
      <capability id="gpt-1.00" >GUID Partition Table version
1.00</capability>
      <capability id="partitioned" >Partitioned disk</capability>
      <capability id="partitioned:gpt" >GUID partition table</capability>
     </capabilities>
     <hints>
      <hint name="guid" value="766cd8a2-26c2-4983-9f02-60817e74f3a5" />
      <hint name="icon" value="disc" />
      <hint name="partitions" value="0x80" />
     </hints>
    </node>
  </node>
</list>
====

Same in JSON;

# lshw -class disk -class storage -json
====
{
    "id" : "nvme",
    "class" : "storage",
    "claimed" : true,
    "handle" : "PCI:0000:55:00.0",
    "description" : "NVMe device",
    "product" : "INTEL SSDPEKNW020T9",
    "vendor" : "Intel Corporation",
    "physid" : "0",
    "businfo" : "pci@0000:55:00.0",
    "logicalname" : "/dev/nvme0",
    "version" : "001C",
    "serial" : "BTNR00161VCH2P0C",
    "width" : 64,
    "clock" : 33000000,
    "configuration" : {
      "driver" : "nvme",
      "latency" : "0",
      "nqn" : "nqn.2010-01.com.intel:nvm-subsystem-sn-btnr00161vch2p0c",
      "state" : "live"
    },
    "capabilities" : {
      "nvme" : true,
      "pm" : "Power Management",
      "msi" : "Message Signalled Interrupts",
      "pciexpress" : "PCI Express",
      "msix" : "MSI-X",
      "nvm_express" : true,
      "bus_master" : "bus mastering",
      "cap_list" : "PCI capabilities listing"
    },
    "children" : [
      {
        "id" : "namespace",
        "class" : "disk",
        "claimed" : true,
        "handle" : "GUID:766cd8a2-26c2-4983-9f02-60817e74f3a5",
        "description" : "NVMe disk",
        "physid" : "1",
        "businfo" : "nvme@0:1",
        "logicalname" : "/dev/nvme0n1",
        "units" : "bytes",
        "size" : 2048408248320,
        "configuration" : {
          "guid" : "766cd8a2-26c2-4983-9f02-60817e74f3a5",
          "logicalsectorsize" : "512",
          "sectorsize" : "512",
          "wwid" : "eui.0000000001000000e4d25c2316cf5101"
        },
        "capabilities" : {
          "gpt-1.00" : "GUID Partition Table version 1.00",
          "partitioned" : "Partitioned disk",
          "partitioned:gpt" : "GUID partition table"
        },
        "children" : [

        ]
      }
    ]
====


-- 
Digimer
Papers and Projects: https://alteeve.com/w/
"I am, somehow, less interested in the weight and convolutions of
Einstein’s brain than in the near certainty that people of equal talent
have lived and died in cotton fields and sweatshops." - Stephen Jay Gould
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux