2 * Copyright 2008-2010 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Alexander von Gluck (kallisti5)
10 #include "DeviceACPI.h"
17 #undef B_TRANSLATION_CONTEXT
18 #define B_TRANSLATION_CONTEXT "DeviceACPI"
21 DeviceACPI::DeviceACPI(Device
* parent
)
28 DeviceACPI::~DeviceACPI()
34 DeviceACPI::InitFromAttributes()
40 rootACPIPath
= nodeACPIPath
= GetAttribute("acpi/path").fValue
;
42 // Grab just the root node info
43 // We grab 6 characters to not identify sub nodes of root node
44 rootACPIPath
.Truncate(6);
45 // Grab node leaf name
46 nodeACPIPath
.Remove(0, nodeACPIPath
.FindLast(".") + 1);
48 fCategory
= (Category
)CAT_ACPI
;
50 // Identify Predefined root namespaces (ACPI Spec 4.0a, p162)
51 if (rootACPIPath
== "\\_SB_") {
52 outlineName
= B_TRANSLATE("ACPI System Bus");
53 } else if (rootACPIPath
== "\\_TZ_") {
54 outlineName
= B_TRANSLATE("ACPI Thermal Zone");
55 } else if (rootACPIPath
== "\\_PR_.") {
56 // This allows to localize apostrophes, too
57 BString
string(B_TRANSLATE("ACPI Processor Namespace '%2'"));
58 string
.ReplaceFirst("%2", nodeACPIPath
);
59 // each CPU node is considered a root node
60 outlineName
<< string
.String();
61 } else if (rootACPIPath
== "\\_SI_") {
62 outlineName
= B_TRANSLATE("ACPI System Indicator");
64 // This allows to localize apostrophes, too
65 BString
string(B_TRANSLATE("ACPI node '%1'"));
66 string
.ReplaceFirst("%1", nodeACPIPath
);
67 outlineName
<< string
.String();
70 SetAttribute(B_TRANSLATE("Device name"), outlineName
.String());
71 SetAttribute(B_TRANSLATE("Manufacturer"), B_TRANSLATE("Not implemented"));
73 SetText(outlineName
.String());
78 DeviceACPI::GetBusAttributes()
80 // Push back things that matter for ACPI
81 Attributes attributes
;
82 attributes
.push_back(GetAttribute("device/bus"));
83 attributes
.push_back(GetAttribute("acpi/path"));
84 attributes
.push_back(GetAttribute("acpi/type"));
90 DeviceACPI::GetBusStrings()
92 BString
str(B_TRANSLATE("Class Info:\t\t\t\t: %classInfo%"));
93 str
.ReplaceFirst("%classInfo%", fAttributeMap
["Class Info"]);
100 DeviceACPI::GetBusTabName()
102 return B_TRANSLATE("ACPI Information");