lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <13a24576-da89-95b8-4ed2-c24b5ba54a21@linux.intel.com>
Date: Tue, 26 Mar 2024 13:49:16 +0200 (EET)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Luke Jones <luke@...nes.dev>
cc: Hans de Goede <hdegoede@...hat.com>, corentin.chary@...il.com, 
    platform-driver-x86@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/9] platform/x86: asus-wmi: add support for 2024 ROG
 Mini-LED

On Tue, 26 Mar 2024, Luke Jones wrote:
> On Tue, 26 Mar 2024, at 2:47 AM, Ilpo Järvinen wrote:
> > On Mon, 25 Mar 2024, Luke D. Jones wrote:
> > 
> > > Support the 2024 mini-led backlight and adjust the related functions
> > > to select the relevant dev-id. Also add `available_mini_led_mode` to the
> > > platform sysfs since the available mini-led levels can be different.
> > > 
> > > Signed-off-by: Luke D. Jones <luke@...nes.dev>
> > > ---

> > > @@ -2109,10 +2110,27 @@ static ssize_t mini_led_mode_show(struct device *dev,
> > >  struct asus_wmi *asus = dev_get_drvdata(dev);
> > >  int result;
> > >  
> > > - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_MINI_LED_MODE);
> > > - if (result < 0)
> > > - return result;
> > > + result = asus_wmi_get_devstate_simple(asus, asus->mini_led_dev_id);
> > >  
> > > + /* Remap the mode values to match previous generation mini-led.
> > > + * Some BIOSes return -19 instead of 2, which is "mini-LED off", this
> > > + * appears to be a  BIOS bug.
> > > + */
> > > + if (asus->mini_led_dev_id == ASUS_WMI_DEVID_MINI_LED_MODE2) {
> > > + switch (result) {
> > > + case 0:
> > > + result = 1;
> > > + break;
> > > + case 1:
> > > + result = 2;
> > > + break;
> > > + case 2:
> > > + case -19:
> > 
> > Can you confirm this -19 really does come from BIOS? Because I suspect 
> > it's -ENODEV error code from from one of the functions on the driver side
> > (which is why I asked you to change it into -ENODEV).
> 
> Yes it does. It is rather annoying. What happens in this case is that 
> `2` is written to the WMI endpoint to turn off the MINI-Led feature, 
> this works fine and it is turned off, there are no errors from the write 
> at all - verifying the accepted limits in dsdt also shows it is correct. 
> 
> However, after that, the read fails once.

Hi,

I'm left a bit unsure how to interpret your response. If "read fails", it 
would indicate that -ENODEV originates from asus_wmi_evaluate_method3(), 
asus_wmi_get_devstate() or asus_wmi_get_devstate_bits(), not from BIOS? So 
which way it is?

After reading some more code, I think I figured out the answer myself.
However, that raises another question... So lets now take a step back and 
walk through the code:

Your patch does:
	result = asus_wmi_get_devstate_simple(asus, asus->mini_led_dev_id);

asus_wmi_get_devstate_simple() calls asus_wmi_get_devstate_bits() with
ASUS_WMI_DSTS_STATUS_BIT mask that is 0x00000001.

If there's no error, retval is masked with that ASUS_WMI_DSTS_STATUS_BIT 
forcing the return value to 0-1 range so:

a) I don't think -19 can originate from BIOS but comes from kernel side.
b) How can it ever return 2 (mini-LED off) ?????

> And only if that `2` was 
> written. `0` and `1` write fine, and read fine also. I hope I've managed 
> to describe and clarify what I'm seeing here.
> 
> I'm happy to change -ENODEV. No problem, queued on my todo list.


-- 
 i.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ