From: Luke Jones <luke@ljones.dev>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
Mark Gross <markgross@kernel.org>,
Platform Driver <platform-driver-x86@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 3/6] asus-wmi: Implement TUF laptop keyboard power states
Date: Tue, 09 Aug 2022 11:27:33 +1200 [thread overview]
Message-ID: <X5LBGR.15DO7CCYH6ER@ljones.dev> (raw)
In-Reply-To: <CAHp75VdNa8csSF5Je87kOzC3EQ4yetZqpxXFZu1D7C4A6XCTNg@mail.gmail.com>
Hi Andy
>> + flags = 0;
>
> This can be done before 'if (boot)'
Okay done.
>
>> + if (sscanf(buf, "%hhd %hhd %hhd %hhd %hhd", &save, &boot,
>> &awake, &sleep, &keyboard) != 5)
>> + return -EINVAL;
>
> Same Q here: wouldn't it be better to put each of the parameters to a
> separate sysfs node? Or look at the LED ABI (that what Pavel mentioned
> for multi-color patterns) and see if there are already some
> established ways of how to represent necessary information?
Same argument I make for the RGB mode nodes. But here I think it's
probably even more pertinent. The reasons I would like to keep this as
one node are:
- It's separate to the RGB part
- We can't read the device to set defaults on boot
- Because of the above, if we set a default and the user wants to
change perhaps "sleep", then we're going to have to write some
incorrect guess data since the write requires all the flags at once
- One way to improve the UX is to add _show, but then this has to
display incorrect data on boot
- We end up with 5 more nodes
The same reasons above apply to the RGB nodes, which right now I'm of
two minds about. We'll see which way the RGB mode patch goes after some
daily use.
>
>> + save = save == 0 ? 0x0100 : 0x0000;
>
> if (save)
> flags = BIT(8);
I didn't know about BIT(). Will do.
>
>> + if (boot)
>> + flags |= 0x02;
>> + if (awake)
>> + flags |= 0x08;
>> + if (sleep)
>> + flags |= 0x20;
>> + if (keyboard)
>> + flags |= 0x80;
>
> Use BIT() for flags.
>
> ...
>
>> + err = asus_wmi_evaluate_method3(ASUS_WMI_METHODID_DEVS,
>> + ASUS_WMI_DEVID_TUF_RGB_STATE, 0xBD | save |
>> (flags << 16), 0, &ret);
>
> Why not provide flags to be a full 32-bit value?
>
> Also 0xBD can be lower-cased and explained somehow?
Done, as is the rest of comments
Kind regards,
Luke.
>
next prev parent reply other threads:[~2022-08-08 23:28 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-08 3:04 [PATCH v2 0/6] asus-wmi: Add support for RGB keyboards Luke D. Jones
2022-08-08 3:04 ` [PATCH v2 1/6] asus-wmi: Implement TUF laptop keyboard RGB control Luke D. Jones
2022-08-08 3:04 ` [PATCH v2 2/6] asus-wmi: Implement TUF laptop keyboard LED modes Luke D. Jones
2022-08-08 16:01 ` Andy Shevchenko
2022-08-08 21:43 ` Luke Jones
2022-08-09 7:20 ` Andy Shevchenko
2022-08-08 3:04 ` [PATCH v2 3/6] asus-wmi: Implement TUF laptop keyboard power states Luke D. Jones
2022-08-08 16:08 ` Andy Shevchenko
2022-08-08 23:27 ` Luke Jones [this message]
2022-08-09 8:29 ` Andy Shevchenko
2022-08-09 22:25 ` Luke Jones
2022-08-08 3:04 ` [PATCH v2 4/6] asus-wmi: Document previously added attributes Luke D. Jones
2022-08-08 16:11 ` Andy Shevchenko
2022-08-08 3:04 ` [PATCH v2 5/6] asus-wmi: Convert all attr-show to use sysfs_emit Luke D. Jones
2022-08-08 16:13 ` Andy Shevchenko
2022-08-08 3:04 ` [PATCH v2 6/6] asus-wmi: Add support for dGPU-only mode Luke D. Jones
2022-08-08 8:38 ` Luke Jones
2022-08-08 15:44 ` Andy Shevchenko
2022-08-08 3:26 ` [PATCH v2 0/6] asus-wmi: Add support for RGB keyboards Luke Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=X5LBGR.15DO7CCYH6ER@ljones.dev \
--to=luke@ljones.dev \
--cc=andy.shevchenko@gmail.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox