hwdb: sensors: Fix some modalias matches no longer working with newer kernels
authorHans de Goede <hdegoede@redhat.com>
Tue, 31 Aug 2021 13:49:33 +0000 (15:49 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 29 Sep 2021 14:03:06 +0000 (16:03 +0200)
commitf81351554285f1d4869fe842659b72797edfc899
tree9ab06a3e8ac33677768ad1b450e0025bdd89c67a
parent14bb72953458caace048b55ead7ea06a592b864f
hwdb: sensors: Fix some modalias matches no longer working with newer kernels

Kernels >= 5.8 have added new fields to the dmi/id/modalias file in the
middle of the modalias (instead of adding them at the end).

Specifically new ":br<value>:" and (optional) ":efr<value>:" fields have
been added between the ":bd<value>:" and ":svn<value>:" fields.

Note the 5.13.0 and 5.14.0 kernels also added a new ":sku<value>:" field
between the ":pvr<value>:" and ":rvn<value>:" fields, this has been fixed
in later 5.13.y and 5.14.y releases, by moving the sku field to the end:
https://lore.kernel.org/lkml/20210831130508.14511-1-hdegoede@redhat.com/

Unfortunately the same cannot be done for the new br and efr fields since
those have been added more then a year ago and hwdb even already has some
newer entries relying on the new br field being there (and thus not working
with older kernels).

Fix the issue with the br and efr fields through the following changes:

1. Replace any matches on ":br<value>" from newer entries with an '*'
2. Replace "bd<value>:svn<value>" matches with: "bd<value>:*svn<value>"
   inserting an '*' where newer kernels will have the new br + efr fields

This makes these matches working with old as well as new kernels.

Link: https://github.com/systemd/systemd/issues/20550
Link: https://github.com/systemd/systemd/pull/20562
hwdb.d/60-sensor.hwdb