Re: [PATCH] lg-laptop: Recognize more models

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

 



On Wed, Nov 24, 2021 at 1:27 AM Matan Ziv-Av <matan@xxxxxxxxxxx> wrote:

> LG uses 5 instead of 0 in the third digit (second digit after 2019)
> of the year string to indicate newer models in the same year. Handle
> this case as well.

>         if (product && strlen(product) > 4)
>                 switch (product[4]) {
>                 case '5':
> +                       if (strlen(product) > 5)
> +                               switch (product[5]) {
> +                               case 'N':
> +                                       year = 2021;
> +                                       break;
> +                               case '0':
> +                                       year = 2016;
> +                                       break;
> +                               default:
> +                                       year = 2022;
> +                               }
> +                       break;
>                 case '6':
>                         year = 2016;
>                         break;

Actually you may replace all those `if (strlen(product) > $X) {}` and
accompanied indentation level by adding corresponding
  case '\0':
    break;
into the switches, but this is out of scope here as it should be a
separate change, if any.



-- 
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