Skip to content

ucm-validator: catch up with alsa-info.sh, and add the Pine64 PineNote - #27

Open
cverorg wants to merge 3 commits into
alsa-project:masterfrom
cverorg:pinenote
Open

ucm-validator: catch up with alsa-info.sh, and add the Pine64 PineNote#27
cverorg wants to merge 3 commits into
alsa-project:masterfrom
cverorg:pinenote

Conversation

@cverorg

@cverorg cverorg commented Aug 31, 2026

Copy link
Copy Markdown

Three commits: two validator fixes that are independent of any new hardware,
and the alsa-info.sh dump for a Pine64 PineNote, whose UCM profile is submitted
as alsa-project/alsa-ucm-conf#844.

1. The dump parser has fallen behind alsa-info.sh

Six sections the current script writes are missing from SECTIONS, and an
unknown section is fatal, so a dump taken today is rejected before it is read:
Sysfs card info, Sysfs ctl-led info, ACPI SoundWire Device Status Information, AC97 Codec information, USB Descriptors, USB Stream information.

This already affects this repository, not just new submissions:

$ ./ucm.py --level 0 configs ../../../alsa-ucm-conf/ucm2 configs configs/USB/ALC4080.txt
alsainfo.AlsaInfoError: configs/USB/ALC4080.txt: unknown section 'Sysfs card info'

With the sections added, that file gets past the parser. It then fails on an
unrelated ${var:@HDA} is not defined, which I have not touched — I mention it
so the fix is not mistaken for making ALC4080 pass.

The amixer regex has drifted the same way. It requires Card hw:<n>, but
alsa-info.sh addresses the card by id (amixer -c PineNote info) and alsa-lib
answers Card sysdefault:0, so the match fails and the parse dies with an
AttributeError on None. The patch accepts any control-device prefix and
takes the index after it. Older Card hw:0 dumps still match;
configs/Rockchip/rk3399-gru-sound.txt was re-run to confirm it still passes.

2. A crash where an error message was intended

check_device_names means to reject mixing an unindexed device with an indexed
one of the same base, and has the message for it. It never reaches it when the
unindexed device sorts first — Mic leaves prev['index'] as None, Mic2
evaluates prev['index'] + 1:

TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

After the patch that profile reports mixing non-indexed devices with indexed devices is not allowed (device "Mic2" previous "Mic"), which is what the
function was already trying to say. This is how I found it: the PineNote
profile named its two capture devices Mic and Mic2 before I corrected it.

3. configs/Rockchip/PineNote.txt

Generated with --no-upload, and deliberately from an empty working directory:
run from a populated one, an unquoted expansion in alsa-info.sh globs the
directory into the distro line. On this machine that pulled
systemd-private-<machine id> paths and unrelated log filenames into the dump,
which is not something to commit to a public tree. Worth knowing for anyone
collecting these.

With all three applied, the PineNote profile validates clean:

$ ./ucm.py --level 0 configs ../../../alsa-ucm-conf/ucm2 configs configs/Rockchip/PineNote.txt
$ echo $?
0

Two things I could not evaluate and am not claiming to have fixed: the all
pass is red on an untouched alsa-ucm-conf master
(USB-Audio/USB-Audio.conf: 'If'.'opt' If requires condition section), and 31
of the 39 dumps in configs/ fail the configs pass for reasons that predate
this branch. I have hardware and am happy to test anything.

Any dump from a current alsa-info.sh is rejected before it is read. Six of the
sections it writes are absent from SECTIONS, and an unknown section is fatal:

  Sysfs card info
  Sysfs ctl-led info
  ACPI SoundWire Device Status Information
  AC97 Codec information
  USB Descriptors
  USB Stream information

This is not hypothetical for new submissions only -- configs/USB/ALC4080.txt,
already in this tree, fails with "unknown section 'Sysfs card info'". With
these added it gets past the parser (it then hits an unrelated
${var:@hda} problem, which is a separate matter).

The amixer block regex has drifted the same way. It requires "Card hw:<n>",
but alsa-info.sh addresses the card by id (amixer -c PineNote info) and
alsa-lib answers "Card sysdefault:0", so the match fails and the parse dies
with an AttributeError on None. Accept any control-device prefix and take the
card index after it; the older "Card hw:0" dumps in configs/ still match, and
configs/Rockchip/rk3399-gru-sound.txt was checked for that.

Signed-off-by: cverorg <292680828+cverorg@users.noreply.github.com>
check_device_names means to reject a verb that mixes an unindexed device with
an indexed one of the same base, and says so in the else branch. It never gets
there when the unindexed device sorts first: "Mic" leaves prev['index'] as
None, "Mic2" then evaluates prev['index'] + 1 and the run dies with

  TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

Check for it and raise the error the function already has. A profile with
SectionDevice."Mic" and SectionDevice."Mic2" now reports

  mixing non-indexed devices with indexed devices is not allowed
  (device "Mic2" previous "Mic")

Signed-off-by: cverorg <292680828+cverorg@users.noreply.github.com>
alsa-info.sh output for the PineNote, so the UCM profile submitted to
alsa-ucm-conf as "Rockchip: add PineNote (rk817 + PDM microphone array)" can be
validated without the hardware. The card is a simple-card pairing an rk817
codec with a four-microphone PDM array on a second PCM.

Generated with --no-upload from an empty working directory. The latter matters:
run from a populated one, an unquoted expansion in alsa-info.sh globs the
directory into the distro line, which on this machine pulled in
systemd-private-<machine id> paths and unrelated log filenames.

Signed-off-by: cverorg <292680828+cverorg@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant