Hello,
I’ve searched this forum but didn’t find decision of my problem. I’m new to driver development. I develop driver for the custom SMBus device and I want to get access through ACPI methods. Just for training I try to evaluate any ACPI method of any device. For example, get temperature of the thermal zone. So, I have the following code in my DSDT table:
ThermalZone(DTSZ)
{
Method(_TMP, 0, Serialized)
{
If(LEqual(OSTH, 0x00))
{
_TZ.INTM(0x00)
Store(0x01, OSTH)
}
Return(GTTP(0x00))
}
}
I try to call this method from my driver. So, I wrote driver that creates device, accepts some ioctl from user mode and returns this temperature to user. I try to evaluate this ACPI method.
So, “DeviceTree” utility shows device with name “\Device\0000006c”, device ID “ACPI\ThermalZone” and instance ID “DTSZ”. I suppose that I should send IOCTL_ACPI_EVAL_METHOD request to this device for getting temperature.
I fill input buffer:
inputBuffer.MethodNameAsUlong = (ULONG)(‘PMT_’);
inputBuffer.Signature = ACPI_EVAL_INPUT_BUFFER_SIGNATURE;
Then I find device by name (it’s successful):
RtlInitUnicodeString(&TargetDeviceName, L"\Device\0000006c");
status = IoGetDeviceObjectPointer(&TargetDeviceName, FILE_READ_DATA, &pFileObject, &pTargetDevice);
And finally I build request (it’s successful too) and call IoCallDriver:
pIrp = IoBuildDeviceIoControlRequest(IOCTL_ACPI_EVAL_METHOD, pTargetDevice, &inputBuffer, sizeof(ACPI_EVAL_INPUT_BUFFER), &outputBuffer, sizeof(ACPI_EVAL_OUTPUT_BUFFER), FALSE, &Event, &IoStatus);
status = IoCallDriver(pTargetDevice, pIrp);
IoCallDriver returns STATUS_NOT_SUPPORTED ("The request is not supported.
").
Please tell me, what I’m doing wrong and what I should do to evaluate this ACPI method. Thanks in advance.