[PATCH] acpi: method: print out BCL brightness levels rather than dump the object

Colin King colin.king at canonical.com
Tue Feb 19 10:55:34 UTC 2013


From: Colin Ian King <colin.king at canonical.com>

Instead of doing an object dump of the _BCL return package we should
print out the brightness levels in a easier to understand formatted
form.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/acpi/method/method.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
index 09aef38..906ebc0 100644
--- a/src/acpi/method/method.c
+++ b/src/acpi/method/method.c
@@ -4560,6 +4560,7 @@ static void method_test_BCL_return(
 	uint32_t i;
 	bool failed = false;
 	bool ascending_levels = false;
+	char *str = NULL;
 
 	FWTS_UNUSED(private);
 
@@ -4572,8 +4573,6 @@ static void method_test_BCL_return(
 	if (method_package_elements_all_type(fw, name, "_BCL", obj, ACPI_TYPE_INTEGER) != FWTS_OK)
 		return;
 
-	fwts_acpi_object_dump(fw, obj);
-
 	if (obj->Package.Elements[0].Integer.Value <
 	    obj->Package.Elements[1].Integer.Value) {
 		fwts_failed(fw, LOG_LEVEL_MEDIUM,
@@ -4614,6 +4613,24 @@ static void method_test_BCL_return(
 		failed = true;
 	}
 
+	fwts_log_info(fw, "Brightness levels for %s:" ,name);
+	fwts_log_info_verbatum(fw, "  Level on full power   : %" PRIu64, obj->Package.Elements[0].Integer.Value);
+	fwts_log_info_verbatum(fw, "  Level on battery power: %" PRIu64, obj->Package.Elements[1].Integer.Value);
+	for (i = 2; i < obj->Package.Count; i++) {
+		char tmp[12];
+
+		snprintf(tmp, sizeof(tmp), "%s%" PRIu64,
+			i == 2 ? "" : ", ",
+			obj->Package.Elements[i].Integer.Value);
+		str = fwts_realloc_strcat(str, tmp);
+		if (!str)
+			break;
+	}
+	if (str) {
+		fwts_log_info_verbatum(fw, "  Brightness Levels     : %s", str);
+		free(str);
+	}
+
 	if (failed)
 		fwts_advice(fw,
 			"%s seems to be "
-- 
1.8.1.2




More information about the fwts-devel mailing list