Blame SOURCES/0001-Add-a-new-element-vendor_id.patch

bf6610
From 0dff3470926f813cd36d03bc79216972399e65e5 Mon Sep 17 00:00:00 2001
bf6610
From: Amit Saha <asaha@redhat.com>
bf6610
Date: Thu, 23 Apr 2015 14:52:02 +1000
bf6610
Subject: [PATCH] Add a new element "vendor_id" element which preserves the original vendor ID (#405)
bf6610
bf6610
Bug: 1212284
bf6610
---
bf6610
bf6610
diff --git a/docs/lshw.xsd b/docs/lshw.xsd
bf6610
index b46a33e..95d5e38 100644
bf6610
--- a/docs/lshw.xsd
bf6610
+++ b/docs/lshw.xsd
bf6610
@@ -13,6 +13,7 @@
bf6610
       <xs:element name="description" type="xs:string" minOccurs="0" />
bf6610
       <xs:element name="product" type="xs:string" minOccurs="0" />
bf6610
       <xs:element name="vendor" type="xs:string" minOccurs="0" />
bf6610
+      <xs:element name="vendor_id" type="xs:string" minOccurs="0" />
bf6610
       <xs:element name="physid" type="xs:string" minOccurs="0" />
bf6610
       <xs:element name="version" type="xs:string" minOccurs="0" />
bf6610
       <xs:element name="date" type="xs:string" minOccurs="0" />
bf6610
diff --git a/src/core/cpuinfo.cc b/src/core/cpuinfo.cc
bf6610
index ac2ff1b..ee96424 100644
bf6610
--- a/src/core/cpuinfo.cc
bf6610
+++ b/src/core/cpuinfo.cc
99c779
@@ -454,6 +454,7 @@
bf6610
     cpu->claim(true);
bf6610
     if (id == "vendor_id")
bf6610
     {
bf6610
+      cpu->setVendorId(value);
bf6610
       if (value == "AuthenticAMD")
bf6610
         value = "Advanced Micro Devices [AMD]";
bf6610
       if (value == "GenuineIntel")
bf6610
diff --git a/src/core/hw.cc b/src/core/hw.cc
bf6610
index 44e2bd8..bad65d3 100644
bf6610
--- a/src/core/hw.cc
bf6610
+++ b/src/core/hw.cc
bf6610
@@ -27,7 +27,7 @@
bf6610
 struct hwNode_i
bf6610
 {
bf6610
   hwClass deviceclass;
bf6610
-  string id, vendor, product, version, date, serial, slot, handle, description,
bf6610
+  string id, vendor, vendor_id, product, version, date, serial, slot, handle, description,
99c779
     businfo, physid, dev, modalias, subsysvendor, subsysproduct;
bf6610
   bool enabled;
bf6610
   bool claimed;
99c779
@@ -394,6 +394,19 @@
99c779
   if (This)
bf6610
     This->vendor = strip(vendor);
bf6610
 }
bf6610
+string hwNode::getVendorId() const
bf6610
+{
bf6610
+  if (This)
bf6610
+    return This->vendor_id;
bf6610
+  else
bf6610
+    return "";
bf6610
+}
bf6610
+
bf6610
+void hwNode::setVendorId(const string & vendor_id)
bf6610
+{
bf6610
+  if (This)
bf6610
+    This->vendor_id = strip(vendor_id);
bf6610
+}
bf6610
 
99c779
 
99c779
 string hwNode::getSubsysVendor() const
99c779
@@ -1441,6 +1454,15 @@
99c779
       out << "\"";
99c779
     }
99c779
99c779
+    if (getVendorId() != "")
99c779
+    {
99c779
+      out << "," << endl;
99c779
+      out << spaces(2*level+2);
99c779
+      out << "\"vendor_id\" : \"";
99c779
+      out << escapeJSON(getVendorId());
99c779
+      out << "\"";
99c779
+    }
99c779
+
99c779
     if (getPhysId() != "")
99c779
     {
99c779
       out << "," << endl;
99c779
@@ -1749,6 +1771,16 @@
bf6610
       out << endl;
bf6610
     }
bf6610
 
bf6610
+    if (getVendorId() != "")
bf6610
+    {
bf6610
+      out << spaces(2*level+1);
bf6610
+      out << "<vendor_id>";
bf6610
+      out << escape(getVendorId());
bf6610
+      out << "</vendor_id>";
bf6610
+      out << endl;
bf6610
+    }
bf6610
+
bf6610
+
bf6610
     if (getPhysId() != "")
bf6610
     {
bf6610
       out << spaces(2*level+1);
bf6610
diff --git a/src/core/hw.h b/src/core/hw.h
bf6610
index d61bb98..2f21cd0 100644
bf6610
--- a/src/core/hw.h
bf6610
+++ b/src/core/hw.h
99c779
@@ -124,6 +124,9 @@
bf6610
     string getVendor() const;
bf6610
     void setVendor(const string & vendor);
99c779
 
bf6610
+    string getVendorId() const;
bf6610
+    void setVendorId(const string & vendor);
99c779
+
99c779
     string getSubsysVendor() const;
99c779
     void setSubsysVendor(const string & subsysvendor);
bf6610
 
bf6610
diff --git a/src/core/print.cc b/src/core/print.cc
bf6610
index 5df078e..ec8dfc9 100644
bf6610
--- a/src/core/print.cc
bf6610
+++ b/src/core/print.cc
bf6610
@@ -209,6 +209,20 @@
bf6610
       cout << endl;
bf6610
     }
bf6610
 
bf6610
+    if (node.getVendorId() != "")
bf6610
+    {
bf6610
+      tab(level + 1, false);
bf6610
+      if (html)
bf6610
+        cout << "";
bf6610
+      cout << _("vendor_id") << ": ";
bf6610
+      if (html)
bf6610
+        cout << "";
bf6610
+      cout << node.getVendorId();
bf6610
+      if (html)
bf6610
+        cout << "";
bf6610
+      cout << endl;
bf6610
+    }
bf6610
+
bf6610
     if (node.getPhysId() != "")
bf6610
     {
bf6610
       tab(level + 1, false);