Applied patch by Alexander von Gluck (kallisti5) - ticket #6350.

Small changes done: append ACPI node name to device name.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37757 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin
2010-07-26 12:54:44 +00:00
parent 004b2edb11
commit 26bfe3cb27
7 changed files with 135 additions and 5 deletions
+2 -1
View File
@@ -32,7 +32,8 @@ const char* kCategoryString[] = {
"Satellite communications controller", // 0x0f
"Encryption controller", // 0x10
"Signal processing controller", // 0x11
"Computer" // 0x12 (added later)
"Computer", // 0x12 (added later)
"ACPI controller" // 0x13 (added later)
};
+3 -1
View File
@@ -24,6 +24,7 @@ typedef enum {
BUS_ISA = 1,
BUS_PCI,
BUS_SCSI,
BUS_ACPI,
BUS_NONE
} BusType;
@@ -45,7 +46,8 @@ typedef std::vector<Attribute> Attributes;
typedef enum {
CAT_NONE = 0,
CAT_BUS = 6,
CAT_COMPUTER = 0x12
CAT_COMPUTER = 0x12,
CAT_ACPI = 0x13
} Category;
+84
View File
@@ -0,0 +1,84 @@
/*
* Copyright 2008-2010 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Alexander von Gluck (kallisti5)
*/
#include <sstream>
#include <stdlib.h>
#include "DeviceACPI.h"
DeviceACPI::DeviceACPI(Device* parent)
:
Device(parent)
{
}
DeviceACPI::~DeviceACPI()
{
}
void
DeviceACPI::InitFromAttributes()
{
BString outlineName;
BString nodeACPIPath;
BString rootACPIPath;
rootACPIPath = nodeACPIPath = GetAttribute("acpi/path").fValue;
// Grab just the root node info
// We grab 6 characters to not identify sub nodes of root node
rootACPIPath.Truncate(6);
// Grab node leaf name
nodeACPIPath.Remove(0, nodeACPIPath.FindLast(".") + 1);
fCategory = (Category)CAT_ACPI;
// Identify Predefined root namespaces (ACPI Spec 4.0a, p162)
if (rootACPIPath == "\\_SB_") {
outlineName = "ACPI System Bus";
} else if (rootACPIPath == "\\_TZ_") {
outlineName = "ACPI Thermal Zone";
} else if (rootACPIPath == "\\_PR_.") {
// each CPU node is considered a root node
outlineName << "ACPI Processor Namespace '" << nodeACPIPath << "'";
} else if (rootACPIPath == "\\_SI_") {
outlineName = "ACPI System Indicator";
} else {
outlineName << "ACPI node '" << nodeACPIPath << "'";
}
SetAttribute("Device name", outlineName.String());
SetAttribute("Manufacturer", "Not implimented");
SetText(outlineName.String());
}
Attributes
DeviceACPI::GetBusAttributes()
{
// Push back things that matter for ACPI
Attributes attributes;
attributes.push_back(GetAttribute("device/bus"));
attributes.push_back(GetAttribute("acpi/path"));
attributes.push_back(GetAttribute("acpi/type"));
return attributes;
}
BString
DeviceACPI::GetBusStrings()
{
BString str;
str << "Class Info:\t\t\t\t: " << fAttributeMap["Class Info"];
return str;
}
+27
View File
@@ -0,0 +1,27 @@
/*
* Copyright 2008-2010 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Alexander von Gluck (kallisti5)
*/
#ifndef DEVICEACPI_H
#define DEVICEACPI_H
#include "Device.h"
class DeviceACPI : public Device {
public:
DeviceACPI(Device* parent);
virtual ~DeviceACPI();
virtual Attributes GetBusAttributes();
virtual BString GetBusStrings();
virtual void InitFromAttributes();
virtual BString GetBusTabName()
{ return "ACPI Information"; }
};
#endif /* DEVICEACPI_H */
+17 -3
View File
@@ -277,21 +277,28 @@ DevicesView::AddDeviceAndChildren(device_node_cookie *node, Device* parent)
// Determine what type of device it is and create it
for (unsigned int i = 0; i < attributes.size(); i++) {
// Devices Root
if (attributes[i].fName == "device/pretty name"
if (attributes[i].fName == B_DEVICE_PRETTY_NAME
&& attributes[i].fValue == "Devices Root") {
newDevice = new Device(parent, BUS_NONE, CAT_COMPUTER, "Computer");
break;
}
// ACPI Controller
if (attributes[i].fName == B_DEVICE_PRETTY_NAME
&& attributes[i].fValue == "ACPI") {
newDevice = new Device(parent, BUS_ACPI, CAT_BUS, "ACPI bus");
break;
}
// PCI bus
if (attributes[i].fName == "device/pretty name"
if (attributes[i].fName == B_DEVICE_PRETTY_NAME
&& attributes[i].fValue == "PCI") {
newDevice = new Device(parent, BUS_PCI, CAT_BUS, "PCI bus");
break;
}
// ISA bus
if (attributes[i].fName == "device/bus"
if (attributes[i].fName == B_DEVICE_BUS
&& attributes[i].fValue == "isa") {
newDevice = new Device(parent, BUS_ISA, CAT_BUS, "ISA bus");
break;
@@ -303,6 +310,13 @@ DevicesView::AddDeviceAndChildren(device_node_cookie *node, Device* parent)
newDevice = new DevicePCI(parent);
break;
}
// ACPI device
if (attributes[i].fName == B_DEVICE_BUS
&& attributes[i].fValue == "acpi") {
newDevice = new DeviceACPI(parent);
break;
}
}
if (newDevice == NULL) {
+1
View File
@@ -26,6 +26,7 @@
#include "Device.h"
#include "DevicePCI.h"
#include "DeviceACPI.h"
#include "PropertyList.h"
#include "PropertyListPlain.h"
+1
View File
@@ -65,6 +65,7 @@ Application Devices :
DevicesView.cpp
dm_wrapper.c
DevicePCI.cpp
DeviceACPI.cpp
Device.cpp
PropertyList.cpp
PropertyListPlain.cpp