Closed Cuda-Chen closed 6 months ago
@Cuda-Chen, Can you confirm that vsnd_unregister_all()
properly iterates the registered sound devices?
Hi @jserv ,
After upgrading my system to 5.15.0-94-generic
, it gets worse: the kernel cannot load vsnd
module, and I think there are some issues of the recently Ubuntu distro. I will solve the cannot load module
issue first.
FYI, here are the outputs after loading the vsnd
module:
$ make check
make check
make -C /lib/modules/5.15.0-94-generic/build M=/home/jio/c_code/vsnd modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-94-generic'
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-94-generic'
scripts/verify.sh
+ sudo modprobe snd_pcm
+ sudo rmmod vsnd
rmmod: ERROR: Module vsnd is not currently loaded
+ rm -f /tmp/audio.pcm
+ mkfifo /tmp/audio.pcm
+ sudo insmod vsnd.ko out_fifo_name=/tmp/audio.pcm
insmod: ERROR: could not insert module vsnd.ko: Invalid module format
+ sleep 1
+ tee out.pcm
+ aplay CantinaBand3.wav
Playing WAVE 'CantinaBand3.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono
+ sudo rmmod vsnd
rmmod: ERROR: Module vsnd is not currently loaded
+ ffmpeg -f s16le -ar 22.05k -ac 1 -loglevel 8 -i out.pcm out.wav
File 'out.wav' already exists. Overwrite? [y/N]
Not overwriting - exiting
make: *** [Makefile:12: check] Error 1
What's more, here are the results in dmesg
while loading vsnd
module:
[26902.839728] module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 0000000062f68630, val ffffffffc13faa3a
Hi @jserv ,
After purging and reinstalling the linux-headers
, it compiles without any errors (as I have not clean the linux-headers
on my computer for years).
For Ubuntu, to let vsnd
play sound, you have to select the vsnd
from System Settings -> Sounds (the system describe vsnd
as Analog Output - Built-in Audio
) or the test sound will be played by other sound devices.
What's more, there is some interesting finding when using lsmod | grep vsnd
:
$ lsmod | grep vsnd
vsnd 16384 1
snd_pcm 143360 7 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,vsnd,snd_hda_core
snd 106496 24 snd_hda_codec_generic,snd_seq,snd_seq_device,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_timer,vsnd,snd_pcm,snd_rawmidi
You can see that vsnd
is occupied by some unknown kernel modules. I think I should realize how Ubuntu manage the sound device first (maybe the System Setting occupies vsnd
so we can't rmmod vsnd
?).
Hi @jserv ,
I would like to make some updates about my findings.
I found vsnd
cannot be removed once it plays any sound.
To remove vsnd
, I have to type pactl set-card-profile alsa_card.platform-vsnd.0 off
and the vsnd
will be able to be removed.
What's more, it seems that the dmesg
produces lagged output as follows (use this fork to re-produce):
[ 3458.302210] start to unregister vsnd driver
[ 3467.285842] Succeeded to load vsnd
[ 3471.103242] START: channels 1 rate 22050
[ 3502.116129] STOP
[ 3557.413503] start to unregister vsnd components
[ 3557.414614] end to unregister vsnd components
Also, I think to designate the sound-playing device when testing should be more convenient so that we don't need to switch the sound output device from system setting manually.
It seems that
vsnd
module cannot be removed if the system contains other sound devices.Test result:
System environment: