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