Fix for Bug #14822 Apps/Devices ACPI button handling
* Patch checks for pathless results, and in cases where acpi/hid is returned uses the hid element. In case of any non-hid nodes returning no path, a separate "unknown" entry is also added. * Also disables one "not implemented" message in line with https://review.haiku-os.org/c/haiku/+/696 Change-Id: I7ac92c7f3c5cb03401b9502aa345a86f117a5a20 Reviewed-on: https://review.haiku-os.org/c/879 Reviewed-by: Axel Dörfler <[email protected]>
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008-2010 Haiku Inc. All rights reserved.
|
* Copyright 2008-2019 Haiku Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
|
* Rob Gill <[email protected]>
|
||||||
* Alexander von Gluck (kallisti5)
|
* Alexander von Gluck (kallisti5)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -36,8 +37,10 @@ DeviceACPI::InitFromAttributes()
|
|||||||
BString outlineName;
|
BString outlineName;
|
||||||
BString nodeACPIPath;
|
BString nodeACPIPath;
|
||||||
BString rootACPIPath;
|
BString rootACPIPath;
|
||||||
|
BString nodeACPIHid;
|
||||||
|
|
||||||
rootACPIPath = nodeACPIPath = GetAttribute("acpi/path").fValue;
|
rootACPIPath = nodeACPIPath = GetAttribute("acpi/path").fValue;
|
||||||
|
nodeACPIHid = GetAttribute("acpi/hid").fValue;
|
||||||
|
|
||||||
// Grab just the root node info
|
// Grab just the root node info
|
||||||
// We grab 6 characters to not identify sub nodes of root node
|
// We grab 6 characters to not identify sub nodes of root node
|
||||||
@@ -60,16 +63,28 @@ DeviceACPI::InitFromAttributes()
|
|||||||
outlineName << string.String();
|
outlineName << string.String();
|
||||||
} else if (rootACPIPath == "\\_SI_") {
|
} else if (rootACPIPath == "\\_SI_") {
|
||||||
outlineName = B_TRANSLATE("ACPI System Indicator");
|
outlineName = B_TRANSLATE("ACPI System Indicator");
|
||||||
} else {
|
} else if (nodeACPIPath != "") {
|
||||||
// This allows to localize apostrophes, too
|
// This allows to localize apostrophes, too
|
||||||
BString string(B_TRANSLATE("ACPI node '%1'"));
|
BString string(B_TRANSLATE("ACPI node '%1'"));
|
||||||
string.ReplaceFirst("%1", nodeACPIPath);
|
string.ReplaceFirst("%1", nodeACPIPath);
|
||||||
outlineName << string.String();
|
outlineName << string.String();
|
||||||
}
|
} else if (nodeACPIPath == "" && nodeACPIHid != "") {
|
||||||
|
// Handle ACPI HID entries that do not return a path
|
||||||
|
nodeACPIHid.Remove(0, nodeACPIHid.FindLast("_") + 1);
|
||||||
|
BString string(B_TRANSLATE("ACPI Button '%1'"));
|
||||||
|
string.ReplaceFirst("%1", nodeACPIHid);
|
||||||
|
outlineName << string.String();
|
||||||
|
} else {
|
||||||
|
BString string(B_TRANSLATE("ACPI <unknown>"));
|
||||||
|
outlineName << string.String();
|
||||||
|
}
|
||||||
|
|
||||||
SetAttribute(B_TRANSLATE("Device name"), outlineName.String());
|
SetAttribute(B_TRANSLATE("Device name"), outlineName.String());
|
||||||
|
#if 0
|
||||||
|
// These are a source of confusion for users.
|
||||||
|
// Until we can display something useful, let's not show the lines at all.
|
||||||
SetAttribute(B_TRANSLATE("Manufacturer"), B_TRANSLATE("Not implemented"));
|
SetAttribute(B_TRANSLATE("Manufacturer"), B_TRANSLATE("Not implemented"));
|
||||||
|
#endif
|
||||||
SetText(outlineName.String());
|
SetText(outlineName.String());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user