Skip to contentSkip to conversation

Problems evaluating WMI method

DISCUSSION Duarte Silva 2 participants 3 messages Oct 1, 2008 ACPI

lore
Share & tools
lore
#0 lore raw

Hi,

I found out the problem. Looking at a part on the WMAB code

Method (WMAB, 3, Serialized)

{
    Store (Arg0, MAR0)
    Store (Arg1, MAR1)
    Store (Arg2, MAR2)
    (...)

    If (LEqual (MAR0, 0x33))
    {
        If (LEqual (MAR1, One))
        {
            If (ECON)
            {
                Store (^^PCI0.LPCB.EC.DFAN, Local0)
            }
            (...)
            Return (Local0)
       }
       (...)

I know the posible values for DFAN, they are 12, 22 and 2. This are the states of the laptop fan. So when I do WMAB(0x33, 0x01, 0x00) it should return one of those values. In wmi.c we got this

acpi_status wmi_evaluate_method(const char *guid_string, u8 instance, u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out)

{
    (...)
    input.count = 2;
    input.pointer = params;
    params[0].type = ACPI_TYPE_INTEGER;
    params[0].integer.value = instance;
    params[1].type = ACPI_TYPE_INTEGER;
    params[1].integer.value = method_id;

    if (in) {
        input.count = 3;

        if (block->flags & ACPI_WMI_STRING) {
            params[2].type = ACPI_TYPE_STRING;
        } else {
            params[2].type = ACPI_TYPE_BUFFER;
        }
        params[2].buffer.length = in->length;
        params[2].buffer.pointer = in->pointer;
    }

    strncat(method, block->object_id, 2);

    status = acpi_evaluate_object(handle, method, &input, out);

So, when I try to evaluate the WMAB method, the parameters will be screwed up because we are not only passing the structure, we are also passing the instance and the method_id to WMAB. The following is a stack look like representation.

[CORRECT] [CURRENT]

arg0           instance -> gets to be the Arg0
arg1           method_id -> gets to be the Arg1
arg2           arg0 -> gets to be the Arg2

arg1
arg2

I got the correct answer when I do instance = 0x33 and method_id = 0x01. So, I looked at hp-wmi.c code and acer-wmi.c and they depend on this instance and method_id. But my laptop doesnt seem to depend. Is this instance and method_id a WMI standart or is it a HP and Acer laptop specific? My laptop is a LG.

#1 lore raw
Quoted 3 lines · On Wednesday 01 October 2008 21:13:50 Duarte Silva wrote:

I got the correct answer when I do instance = 0x33 and method_id = 0x01. So, I looked at hp-wmi.c code and acer-wmi.c and they depend on this instance and method_id. But my laptop doesnt seem to depend.

acer-wmi doesn't rely on the instance_id, it just gets ignored. It does use the method_id though.

Quoted 3 lines

Is this
instance and method_id a WMI standart or is it a HP and Acer laptop specific? My laptop is a LG.

Yes, these are part of the WMI standard (in that, they need to be passed in). I would recommend you read through the spec:

http://web.archive.org/web/20071011004327/http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx

Essentially - you need to pass the instance and method id's, but what values you pass and their meaning is completely vendor specific (which is pretty much a good summary of ACPI-WMI in general).

-Carlos

Signature · 3 lines
E-Mail: [email protected]
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D
#2 lore raw
Quoted 15 lines · On Wednesday 01 October 2008 21:26:28 Carlos Corbacho wrote:
Quoted 3 lines · On Wednesday 01 October 2008 21:13:50 Duarte Silva wrote:

I got the correct answer when I do instance = 0x33 and method_id = 0x01. So, I looked at hp-wmi.c code and acer-wmi.c and they depend on this instance and method_id. But my laptop doesnt seem to depend.

acer-wmi doesn't rely on the instance_id, it just gets ignored. It does use the method_id though.

Quoted 3 lines

Is this
instance and method_id a WMI standart or is it a HP and Acer laptop specific? My laptop is a LG.

Yes, these are part of the WMI standard (in that, they need to be passed in). I would recommend you read through the spec:

Quoted 8 lines

http://web.archive.org/web/20071011004327/http://www.microsoft.com/whdc/sys
tem/pnppwr/wmi/wmi-acpi.mspx

Essentially - you need to pass the instance and method id's, but what values you pass and their meaning is completely vendor specific (which is pretty much a good summary of ACPI-WMI in general).

-Carlos

Oh, I got it, so it doesnt have a standart meaning, now it makes sence. In my case when you pass 0x01 as the method_id you are saying you want to get the value defined by the instance variable. Other values for the method_id can mean other actions. Thanks for the help Carlos :)