提问人:Mike Michon 提问时间:11/6/2023 更新时间:11/6/2023 访问量:11
Alsa utils 仅在 Raspbian 上以 root 身份运行
Alsa utils only run as root on Raspbian
问:
我有一个运行 Raspbian Bullseye 的 RPi Zero。alsa utils(aplay、arecord、speaker-test 等)仅以 root 身份运行而不会出错。
我以用户身份尝试:pi
pi@bear:~ $ speaker-test
speaker-test 1.2.4
Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
ALSA lib conf.c:1446:(parse_def) default is not a compound
ALSA lib conf.c:1970:(_snd_config_load_with_include) _toplevel_:1:13:Invalid argument
ALSA lib conf.c:3817:(config_file_open) /home/pi/.asoundrc may be old or corrupted: consider to remove or fix it
ALSA lib conf.c:3739:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument
ALSA lib conf.c:4203:(snd_config_update_r) hooks failed, removing configuration
Playback open error: -22,Invalid argument
但期待下面的输出(运行方式):root
pi@bear:~ $ sudo speaker-test
speaker-test 1.2.4
Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 2048 to 16384
Period size range from 1024 to 1024
Using max buffer size 16384
Periods = 4
was set period_size = 1024
was set buffer_size = 16384
0 - Front Left
听起来像是权限问题,但经过一些研究,一切似乎都没问题。
pi@bear:~ $ groups pi
pi : pi audio
pi@bear:~ $ ls -al /dev/snd/
total 0
drwxrwxrwx 4 root root 240 Nov 5 17:11 .
drwxr-xr-x 16 root root 3720 Nov 5 17:11 ..
drwxr-xr-x 2 root root 80 Nov 5 17:11 by-id
drwxr-xr-x 2 root root 100 Nov 5 17:11 by-path
crw-rw---- 1 root audio 0 Nov 5 17:11 controlC0
crw-rw---- 1 root audio 32 Nov 5 17:11 controlC1
crw-rw---- 1 root audio 64 Nov 5 17:11 controlC2
crw-rw---- 1 root audio 16 Nov 5 17:11 pcmC0D0p
crw-rw---- 1 root audio 56 Nov 5 17:11 pcmC1D0c
crw-rw---- 1 root audio 80 Nov 5 17:11 pcmC2D0p
crw-rw---- 1 root audio 1 Nov 5 17:11 seq
crw-rw---- 1 root audio 33 Nov 5 17:11 timer
答: 暂无答案
评论