[PATCH] acpi/method: check levels on full power and battery power
Alex Hung
alex.hung at canonical.com
Wed Jan 30 20:38:02 UTC 2019
This checks whether 1st (full) and 2nd (battery) levels are also in the
brightness levels.
Signed-off-by: Alex Hung <alex.hung at canonical.com>
---
src/acpi/method/method.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
index 654112d9..91156d1a 100644
--- a/src/acpi/method/method.c
+++ b/src/acpi/method/method.c
@@ -5460,6 +5460,7 @@ static void method_test_BCL_return(
uint32_t i;
bool failed = false;
bool ascending_levels = false;
+ bool matching_levels;
char *str = NULL;
FWTS_UNUSED(private);
@@ -5511,6 +5512,42 @@ static void method_test_BCL_return(
failed = true;
}
+ matching_levels = false;
+ for (i = 2; i < obj->Package.Count; i++) {
+ if (obj->Package.Elements[0].Integer.Value ==
+ obj->Package.Elements[i].Integer.Value) {
+ matching_levels = true;
+ break;
+ }
+ }
+
+ if (!matching_levels) {
+ failed = true;
+ fwts_failed(fw, LOG_LEVEL_CRITICAL,
+ "Method_BCLFullNotInList",
+ "brightness level on full power (%" PRIu64
+ ") is not in brightness levels.",
+ obj->Package.Elements[0].Integer.Value);
+ }
+
+ matching_levels = false;
+ for (i = 2; i < obj->Package.Count; i++) {
+ if (obj->Package.Elements[1].Integer.Value ==
+ obj->Package.Elements[i].Integer.Value) {
+ matching_levels = true;
+ break;
+ }
+ }
+
+ if (!matching_levels) {
+ failed = true;
+ fwts_failed(fw, LOG_LEVEL_CRITICAL,
+ "Method_BCLBatteryNotInList",
+ "brightness level on battery (%" PRIu64
+ ") is not in brightness levels.",
+ obj->Package.Elements[1].Integer.Value);
+ }
+
fwts_log_info(fw, "Brightness levels for %s:" ,name);
fwts_log_info_verbatim(fw, " Level on full power : %" PRIu64,
(uint64_t)obj->Package.Elements[0].Integer.Value);
--
2.17.1
More information about the fwts-devel
mailing list