ACK: [PATCH 2/2] acpi: devices: add common objects

Colin Ian King colin.king at canonical.com
Thu Apr 26 07:44:45 UTC 2018


On 23/04/18 08:33, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung at canonical.com>
> ---
>  src/acpi/devices/ac_adapter/ac.c         |  75 ++++++++++++++++++
>  src/acpi/devices/battery/battery.c       |  75 ++++++++++++++++++
>  src/acpi/devices/battery/smart_battery.c |  75 ++++++++++++++++++
>  src/acpi/devices/buttons/power_button.c  | 120 +++++++++++++++-------------
>  src/acpi/devices/buttons/sleep_button.c  | 119 +++++++++++++++-------------
>  src/acpi/devices/ec/ec.c                 | 132 +++++++++++++++++--------------
>  src/acpi/devices/lid/lid.c               |  75 ++++++++++++++++++
>  src/acpi/devices/sensor/als.c            |  75 ++++++++++++++++++
>  src/acpi/devices/time/time.c             |  75 ++++++++++++++++++
>  src/acpi/devices/wpc/wpc.c               |  75 ++++++++++++++++++
>  10 files changed, 723 insertions(+), 173 deletions(-)
> 
> diff --git a/src/acpi/devices/ac_adapter/ac.c b/src/acpi/devices/ac_adapter/ac.c
> index c06d357..7aedd88 100644
> --- a/src/acpi/devices/ac_adapter/ac.c
> +++ b/src/acpi/devices/ac_adapter/ac.c
> @@ -189,11 +189,86 @@ static int method_test_PRL(fwts_framework *fw)
>  		 &device, "_PRL", NULL, 0, method_test_PRL_return, NULL);
>  }
>  
> +/* EvaluateD evice Identification Objects - all are optional */
> +static int method_test_ADR(fwts_framework *fw)
> +{
> +	return fwts_method_test_ADR(fw, &device);
> +}
> +
> +static int method_test_CID(fwts_framework *fw)
> +{
> +	return fwts_method_test_CID(fw, &device);
> +}
> +
> +static int method_test_CLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_CLS(fw, &device);
> +}
> +
> +static int method_test_DDN(fwts_framework *fw)
> +{
> +	return fwts_method_test_DDN(fw, &device);
> +}
> +
> +static int method_test_HID(fwts_framework *fw)
> +{
> +	return fwts_method_test_HID(fw, &device);
> +}
> +
> +static int method_test_HRV(fwts_framework *fw)
> +{
> +	return fwts_method_test_HRV(fw, &device);
> +}
> +
> +static int method_test_MLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_MLS(fw, &device);
> +}
> +
> +static int method_test_PLD(fwts_framework *fw)
> +{
> +	return fwts_method_test_PLD(fw, &device);
> +}
> +
> +static int method_test_SUB(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUB(fw, &device);
> +}
> +
> +static int method_test_SUN(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUN(fw, &device);
> +}
> +
> +static int method_test_STR(fwts_framework *fw)
> +{
> +	return fwts_method_test_STR(fw, &device);
> +}
> +
> +static int method_test_UID(fwts_framework *fw)
> +{
> +	return fwts_method_test_UID(fw, &device);
> +}
> +
>  static fwts_framework_minor_test acpi_ac_tests[] = {
> +	/* Device Specific Objects */
>  	{ method_test_PSR, "Test _PSR (Power Source)." },
>  	{ method_test_PCL, "Test _PCL (Power Consumer List)." },
>  	{ method_test_PIF, "Test _PIF (Power Source Information)." },
>  	{ method_test_PRL, "Test _PRL (Power Source Redundancy List)." },
> +	/* Device Identification Objects - all are optional */
> +	{ method_test_ADR, "Test _ADR (Return Unique ID for Device)." },
> +	{ method_test_CID, "Test _CID (Compatible ID)." },
> +	{ method_test_CLS, "Test _CLS (Class Code)." },
> +	{ method_test_DDN, "Test _DDN (DOS Device Name)." },
> +	{ method_test_HID, "Test _HID (Hardware ID)." },
> +	{ method_test_HRV, "Test _HRV (Hardware Revision Number)." },
> +	{ method_test_MLS, "Test _MLS (Multiple Language String)." },
> +	{ method_test_PLD, "Test _PLD (Physical Device Location)." },
> +	{ method_test_SUB, "Test _SUB (Subsystem ID)." },
> +	{ method_test_SUN, "Test _SUN (Slot User Number)." },
> +	{ method_test_STR, "Test _STR (String)." },
> +	{ method_test_UID, "Test _UID (Unique ID)." },
>  	{ NULL, NULL }
>  };
>  
> diff --git a/src/acpi/devices/battery/battery.c b/src/acpi/devices/battery/battery.c
> index 5fbb373..c5557ff 100644
> --- a/src/acpi/devices/battery/battery.c
> +++ b/src/acpi/devices/battery/battery.c
> @@ -698,7 +698,69 @@ static int method_test_BMC(fwts_framework *fw)
>  	return FWTS_OK;
>  }
>  
> +/* EvaluateD evice Identification Objects - all are optional */
> +static int method_test_ADR(fwts_framework *fw)
> +{
> +	return fwts_method_test_ADR(fw, &device);
> +}
> +
> +static int method_test_CID(fwts_framework *fw)
> +{
> +	return fwts_method_test_CID(fw, &device);
> +}
> +
> +static int method_test_CLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_CLS(fw, &device);
> +}
> +
> +static int method_test_DDN(fwts_framework *fw)
> +{
> +	return fwts_method_test_DDN(fw, &device);
> +}
> +
> +static int method_test_HID(fwts_framework *fw)
> +{
> +	return fwts_method_test_HID(fw, &device);
> +}
> +
> +static int method_test_HRV(fwts_framework *fw)
> +{
> +	return fwts_method_test_HRV(fw, &device);
> +}
> +
> +static int method_test_MLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_MLS(fw, &device);
> +}
> +
> +static int method_test_PLD(fwts_framework *fw)
> +{
> +	return fwts_method_test_PLD(fw, &device);
> +}
> +
> +static int method_test_SUB(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUB(fw, &device);
> +}
> +
> +static int method_test_SUN(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUN(fw, &device);
> +}
> +
> +static int method_test_STR(fwts_framework *fw)
> +{
> +	return fwts_method_test_STR(fw, &device);
> +}
> +
> +static int method_test_UID(fwts_framework *fw)
> +{
> +	return fwts_method_test_UID(fw, &device);
> +}
> +
>  static fwts_framework_minor_test acpi_battery_tests[] = {
> +	/* Device Specific Objects */
>  	{ method_test_BIF, "Test _BIF (Battery Information)." },
>  	{ method_test_BIX, "Test _BIX (Battery Information Extended)." },
>  	{ method_test_BMA, "Test _BMA (Battery Measurement Averaging)." },
> @@ -712,6 +774,19 @@ static fwts_framework_minor_test acpi_battery_tests[] = {
>  	{ method_test_BCT, "Test _BCT (Battery Charge Time)." },
>  	{ method_test_BMD, "Test _BMD (Battery Maintenance Data)." },
>  	{ method_test_BMC, "Test _BMC (Battery Maintenance Control)." },
> +	/* Device Identification Objects - all are optional */
> +	{ method_test_ADR, "Test _ADR (Return Unique ID for Device)." },
> +	{ method_test_CID, "Test _CID (Compatible ID)." },
> +	{ method_test_CLS, "Test _CLS (Class Code)." },
> +	{ method_test_DDN, "Test _DDN (DOS Device Name)." },
> +	{ method_test_HID, "Test _HID (Hardware ID)." },
> +	{ method_test_HRV, "Test _HRV (Hardware Revision Number)." },
> +	{ method_test_MLS, "Test _MLS (Multiple Language String)." },
> +	{ method_test_PLD, "Test _PLD (Physical Device Location)." },
> +	{ method_test_SUB, "Test _SUB (Subsystem ID)." },
> +	{ method_test_SUN, "Test _SUN (Slot User Number)." },
> +	{ method_test_STR, "Test _STR (String)." },
> +	{ method_test_UID, "Test _UID (Unique ID)." },
>  	{ NULL, NULL }
>  };
>  
> diff --git a/src/acpi/devices/battery/smart_battery.c b/src/acpi/devices/battery/smart_battery.c
> index a3f8151..7a2858b 100644
> --- a/src/acpi/devices/battery/smart_battery.c
> +++ b/src/acpi/devices/battery/smart_battery.c
> @@ -121,8 +121,83 @@ static int method_test_SBS(fwts_framework *fw)
>  		"_SBS", NULL, 0, method_test_SBS_return, NULL);
>  }
>  
> +/* EvaluateD evice Identification Objects - all are optional */
> +static int method_test_ADR(fwts_framework *fw)
> +{
> +	return fwts_method_test_ADR(fw, &device);
> +}
> +
> +static int method_test_CID(fwts_framework *fw)
> +{
> +	return fwts_method_test_CID(fw, &device);
> +}
> +
> +static int method_test_CLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_CLS(fw, &device);
> +}
> +
> +static int method_test_DDN(fwts_framework *fw)
> +{
> +	return fwts_method_test_DDN(fw, &device);
> +}
> +
> +static int method_test_HID(fwts_framework *fw)
> +{
> +	return fwts_method_test_HID(fw, &device);
> +}
> +
> +static int method_test_HRV(fwts_framework *fw)
> +{
> +	return fwts_method_test_HRV(fw, &device);
> +}
> +
> +static int method_test_MLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_MLS(fw, &device);
> +}
> +
> +static int method_test_PLD(fwts_framework *fw)
> +{
> +	return fwts_method_test_PLD(fw, &device);
> +}
> +
> +static int method_test_SUB(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUB(fw, &device);
> +}
> +
> +static int method_test_SUN(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUN(fw, &device);
> +}
> +
> +static int method_test_STR(fwts_framework *fw)
> +{
> +	return fwts_method_test_STR(fw, &device);
> +}
> +
> +static int method_test_UID(fwts_framework *fw)
> +{
> +	return fwts_method_test_UID(fw, &device);
> +}
> +
>  static fwts_framework_minor_test smart_battery_tests[] = {
> +	/* Device Specific Objects */
>  	{ method_test_SBS, "Test _SBS (Smart Battery Subsystem)." },
> +	/* Device Identification Objects - all are optional */
> +	{ method_test_ADR, "Test _ADR (Return Unique ID for Device)." },
> +	{ method_test_CID, "Test _CID (Compatible ID)." },
> +	{ method_test_CLS, "Test _CLS (Class Code)." },
> +	{ method_test_DDN, "Test _DDN (DOS Device Name)." },
> +	{ method_test_HID, "Test _HID (Hardware ID)." },
> +	{ method_test_HRV, "Test _HRV (Hardware Revision Number)." },
> +	{ method_test_MLS, "Test _MLS (Multiple Language String)." },
> +	{ method_test_PLD, "Test _PLD (Physical Device Location)." },
> +	{ method_test_SUB, "Test _SUB (Subsystem ID)." },
> +	{ method_test_SUN, "Test _SUN (Slot User Number)." },
> +	{ method_test_STR, "Test _STR (String)." },
> +	{ method_test_UID, "Test _UID (Unique ID)." },
>  	{ NULL, NULL }
>  };
>  
> diff --git a/src/acpi/devices/buttons/power_button.c b/src/acpi/devices/buttons/power_button.c
> index 865043c..4df65ea 100644
> --- a/src/acpi/devices/buttons/power_button.c
> +++ b/src/acpi/devices/buttons/power_button.c
> @@ -76,74 +76,82 @@ static int power_button_init(fwts_framework *fw)
>  	return FWTS_OK;
>  }
>  
> +static int method_test_HID(fwts_framework *fw)
> +{
> +	return fwts_method_test_HID(fw, &device);
> +}
>  
> -static void method_test_HID_return(
> -	fwts_framework *fw,
> -	char *name,
> -	ACPI_BUFFER *buf,
> -	ACPI_OBJECT *obj,
> -	void *private)
> +/* EvaluateD evice Identification Objects - all are optional */
> +static int method_test_ADR(fwts_framework *fw)
>  {
> -	char tmp[8];
> +	return fwts_method_test_ADR(fw, &device);
> +}
>  
> -	FWTS_UNUSED(buf);
> -	FWTS_UNUSED(private);
> +static int method_test_CID(fwts_framework *fw)
> +{
> +	return fwts_method_test_CID(fw, &device);
> +}
>  
> -	if (obj == NULL) {
> -		fwts_method_failed_null_object(fw, name, "a buffer or integer");
> -		return;
> -	}
> +static int method_test_CLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_CLS(fw, &device);
> +}
>  
> -	switch (obj->Type) {
> -	case ACPI_TYPE_STRING:
> -		if (obj->String.Pointer) {
> -			if (fwts_method_valid_HID_string(obj->String.Pointer))
> -				fwts_passed(fw,
> -					"%s returned a string '%s' "
> -					"as expected.",
> -					name, obj->String.Pointer);
> -			else
> -				fwts_failed(fw, LOG_LEVEL_MEDIUM,
> -					"MethodHIDInvalidString",
> -					"%s returned a string '%s' "
> -					"but it was not a valid PNP ID or a "
> -					"valid ACPI ID.",
> -					name, obj->String.Pointer);
> -		} else {
> -			fwts_failed(fw, LOG_LEVEL_MEDIUM,
> -				"Method_HIDNullString",
> -				"%s returned a NULL string.", name);
> -		}
> -		break;
> -	case ACPI_TYPE_INTEGER:
> -		if (fwts_method_valid_EISA_ID((uint32_t)obj->Integer.Value,
> -			tmp, sizeof(tmp)))
> -			fwts_passed(fw, "%s returned an integer "
> -				"0x%8.8" PRIx64 " (EISA ID %s).",
> -				name, (uint64_t)obj->Integer.Value, tmp);
> -		else
> -			fwts_failed(fw, LOG_LEVEL_MEDIUM,
> -				"MethodHIDInvalidInteger",
> -				"%s returned a integer 0x%8.8" PRIx64 " "
> -				"(EISA ID %s) but this is not a valid "
> -				"EISA ID encoded PNP ID.",
> -				name, (uint64_t)obj->Integer.Value, tmp);
> -		break;
> -	default:
> -		fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_HIDBadReturnType",
> -			"%s did not return a string or an integer.", name);
> -		break;
> -	}
> +static int method_test_DDN(fwts_framework *fw)
> +{
> +	return fwts_method_test_DDN(fw, &device);
>  }
>  
> -static int method_test_HID(fwts_framework *fw)
> +static int method_test_HRV(fwts_framework *fw)
> +{
> +	return fwts_method_test_HRV(fw, &device);
> +}
> +
> +static int method_test_MLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_MLS(fw, &device);
> +}
> +
> +static int method_test_PLD(fwts_framework *fw)
> +{
> +	return fwts_method_test_PLD(fw, &device);
> +}
> +
> +static int method_test_SUB(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUB(fw, &device);
> +}
> +
> +static int method_test_SUN(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUN(fw, &device);
> +}
> +
> +static int method_test_STR(fwts_framework *fw)
> +{
> +	return fwts_method_test_STR(fw, &device);
> +}
> +
> +static int method_test_UID(fwts_framework *fw)
>  {
> -	return fwts_evaluate_method(fw, METHOD_MANDATORY, &device,
> -		"_HID", NULL, 0, method_test_HID_return, NULL);
> +	return fwts_method_test_UID(fw, &device);
>  }
>  
>  static fwts_framework_minor_test power_button_tests[] = {
> +	/* Device Specific Objects */
>  	{ method_test_HID, "Test _HID (Hardware ID)." },
> +	/* Device Identification Objects - all are optional */
> +	{ method_test_ADR, "Test _ADR (Return Unique ID for Device)." },
> +	{ method_test_CID, "Test _CID (Compatible ID)." },
> +	{ method_test_CLS, "Test _CLS (Class Code)." },
> +	{ method_test_DDN, "Test _DDN (DOS Device Name)." },
> +	{ method_test_HRV, "Test _HRV (Hardware Revision Number)." },
> +	{ method_test_MLS, "Test _MLS (Multiple Language String)." },
> +	{ method_test_PLD, "Test _PLD (Physical Device Location)." },
> +	{ method_test_SUB, "Test _SUB (Subsystem ID)." },
> +	{ method_test_SUN, "Test _SUN (Slot User Number)." },
> +	{ method_test_STR, "Test _STR (String)." },
> +	{ method_test_UID, "Test _UID (Unique ID)." },
>  	{ NULL, NULL }
>  };
>  
> diff --git a/src/acpi/devices/buttons/sleep_button.c b/src/acpi/devices/buttons/sleep_button.c
> index 7a5d82c..4ea0b59 100644
> --- a/src/acpi/devices/buttons/sleep_button.c
> +++ b/src/acpi/devices/buttons/sleep_button.c
> @@ -75,75 +75,82 @@ static int sleep_button_init(fwts_framework *fw)
>  
>  	return FWTS_OK;
>  }
> +static int method_test_HID(fwts_framework *fw)
> +{
> +	return fwts_method_test_HID(fw, &device);
> +}
>  
> +/* EvaluateD evice Identification Objects - all are optional */
> +static int method_test_ADR(fwts_framework *fw)
> +{
> +	return fwts_method_test_ADR(fw, &device);
> +}
>  
> -static void method_test_HID_return(
> -	fwts_framework *fw,
> -	char *name,
> -	ACPI_BUFFER *buf,
> -	ACPI_OBJECT *obj,
> -	void *private)
> +static int method_test_CID(fwts_framework *fw)
>  {
> -	char tmp[8];
> +	return fwts_method_test_CID(fw, &device);
> +}
>  
> -	FWTS_UNUSED(buf);
> -	FWTS_UNUSED(private);
> +static int method_test_CLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_CLS(fw, &device);
> +}
>  
> -	if (obj == NULL) {
> -		fwts_method_failed_null_object(fw, name, "a buffer or integer");
> -		return;
> -	}
> +static int method_test_DDN(fwts_framework *fw)
> +{
> +	return fwts_method_test_DDN(fw, &device);
> +}
>  
> -	switch (obj->Type) {
> -	case ACPI_TYPE_STRING:
> -		if (obj->String.Pointer) {
> -			if (fwts_method_valid_HID_string(obj->String.Pointer))
> -				fwts_passed(fw,
> -					"%s returned a string '%s' "
> -					"as expected.",
> -					name, obj->String.Pointer);
> -			else
> -				fwts_failed(fw, LOG_LEVEL_MEDIUM,
> -					"MethodHIDInvalidString",
> -					"%s returned a string '%s' "
> -					"but it was not a valid PNP ID or a "
> -					"valid ACPI ID.",
> -					name, obj->String.Pointer);
> -		} else {
> -			fwts_failed(fw, LOG_LEVEL_MEDIUM,
> -				"Method_HIDNullString",
> -				"%s returned a NULL string.", name);
> -		}
> -		break;
> -	case ACPI_TYPE_INTEGER:
> -		if (fwts_method_valid_EISA_ID((uint32_t)obj->Integer.Value,
> -			tmp, sizeof(tmp)))
> -			fwts_passed(fw, "%s returned an integer "
> -				"0x%8.8" PRIx64 " (EISA ID %s).",
> -				name, (uint64_t)obj->Integer.Value, tmp);
> -		else
> -			fwts_failed(fw, LOG_LEVEL_MEDIUM,
> -				"MethodHIDInvalidInteger",
> -				"%s returned a integer 0x%8.8" PRIx64 " "
> -				"(EISA ID %s) but this is not a valid "
> -				"EISA ID encoded PNP ID.",
> -				name, (uint64_t)obj->Integer.Value, tmp);
> -		break;
> -	default:
> -		fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_HIDBadReturnType",
> -			"%s did not return a string or an integer.", name);
> -		break;
> -	}
> +static int method_test_HRV(fwts_framework *fw)
> +{
> +	return fwts_method_test_HRV(fw, &device);
>  }
>  
> -static int method_test_HID(fwts_framework *fw)
> +static int method_test_MLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_MLS(fw, &device);
> +}
> +
> +static int method_test_PLD(fwts_framework *fw)
> +{
> +	return fwts_method_test_PLD(fw, &device);
> +}
> +
> +static int method_test_SUB(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUB(fw, &device);
> +}
> +
> +static int method_test_SUN(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUN(fw, &device);
> +}
> +
> +static int method_test_STR(fwts_framework *fw)
> +{
> +	return fwts_method_test_STR(fw, &device);
> +}
> +
> +static int method_test_UID(fwts_framework *fw)
>  {
> -	return fwts_evaluate_method(fw, METHOD_MANDATORY, &device,
> -		"_HID", NULL, 0, method_test_HID_return, NULL);
> +	return fwts_method_test_UID(fw, &device);
>  }
>  
>  static fwts_framework_minor_test sleep_button_tests[] = {
> +	/* Device Specific Objects */
>  	{ method_test_HID, "Test _HID (Hardware ID)." },
> +	/* Device Identification Objects - all are optional */
> +	{ method_test_ADR, "Test _ADR (Return Unique ID for Device)." },
> +	{ method_test_CID, "Test _CID (Compatible ID)." },
> +	{ method_test_CLS, "Test _CLS (Class Code)." },
> +	{ method_test_DDN, "Test _DDN (DOS Device Name)." },
> +	{ method_test_HRV, "Test _HRV (Hardware Revision Number)." },
> +	{ method_test_MLS, "Test _MLS (Multiple Language String)." },
> +	{ method_test_PLD, "Test _PLD (Physical Device Location)." },
> +	{ method_test_SUB, "Test _SUB (Subsystem ID)." },
> +	{ method_test_SUN, "Test _SUN (Slot User Number)." },
> +	{ method_test_STR, "Test _STR (String)." },
> +	{ method_test_UID, "Test _UID (Unique ID)." },
>  	{ NULL, NULL }
>  };
>  
> diff --git a/src/acpi/devices/ec/ec.c b/src/acpi/devices/ec/ec.c
> index 6b54409..624ef60 100644
> --- a/src/acpi/devices/ec/ec.c
> +++ b/src/acpi/devices/ec/ec.c
> @@ -76,69 +76,9 @@ static int acpi_ec_init(fwts_framework *fw)
>  	return FWTS_OK;
>  }
>  
> -static void method_test_HID_return(
> -	fwts_framework *fw,
> -	char *name,
> -	ACPI_BUFFER *buf,
> -	ACPI_OBJECT *obj,
> -	void *private)
> -{
> -	char tmp[8];
> -
> -	FWTS_UNUSED(buf);
> -	FWTS_UNUSED(private);
> -
> -	if (obj == NULL) {
> -		fwts_method_failed_null_object(fw, name, "a buffer or integer");
> -		return;
> -	}
> -
> -	switch (obj->Type) {
> -	case ACPI_TYPE_STRING:
> -		if (obj->String.Pointer) {
> -			if (fwts_method_valid_HID_string(obj->String.Pointer))
> -				fwts_passed(fw,
> -					"%s returned a string '%s' "
> -					"as expected.",
> -					name, obj->String.Pointer);
> -			else
> -				fwts_failed(fw, LOG_LEVEL_MEDIUM,
> -					"MethodHIDInvalidString",
> -					"%s returned a string '%s' "
> -					"but it was not a valid PNP ID or a "
> -					"valid ACPI ID.",
> -					name, obj->String.Pointer);
> -		} else {
> -			fwts_failed(fw, LOG_LEVEL_MEDIUM,
> -				"Method_HIDNullString",
> -				"%s returned a NULL string.", name);
> -		}
> -		break;
> -	case ACPI_TYPE_INTEGER:
> -		if (fwts_method_valid_EISA_ID((uint32_t)obj->Integer.Value,
> -			tmp, sizeof(tmp)))
> -			fwts_passed(fw, "%s returned an integer "
> -				"0x%8.8" PRIx64 " (EISA ID %s).",
> -				name, (uint64_t)obj->Integer.Value, tmp);
> -		else
> -			fwts_failed(fw, LOG_LEVEL_MEDIUM,
> -				"MethodHIDInvalidInteger",
> -				"%s returned a integer 0x%8.8" PRIx64 " "
> -				"(EISA ID %s) but this is not a valid "
> -				"EISA ID encoded PNP ID.",
> -				name, (uint64_t)obj->Integer.Value, tmp);
> -		break;
> -	default:
> -		fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_HIDBadReturnType",
> -			"%s did not return a string or an integer.", name);
> -		break;
> -	}
> -}
> -
>  static int method_test_HID(fwts_framework *fw)
>  {
> -	return fwts_evaluate_method(fw, METHOD_MANDATORY, &device,
> -		"_HID", NULL, 0, method_test_HID_return, NULL);
> +	return fwts_method_test_HID(fw, &device);
>  }
>  
>  static void method_test_GPE_return(
> @@ -240,10 +180,80 @@ static int method_test_CRS(fwts_framework *fw)
>  		"_CRS", NULL, 0, method_test_CRS_return, NULL);
>  }
>  
> +/* EvaluateD evice Identification Objects - all are optional */
> +static int method_test_ADR(fwts_framework *fw)
> +{
> +	return fwts_method_test_ADR(fw, &device);
> +}
> +
> +static int method_test_CID(fwts_framework *fw)
> +{
> +	return fwts_method_test_CID(fw, &device);
> +}
> +
> +static int method_test_CLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_CLS(fw, &device);
> +}
> +
> +static int method_test_DDN(fwts_framework *fw)
> +{
> +	return fwts_method_test_DDN(fw, &device);
> +}
> +
> +static int method_test_HRV(fwts_framework *fw)
> +{
> +	return fwts_method_test_HRV(fw, &device);
> +}
> +
> +static int method_test_MLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_MLS(fw, &device);
> +}
> +
> +static int method_test_PLD(fwts_framework *fw)
> +{
> +	return fwts_method_test_PLD(fw, &device);
> +}
> +
> +static int method_test_SUB(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUB(fw, &device);
> +}
> +
> +static int method_test_SUN(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUN(fw, &device);
> +}
> +
> +static int method_test_STR(fwts_framework *fw)
> +{
> +	return fwts_method_test_STR(fw, &device);
> +}
> +
> +static int method_test_UID(fwts_framework *fw)
> +{
> +	return fwts_method_test_UID(fw, &device);
> +}
> +
>  static fwts_framework_minor_test acpi_ec_tests[] = {
> +	/* Device Specific Objects */
>  	{ method_test_CRS, "Test _CRS (Current Resource Settings)." },
>  	{ method_test_HID, "Test _HID (Hardware ID)." },
>  	{ method_test_GPE, "Test _GPE (General Purpose Events)." },
> +	/* Device Identification Objects - all are optional */
> +	{ method_test_ADR, "Test _ADR (Return Unique ID for Device)." },
> +	{ method_test_CID, "Test _CID (Compatible ID)." },
> +	{ method_test_CLS, "Test _CLS (Class Code)." },
> +	{ method_test_DDN, "Test _DDN (DOS Device Name)." },
> +	{ method_test_HID, "Test _HID (Hardware ID)." },
> +	{ method_test_HRV, "Test _HRV (Hardware Revision Number)." },
> +	{ method_test_MLS, "Test _MLS (Multiple Language String)." },
> +	{ method_test_PLD, "Test _PLD (Physical Device Location)." },
> +	{ method_test_SUB, "Test _SUB (Subsystem ID)." },
> +	{ method_test_SUN, "Test _SUN (Slot User Number)." },
> +	{ method_test_STR, "Test _STR (String)." },
> +	{ method_test_UID, "Test _UID (Unique ID)." },
>  	{ NULL, NULL }
>  };
>  
> diff --git a/src/acpi/devices/lid/lid.c b/src/acpi/devices/lid/lid.c
> index 4910015..031d349 100644
> --- a/src/acpi/devices/lid/lid.c
> +++ b/src/acpi/devices/lid/lid.c
> @@ -189,10 +189,85 @@ static int method_test_PSW(fwts_framework *fw)
>  		&device, "_PSW", arg, 1, fwts_method_test_NULL_return, NULL);
>  }
>  
> +/* EvaluateD evice Identification Objects - all are optional */
> +static int method_test_ADR(fwts_framework *fw)
> +{
> +	return fwts_method_test_ADR(fw, &device);
> +}
> +
> +static int method_test_CID(fwts_framework *fw)
> +{
> +	return fwts_method_test_CID(fw, &device);
> +}
> +
> +static int method_test_CLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_CLS(fw, &device);
> +}
> +
> +static int method_test_DDN(fwts_framework *fw)
> +{
> +	return fwts_method_test_DDN(fw, &device);
> +}
> +
> +static int method_test_HID(fwts_framework *fw)
> +{
> +	return fwts_method_test_HID(fw, &device);
> +}
> +
> +static int method_test_HRV(fwts_framework *fw)
> +{
> +	return fwts_method_test_HRV(fw, &device);
> +}
> +
> +static int method_test_MLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_MLS(fw, &device);
> +}
> +
> +static int method_test_PLD(fwts_framework *fw)
> +{
> +	return fwts_method_test_PLD(fw, &device);
> +}
> +
> +static int method_test_SUB(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUB(fw, &device);
> +}
> +
> +static int method_test_SUN(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUN(fw, &device);
> +}
> +
> +static int method_test_STR(fwts_framework *fw)
> +{
> +	return fwts_method_test_STR(fw, &device);
> +}
> +
> +static int method_test_UID(fwts_framework *fw)
> +{
> +	return fwts_method_test_UID(fw, &device);
> +}
> +
>  static fwts_framework_minor_test acpi_lid_tests[] = {
> +	/* Device Specific Objects */
>  	{ method_test_LID, "Test _LID (Lid Status)." },
>  	{ method_test_PRW, "Test _PRW (Power Resources for Wake)." },
>  	{ method_test_PSW, "Test _PSW (Power State Wake)." },
> +	/* Device Identification Objects - all are optional */
> +	{ method_test_ADR, "Test _ADR (Return Unique ID for Device)." },
> +	{ method_test_CID, "Test _CID (Compatible ID)." },
> +	{ method_test_CLS, "Test _CLS (Class Code)." },
> +	{ method_test_DDN, "Test _DDN (DOS Device Name)." },
> +	{ method_test_HID, "Test _HID (Hardware ID)." },
> +	{ method_test_HRV, "Test _HRV (Hardware Revision Number)." },
> +	{ method_test_MLS, "Test _MLS (Multiple Language String)." },
> +	{ method_test_PLD, "Test _PLD (Physical Device Location)." },
> +	{ method_test_SUB, "Test _SUB (Subsystem ID)." },
> +	{ method_test_SUN, "Test _SUN (Slot User Number)." },
> +	{ method_test_STR, "Test _STR (String)." },
> +	{ method_test_UID, "Test _UID (Unique ID)." },
>  	{ NULL, NULL }
>  };
>  
> diff --git a/src/acpi/devices/sensor/als.c b/src/acpi/devices/sensor/als.c
> index bd8a792..0a5821e 100644
> --- a/src/acpi/devices/sensor/als.c
> +++ b/src/acpi/devices/sensor/als.c
> @@ -164,12 +164,87 @@ static int method_test_ALP(fwts_framework *fw)
>  		"_ALP", NULL, 0, fwts_method_test_polling_return, "_ALP");
>  }
>  
> +/* EvaluateD evice Identification Objects - all are optional */
> +static int method_test_ADR(fwts_framework *fw)
> +{
> +	return fwts_method_test_ADR(fw, &device);
> +}
> +
> +static int method_test_CID(fwts_framework *fw)
> +{
> +	return fwts_method_test_CID(fw, &device);
> +}
> +
> +static int method_test_CLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_CLS(fw, &device);
> +}
> +
> +static int method_test_DDN(fwts_framework *fw)
> +{
> +	return fwts_method_test_DDN(fw, &device);
> +}
> +
> +static int method_test_HID(fwts_framework *fw)
> +{
> +	return fwts_method_test_HID(fw, &device);
> +}
> +
> +static int method_test_HRV(fwts_framework *fw)
> +{
> +	return fwts_method_test_HRV(fw, &device);
> +}
> +
> +static int method_test_MLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_MLS(fw, &device);
> +}
> +
> +static int method_test_PLD(fwts_framework *fw)
> +{
> +	return fwts_method_test_PLD(fw, &device);
> +}
> +
> +static int method_test_SUB(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUB(fw, &device);
> +}
> +
> +static int method_test_SUN(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUN(fw, &device);
> +}
> +
> +static int method_test_STR(fwts_framework *fw)
> +{
> +	return fwts_method_test_STR(fw, &device);
> +}
> +
> +static int method_test_UID(fwts_framework *fw)
> +{
> +	return fwts_method_test_UID(fw, &device);
> +}
> +
>  static fwts_framework_minor_test ambient_light_tests[] = {
> +	/* Device Specific Objects */
>  	{ method_test_ALI, "Test _ALI (Ambient Light Illuminance)." },
>  	{ method_test_ALC, "Test _ALC (Ambient Light Colour Chromaticity)." },
>  	{ method_test_ALT, "Test _ALT (Ambient Light Temperature)." },
>  	{ method_test_ALR, "Test _ALR (Ambient Light Response)."},
>  	{ method_test_ALP, "Test _ALP (Ambient Light Polling)."},
> +	/* Device Identification Objects - all are optional */
> +	{ method_test_ADR, "Test _ADR (Return Unique ID for Device)." },
> +	{ method_test_CID, "Test _CID (Compatible ID)." },
> +	{ method_test_CLS, "Test _CLS (Class Code)." },
> +	{ method_test_DDN, "Test _DDN (DOS Device Name)." },
> +	{ method_test_HID, "Test _HID (Hardware ID)." },
> +	{ method_test_HRV, "Test _HRV (Hardware Revision Number)." },
> +	{ method_test_MLS, "Test _MLS (Multiple Language String)." },
> +	{ method_test_PLD, "Test _PLD (Physical Device Location)." },
> +	{ method_test_SUB, "Test _SUB (Subsystem ID)." },
> +	{ method_test_SUN, "Test _SUN (Slot User Number)." },
> +	{ method_test_STR, "Test _STR (String)." },
> +	{ method_test_UID, "Test _UID (Unique ID)." },
>  	{ NULL, NULL }
>  };
>  
> diff --git a/src/acpi/devices/time/time.c b/src/acpi/devices/time/time.c
> index 2c4b376..27ddf9e 100644
> --- a/src/acpi/devices/time/time.c
> +++ b/src/acpi/devices/time/time.c
> @@ -308,7 +308,69 @@ static int method_test_TIV(fwts_framework *fw)
>  		"_TIV", arg, 1, fwts_method_test_integer_return, NULL);
>  }
>  
> +/* EvaluateD evice Identification Objects - all are optional */
> +static int method_test_ADR(fwts_framework *fw)
> +{
> +	return fwts_method_test_ADR(fw, &device);
> +}
> +
> +static int method_test_CID(fwts_framework *fw)
> +{
> +	return fwts_method_test_CID(fw, &device);
> +}
> +
> +static int method_test_CLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_CLS(fw, &device);
> +}
> +
> +static int method_test_DDN(fwts_framework *fw)
> +{
> +	return fwts_method_test_DDN(fw, &device);
> +}
> +
> +static int method_test_HID(fwts_framework *fw)
> +{
> +	return fwts_method_test_HID(fw, &device);
> +}
> +
> +static int method_test_HRV(fwts_framework *fw)
> +{
> +	return fwts_method_test_HRV(fw, &device);
> +}
> +
> +static int method_test_MLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_MLS(fw, &device);
> +}
> +
> +static int method_test_PLD(fwts_framework *fw)
> +{
> +	return fwts_method_test_PLD(fw, &device);
> +}
> +
> +static int method_test_SUB(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUB(fw, &device);
> +}
> +
> +static int method_test_SUN(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUN(fw, &device);
> +}
> +
> +static int method_test_STR(fwts_framework *fw)
> +{
> +	return fwts_method_test_STR(fw, &device);
> +}
> +
> +static int method_test_UID(fwts_framework *fw)
> +{
> +	return fwts_method_test_UID(fw, &device);
> +}
> +
>  static fwts_framework_minor_test acpi_time_alarm_tests[] = {
> +	/* Device Specific Objects */
>  	{ method_test_GCP, "Test _GCP (Get Capabilities)." },
>  	{ method_test_GRT, "Test _GRT (Get Real Time)." },
>  	{ method_test_SRT, "Test _SRT (Set Real Time)." },
> @@ -318,6 +380,19 @@ static fwts_framework_minor_test acpi_time_alarm_tests[] = {
>  	{ method_test_STV, "Test _STV (Set Timer Value)." },
>  	{ method_test_TIP, "Test _TIP (Expired Timer Wake Policy)." },
>  	{ method_test_TIV, "Test _TIV (Timer Values)." },
> +	/* Device Identification Objects - all are optional */
> +	{ method_test_ADR, "Test _ADR (Return Unique ID for Device)." },
> +	{ method_test_CID, "Test _CID (Compatible ID)." },
> +	{ method_test_CLS, "Test _CLS (Class Code)." },
> +	{ method_test_DDN, "Test _DDN (DOS Device Name)." },
> +	{ method_test_HID, "Test _HID (Hardware ID)." },
> +	{ method_test_HRV, "Test _HRV (Hardware Revision Number)." },
> +	{ method_test_MLS, "Test _MLS (Multiple Language String)." },
> +	{ method_test_PLD, "Test _PLD (Physical Device Location)." },
> +	{ method_test_SUB, "Test _SUB (Subsystem ID)." },
> +	{ method_test_SUN, "Test _SUN (Slot User Number)." },
> +	{ method_test_STR, "Test _STR (String)." },
> +	{ method_test_UID, "Test _UID (Unique ID)." },
>  	{ NULL, NULL }
>  };
>  
> diff --git a/src/acpi/devices/wpc/wpc.c b/src/acpi/devices/wpc/wpc.c
> index a68d4cf..10d221e 100644
> --- a/src/acpi/devices/wpc/wpc.c
> +++ b/src/acpi/devices/wpc/wpc.c
> @@ -109,9 +109,84 @@ static int method_test_WPP(fwts_framework *fw)
>  	 "_WPP", NULL, 0, fwts_method_test_integer_return, NULL);
>  }
>  
> +/* EvaluateD evice Identification Objects - all are optional */
> +static int method_test_ADR(fwts_framework *fw)
> +{
> +	return fwts_method_test_ADR(fw, &device);
> +}
> +
> +static int method_test_CID(fwts_framework *fw)
> +{
> +	return fwts_method_test_CID(fw, &device);
> +}
> +
> +static int method_test_CLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_CLS(fw, &device);
> +}
> +
> +static int method_test_DDN(fwts_framework *fw)
> +{
> +	return fwts_method_test_DDN(fw, &device);
> +}
> +
> +static int method_test_HID(fwts_framework *fw)
> +{
> +	return fwts_method_test_HID(fw, &device);
> +}
> +
> +static int method_test_HRV(fwts_framework *fw)
> +{
> +	return fwts_method_test_HRV(fw, &device);
> +}
> +
> +static int method_test_MLS(fwts_framework *fw)
> +{
> +	return fwts_method_test_MLS(fw, &device);
> +}
> +
> +static int method_test_PLD(fwts_framework *fw)
> +{
> +	return fwts_method_test_PLD(fw, &device);
> +}
> +
> +static int method_test_SUB(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUB(fw, &device);
> +}
> +
> +static int method_test_SUN(fwts_framework *fw)
> +{
> +	return fwts_method_test_SUN(fw, &device);
> +}
> +
> +static int method_test_STR(fwts_framework *fw)
> +{
> +	return fwts_method_test_STR(fw, &device);
> +}
> +
> +static int method_test_UID(fwts_framework *fw)
> +{
> +	return fwts_method_test_UID(fw, &device);
> +}
> +
>  static fwts_framework_minor_test acpi_wpc_tests[] = {
> +	/* Device Specific Objects */
>  	{ method_test_WPC, "Test _WPC (Wireless Power Calibration)." },
>  	{ method_test_WPP, "Test _WPP (Wireless Power Polling)." },
> +	/* Device Identification Objects - all are optional */
> +	{ method_test_ADR, "Test _ADR (Return Unique ID for Device)." },
> +	{ method_test_CID, "Test _CID (Compatible ID)." },
> +	{ method_test_CLS, "Test _CLS (Class Code)." },
> +	{ method_test_DDN, "Test _DDN (DOS Device Name)." },
> +	{ method_test_HID, "Test _HID (Hardware ID)." },
> +	{ method_test_HRV, "Test _HRV (Hardware Revision Number)." },
> +	{ method_test_MLS, "Test _MLS (Multiple Language String)." },
> +	{ method_test_PLD, "Test _PLD (Physical Device Location)." },
> +	{ method_test_SUB, "Test _SUB (Subsystem ID)." },
> +	{ method_test_SUN, "Test _SUN (Slot User Number)." },
> +	{ method_test_STR, "Test _STR (String)." },
> +	{ method_test_UID, "Test _UID (Unique ID)." },
>  	{ NULL, NULL }
>  };
>  
> 
Acked-by: Colin Ian King <colin.king at canonical.com>



More information about the fwts-devel mailing list