Blame SOURCES/0001-output-pci-subsystem-information-611.patch

21ef37
From c78c197685f0464ca9d7c6c59f742cf833b0ba5a Mon Sep 17 00:00:00 2001
21ef37
From: James De Vries <shadylives@gmail.com>
21ef37
Date: Wed, 10 Oct 2012 09:19:33 +0200
21ef37
Subject: [PATCH 01/26] output pci subsystem information (#611)
21ef37
21ef37
---
21ef37
 src/core/hw.cc  | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
21ef37
 src/core/hw.h   |  6 ++++++
21ef37
 src/core/pci.cc |  3 ++-
21ef37
 3 files changed, 59 insertions(+), 2 deletions(-)
21ef37
21ef37
diff --git a/src/core/hw.cc b/src/core/hw.cc
21ef37
index e2559ff..44e2bd8 100644
21ef37
--- a/src/core/hw.cc
21ef37
+++ b/src/core/hw.cc
21ef37
@@ -28,7 +28,7 @@ struct hwNode_i
21ef37
 {
21ef37
   hwClass deviceclass;
21ef37
   string id, vendor, product, version, date, serial, slot, handle, description,
21ef37
-    businfo, physid, dev, modalias;
21ef37
+    businfo, physid, dev, modalias, subsysvendor, subsysproduct;
21ef37
   bool enabled;
21ef37
   bool claimed;
21ef37
   unsigned long long start;
21ef37
@@ -396,6 +396,22 @@ void hwNode::setVendor(const string & vendor)
21ef37
 }
21ef37
 
21ef37
 
21ef37
+string hwNode::getSubsysVendor() const
21ef37
+{
21ef37
+  if (This)
21ef37
+    return This->subsysvendor;
21ef37
+  else
21ef37
+    return "";
21ef37
+}
21ef37
+
21ef37
+
21ef37
+void hwNode::setSubsysVendor(const string & subsysvendor)
21ef37
+{
21ef37
+  if (This)
21ef37
+    This->subsysvendor = strip(subsysvendor);
21ef37
+}
21ef37
+
21ef37
+
21ef37
 string hwNode::getProduct() const
21ef37
 {
21ef37
   if (This)
21ef37
@@ -412,6 +428,22 @@ void hwNode::setProduct(const string & product)
21ef37
 }
21ef37
 
21ef37
 
21ef37
+string hwNode::getSubsysProduct() const
21ef37
+{
21ef37
+  if (This)
21ef37
+    return This->subsysproduct;
21ef37
+  else
21ef37
+    return "";
21ef37
+}
21ef37
+
21ef37
+
21ef37
+void hwNode::setSubsysProduct(const string & subsysproduct)
21ef37
+{
21ef37
+  if (This)
21ef37
+    This->subsysproduct = strip(subsysproduct);
21ef37
+}
21ef37
+
21ef37
+
21ef37
 string hwNode::getVersion() const
21ef37
 {
21ef37
   if (This)
21ef37
@@ -1726,6 +1758,24 @@ string hwNode::asXML(unsigned level)
21ef37
       out << endl;
21ef37
     }
21ef37
 
21ef37
+    if (getSubsysProduct() != "")
21ef37
+    {
21ef37
+      out << spaces(2*level+1);
21ef37
+      out << "<subsysproduct>";
21ef37
+      out << escape(getSubsysProduct());
21ef37
+      out << "</subsysproduct>";
21ef37
+      out << endl;
21ef37
+    }
21ef37
+
21ef37
+    if (getSubsysVendor() != "")
21ef37
+    {
21ef37
+      out << spaces(2*level+1);
21ef37
+      out << "<subsysvendor>";
21ef37
+      out << escape(getSubsysVendor());
21ef37
+      out << "</subsysvendor>";
21ef37
+      out << endl;
21ef37
+    }
21ef37
+
21ef37
     if (getBusInfo() != "")
21ef37
     {
21ef37
       out << spaces(2*level+1);
21ef37
diff --git a/src/core/hw.h b/src/core/hw.h
21ef37
index 4211a82..d61bb98 100644
21ef37
--- a/src/core/hw.h
21ef37
+++ b/src/core/hw.h
21ef37
@@ -124,9 +124,15 @@ class hwNode
21ef37
     string getVendor() const;
21ef37
     void setVendor(const string & vendor);
21ef37
 
21ef37
+    string getSubsysVendor() const;
21ef37
+    void setSubsysVendor(const string & subsysvendor);
21ef37
+
21ef37
     string getProduct() const;
21ef37
     void setProduct(const string & product);
21ef37
 
21ef37
+    string getSubsysProduct() const;
21ef37
+    void setSubsysProduct(const string & subsysproduct);
21ef37
+
21ef37
     string getVersion() const;
21ef37
     void setVersion(const string & version);
21ef37
 
21ef37
diff --git a/src/core/pci.cc b/src/core/pci.cc
21ef37
index 7e6b98d..85a5481 100644
21ef37
--- a/src/core/pci.cc
21ef37
+++ b/src/core/pci.cc
21ef37
@@ -956,7 +956,8 @@ static hwNode *scan_pci_dev(struct pci_dev &d, hwNode & n)
21ef37
           device->setVendor(get_device_description(d.vendor_id)+(enabled("output:numeric")?" ["+tohex(d.vendor_id)+"]":""));
21ef37
           device->setVersion(revision);
21ef37
           device->setProduct(get_device_description(d.vendor_id, d.device_id)+(enabled("output:numeric")?" ["+tohex(d.vendor_id)+":"+tohex(d.device_id)+"]":""));
21ef37
-
21ef37
+          device->setSubsysVendor(get_device_description(subsys_v)+(enabled("output:numeric")?" ["+tohex(subsys_v)+"]":""));
21ef37
+          device->setSubsysProduct(get_device_description(subsys_v, subsys_d)+(enabled("output:numeric")?" ["+tohex(subsys_v)+":"+tohex(subsys_d)+"]":""));
21ef37
           if (cmd & PCI_COMMAND_MASTER)
21ef37
             device->addCapability("bus master", "bus mastering");
21ef37
           if (cmd & PCI_COMMAND_VGA_PALETTE)
21ef37
-- 
21ef37
2.10.2
21ef37