Re: [PATCH 2/5] asus-wmi: Add support for TUF laptop keyboard RGB mode control

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

 



On Sat, Aug 6, 2022 at 12:34 PM Luke Jones <luke@xxxxxxxxxx> wrote:
> On Sat, Aug 6 2022 at 11:56:58 +0200, Andy Shevchenko
> <andy.shevchenko@xxxxxxxxx> wrote:
> > On Fri, Aug 5, 2022 at 10:20 AM Luke D. Jones <luke@xxxxxxxxxx> wrote:

...

> >>  +       if (sscanf(buf, "%hhd %hhd %hhd", &save, &mode, &speed) !=
> >> 3)
> >>  +               return -EINVAL;
> >
> > Usually we have three separate nodes for that, but they are kinda
> > hidden in one driver, so I don't care much.
>
> I don't really understand what you mean sorry.

Each value is in a separate sysfs "file" (we call it "sysfs node"),
but it seems Pavel proposed a better solution so LED framework has
something to offer you.

...

> >>  +       /* These are the known usable modes across all TUF/ROG */
> >>  +       asus->keyboard_rgb_mode.mode = mode < 12 && mode != 9 ?
> >> mode : 0x0a;

This also can be improved

  if (mode >= 12 || mode == 9)
    ...mode = 10;
  else
    ...mode = mode;

Or, if it's important, switch all above to be hexadecimal constants.

...

> >>  +       err = tuf_rgb_brightness_set(cdev, cdev->brightness);
> >>  +       if (err)
> >>  +               return err;
> >>  +       return 0;
> >
> > return tuf_rgb_brightness_set(...);
>
> This causes a hang (waiting for return somewhere?) if I don't return
> count. Especially true if the return is 0.

I didn't get this, because what I suggested is an equivalent to the
above 4 lines.

-- 
With Best Regards,
Andy Shevchenko



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

  Powered by Linux