VF0790: looking for advise on how to build the right kernel quirk

Felix Schwarz <[email protected]> Tue, 25 Jan 2022 20:56:15 +0100
Newsgroups gmane.linux.alsa.user
Message-ID <[email protected]>
(Seems like the output of alsa-info is too big so my first message did not go 
through, I'll use this opportunity to rephrase my original mail somewhat.)

I have Creative Technology Ltd. Live! Cam Chat HD VF0790 (USB ID 041e:4097) and 
the webcam did work fine with Fedora until a few months ago (likely culprit was 
the switch from F33 -> F35, which means Pulseaudio -> Pipewire). Since then it 
records only get garbled sound when I use video calls (actual software does not 
matter: Firefox, Zoom, ...).

I can reproduce the problem also with /usr/bin/arecord.

The problem has something to do with the formats supported by the webcam: 
S24_3LE and S16_LE.

Whenever I use "S24_3LE" (any bitrate) via "front:CARD=VF0790,DEV=0" (see below) 
I get a garbled recording. Using the same bitrate via "sysdefault:CARD=VF0790" 
works fine.

=> My main question is which component creates the "sysdefault"/"front" devices? 
Are these created by the Linux kernel or maybe pipewire?

$ arecord --list-pcms
sysdefault:CARD=VF0790

     Live! Cam Chat HD VF0790, USB Audio

     Default Audio Device

front:CARD=VF0790,DEV=0

     Live! Cam Chat HD VF0790, USB Audio

     Front output / input

Any idea why the "sysdefault" pcm works while "front:" does not?
I naively assumed that both pcms should point to exactly the same device but 
there is a diffence.

For good measure here is also the output of alsa-info.sh on my system:
https://gist.github.com/FelixSchwarz/9821c437497e198bf0d7711cc0d49eda

Thank your very much for reading until here,
Felix


PS: The same issue exists when using the webcam with Windows 10. However on 
Windows users can work around the problem by switching the recording from
"2 channel, 24 bit, 48000 Hz" to "2 channel, 16 bit, 48000 Hz".

PS(2): There is an alsa kernel quirk for a previous version of the device 
(VF0770), commit 48827e1d by Jonas Hahnfeld which is meant to fix similar 
problems. However for that device the solution seems to be to advertise only a 
single rate with S16_LE. Restricting my camera (VF0790) to S16_LE fixes 
recording in Firefox (I patched my kernel temporarily to verify this) but does 
not feel right as arecord was able to use S24_3LE in some cases.

PS(3): When using the "front" PCM with S24_3LE I can not use mono recordings:

$ LANG=C arecord --device=front:CARD=VF0790,DEV=0 --file-type wav 
--format=S24_3LE --channels=1 --rate=8000 --duration=5 test.wav
Recording WAVE 'test.wav' : Signed 24 bit Little Endian in 3bytes, Rate 8000 Hz, 
Mono
arecord: set_params:1358: Channels count non available

(this error is the same for any rate)

_______________________________________________
Alsa-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-user
asound.txt (application/x-unknown-content-type, 1.6 KB)
$ cat /proc/asound/VF0790/stream0 
Creative Technology Ltd. Live! Cam Chat HD VF0790 at usb-0000:00:14.0-1, high s : USB Audio

Capture:
  Status: Stop
  Interface 3
    Altset 1
    Format: S16_LE
    Channels: 2
    Endpoint: 0x82 (2 IN) (ASYNC)
    Rates: 8000
    Data packet interval: 1000 us
    Bits: 16
    Channel map: FL FR
  Interface 3
    Altset 2
    Format: S16_LE
    Channels: 2
    Endpoint: 0x82 (2 IN) (ASYNC)
    Rates: 16000
    Data packet interval: 1000 us
    Bits: 16
    Channel map: FL FR
  Interface 3
    Altset 3
    Format: S16_LE
    Channels: 2
    Endpoint: 0x82 (2 IN) (ASYNC)
    Rates: 44100
    Data packet interval: 1000 us
    Bits: 16
    Channel map: FL FR
  Interface 3
    Altset 4
    Format: S16_LE
    Channels: 2
    Endpoint: 0x82 (2 IN) (ASYNC)
    Rates: 48000
    Data packet interval: 1000 us
    Bits: 16
    Channel map: FL FR
  Interface 3
    Altset 5
    Format: S24_3LE
    Channels: 2
    Endpoint: 0x82 (2 IN) (ASYNC)
    Rates: 8000
    Data packet interval: 1000 us
    Bits: 24
    Channel map: FL FR
  Interface 3
    Altset 6
    Format: S24_3LE
    Channels: 2
    Endpoint: 0x82 (2 IN) (ASYNC)
    Rates: 16000
    Data packet interval: 1000 us
    Bits: 24
    Channel map: FL FR
  Interface 3
    Altset 7
    Format: S24_3LE
    Channels: 2
    Endpoint: 0x82 (2 IN) (ASYNC)
    Rates: 44100
    Data packet interval: 1000 us
    Bits: 24
    Channel map: FL FR
  Interface 3
    Altset 8
    Format: S24_3LE
    Channels: 2
    Endpoint: 0x82 (2 IN) (ASYNC)
    Rates: 48000
    Data packet interval: 1000 us
    Bits: 24
    Channel map: FL FR
arecord-pcms.txt (application/x-unknown-content-type, 535 B)
$ arecord --list-pcms
null
    Discard all samples (playback) or generate zero samples (capture)
pipewire
    PipeWire Sound Server
default
    Default ALSA Output (currently PipeWire Media Server)
sysdefault:CARD=PCH
    HDA Intel PCH, ALC3235 Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC3235 Analog
    Front output / input
sysdefault:CARD=VF0790
    Live! Cam Chat HD VF0790, USB Audio
    Default Audio Device
front:CARD=VF0790,DEV=0
    Live! Cam Chat HD VF0790, USB Audio
    Front output / input