hwdb: check that uppercase digits are used in modalias patterns
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 17 Jul 2020 09:09:31 +0000 (11:09 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 17 Jul 2020 09:15:58 +0000 (11:15 +0200)
commit77547d5313ea916d2fb64ca5a8812734e9b50f92
tree44fbbdaaaaf9ac1991c6ee4d31b7c66cfc2f6124
parent457763aa0393a9f11e30071bb3794caf1a4f2f64
hwdb: check that uppercase digits are used in modalias patterns

This is all confusing as hell, becuase in some places lowercase hexadecimal
digits are used, and in other places uppercase. This adds a check for the
most common case that we and others got wrong.

I tried to extend the general grammar in hwdb_grammar() to include this check,
but it quickly became very complicated and didn't seem to work properly. Doing
initial parsing with more general rules is easier and also seems to give better
error messages:

/home/zbyszek/src/systemd-work/build/../hwdb.d/60-autosuspend.hwdb: 3 match groups, 5 matches, 3 properties
Pattern 'v058fp9540*' is invalid: Expected W:(0123...), found 'f'  (at char 4), (line:1, col:5)
hwdb.d/parse_hwdb.py