Re: [PATCH v2 3/6] asus-wmi: Implement TUF laptop keyboard power states

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.






[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux