Am 27.10.23 um 19:07 schrieb Guenter Roeck:
On 10/27/23 08:07, Lukasz Stelmach wrote:
Hi,
I've got HP EliteDesk 800 G6 Tower PC running Linux 6.1 from Debian 12.
I managed to build the hp-wmi-sensors out of tree. When I loaded it I
got EINVAL.
hp-wmi-sensors: probe of 8F1F6435-9F42-42C8-BADC-0E9424F20C9A
failed with error -22
I managed to track it down. And it happens in check_wobj() called from
check_platform_events_wobj() because in the for loop when prop==0 the
type is ACPI_TYPE_BUFFER instead of ACPI_TYPE_STRING. When I bypass this
particular check like this
if (prop == 0 && type == ACPI_TYPE_BUFFER)
continue;
everything else works like charm and I can read senosrs via sysfs. I'd
like to perpare a proper patch, but I've got no idea how to do properly
work this quirk around. What are your suggestions?
Kind regards,
I really don't know if that is a bug in the driver or a bug in the WMI
description on that system. Given that, I have no idea how to handle
this.
I also don't know the impact of ACPI_TYPE_BUFFER vs. ACPI_TYPE_STRING;
from the code in the kernel it seems that those values have a distinctly
different meaning. Is the returned value, when extracted, a string ?
Is it ok to accept ACPI_TYPE_BUFFER instead of ACPI_TYPE_STRING for
property names ? I simply don't know.
Hi,
could it be that this ACPI buffer object containst UTF16 characters? If yes, then
the reason for this could be that on Windows, the ACPI-WMI mapper convert the whole
ACPI object into a buffer first, take a look at this:
https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/driver-defined-wmi-data-items
Since the mapper does not know anything about the higher-level content of the ACPI object,
i assume there are conversion rules on how to convert an ACPI object into an WMI buffer.
Maybe the mapper converts an ACPI string object into such a buffer per default?
Are the type checks really needed ? What do other drivers do when
interpreting
WMI data ? Could extract_acpi_value() be more flexible and also accept
ACPI_TYPE_BUFFER, or would that potentially create other problems ?
Lots of questions that at least for my part can not answer.
Guenter
It would be helpful if i had access to the output of acpidump and the BMOFs of this notebook.
If it is indeed possible to find out which conversion rules the Windows driver uses, then
i could create something like this:
int wmidev_invoke_method(struct wmi_device *wdev, u8 instance, u32 method_id, u8 *input, size_t input_size, u8 *output);
It would basically wrap wmidev_evalue_method() and convert the resulting ACPI object into
an general WMI buffer.
Armin Wolf