[alsa-devel] alsa conformance test fails to run for playback (and works for capture)

Hi Yu-Hsuan,
I have encountered another problem with the alsa conformance test. It works for capture, but not for playback.
The device is -
http://wiki.seeedstudio.com/ReSpeaker_6-Mic_Circular_Array_kit_for_Raspberry...
and running on a pi / raspbian buster.
The actual message is:
Fail - ALSA lib pcm_hw.c:1822:(_snd_pcm_hw_open) Invalid value for card snd_pcm_open hw:CARD=seeed8micvoi: No such device
I think the truncation is harmless .
The actual device name according to aplay -L is "hw:CARD=seeed8micvoicec,DEV=0" and as I noted earlier, arecord -L shows it as "hw:CARD=seeed8micvoicec,DEV=0" also, and the comformance test running in CAPTURE mode works, just not in PLAYBACK mode.
Is there anything I can do to look further?
Since it says "invalid value", I tried deleting the parameters around line 190 of src/alsa_conformance_helper.c, but perhaps I should do something else?
src/alsa_conformance_helper.c-191- conformance_timer_start(timer, SND_PCM_OPEN); src/alsa_conformance_helper.c:192: rc = snd_pcm_open(handle, src/alsa_conformance_helper.c-193- dev_name, src/alsa_conformance_helper.c-194- stream, src/alsa_conformance_helper.c-195- SND_PCM_NONBLOCK | src/alsa_conformance_helper.c-196- SND_PCM_NO_AUTO_RESAMPLE | src/alsa_conformance_helper.c-197- SND_PCM_NO_AUTO_CHANNELS | src/alsa_conformance_helper.c-198- SND_PCM_NO_AUTO_FORMAT); src/alsa_conformance_helper.c-199- conformance_timer_stop(timer, SND_PCM_OPEN);
Regards, Hin-Tak

Hi Hin-Tak,
How about using index instead? You should find the card index and device index by running "aplay -l" command. The pcm format is hw:{CARD_INDEX},{DEVICE_INDEX}. See example part in https://chromium.googlesource.com/chromiumos/platform/audiotest/+/refs/heads... for more information.
Best, Yu-Hsuan
On Thu, Oct 17, 2019 at 10:14 PM Hin-Tak Leung htl10@users.sourceforge.net wrote:
Hi Yu-Hsuan,
I have encountered another problem with the alsa conformance test. It works for capture, but not for playback.
The device is -
http://wiki.seeedstudio.com/ReSpeaker_6-Mic_Circular_Array_kit_for_Raspberry...
and running on a pi / raspbian buster.
The actual message is:
Fail - ALSA lib pcm_hw.c:1822:(_snd_pcm_hw_open) Invalid value for card snd_pcm_open hw:CARD=seeed8micvoi: No such device
I think the truncation is harmless .
The actual device name according to aplay -L is "hw:CARD=seeed8micvoicec,DEV=0" and as I noted earlier, arecord -L shows it as "hw:CARD=seeed8micvoicec,DEV=0" also, and the comformance test running in CAPTURE mode works, just not in PLAYBACK mode.
Is there anything I can do to look further?
Since it says "invalid value", I tried deleting the parameters around line 190 of src/alsa_conformance_helper.c, but perhaps I should do something else?
src/alsa_conformance_helper.c-191- conformance_timer_start(timer, SND_PCM_OPEN); src/alsa_conformance_helper.c:192: rc = snd_pcm_open(handle, src/alsa_conformance_helper.c-193- dev_name, src/alsa_conformance_helper.c-194- stream, src/alsa_conformance_helper.c-195- SND_PCM_NONBLOCK | src/alsa_conformance_helper.c-196- SND_PCM_NO_AUTO_RESAMPLE | src/alsa_conformance_helper.c-197- SND_PCM_NO_AUTO_CHANNELS | src/alsa_conformance_helper.c-198- SND_PCM_NO_AUTO_FORMAT); src/alsa_conformance_helper.c-199- conformance_timer_stop(timer, SND_PCM_OPEN);
Regards, Hin-Tak

On Friday, 18 October 2019, 04:27:29 BST, Yu-hsuan Hsu yuhsuan@google.com wrote:
How about using index instead? You should find the card index and device index by running "aplay -l" command. The pcm format is hw:{CARD_INDEX},{DEVICE_INDEX}. See example part in https://chromium.googlesource.com/chromiumos/platform/audiotest/+/refs/heads... more information.
Dear Yu-Hsuan,
Yes, using card index and device index works. Here is the output:
$ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA] Subdevices: 7/7 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: ALSA [bcm2835 ALSA], device 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: seeed8micvoicec [seeed-8mic-voicecard], device 0: bcm2835-i2s-ac10x-codec0 ac10x-codec.1-0035-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0
As I mentioned earlier I am interested in card 1, the seeed8micvoicec entry. Here it is the conformance test output:
20 passed, 0 failed Device Information Name: hw:CARD=1,0 Stream: PLAYBACK Format: ['S32_LE'] Channels: [8] Rate: [8000, 11025, 16000, 22050, 44100, 48000] Period_size range: [8, 8192] Buffer_size range: [16, 16384] Test Params Set channels 8: pass Set format S32_LE: pass Set rate 8000: pass Set rate 11025: pass Set rate 16000: pass Set rate 22050: pass Set rate 44100: pass Set rate 48000: pass Test Rates Set rate 8000: pass Set rate 11025: pass Set rate 16000: pass Set rate 22050: pass Set rate 44100: pass Set rate 48000: pass Test All Pairs Set channels 8, format S32_LE, rate 8000: pass Set channels 8, format S32_LE, rate 11025: pass Set channels 8, format S32_LE, rate 16000: pass Set channels 8, format S32_LE, rate 22050: pass Set channels 8, format S32_LE, rate 44100: pass Set channels 8, format S32_LE, rate 48000: pass
There is probably a bug somewhere on not being able to use the card name?
Regards, Hin-Tak

Hi Hin-Tak, Maybe it is not the correct pcm name. I guess the correct one is "hw:seeed8micvoicec,0". Could you try it? By the way, you can also use aplay -D {device_name} to make sure whether the name is correct or not.
Best, Yu-Hsuan
Hin-Tak Leung htl10@users.sourceforge.net 於 2019年10月18日 週五 下午6:56寫道:
On Friday, 18 October 2019, 04:27:29 BST, Yu-hsuan Hsu yuhsuan@google.com wrote:
How about using index instead? You should find the card index and device index by running "aplay -l" command. The pcm format is hw:{CARD_INDEX},{DEVICE_INDEX}. See example part in https://chromium.googlesource.com/chromiumos/platform/audiotest/+/refs/heads... for more information.
Dear Yu-Hsuan,
Yes, using card index and device index works. Here is the output:
$ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA] Subdevices: 7/7 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: ALSA [bcm2835 ALSA], device 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: seeed8micvoicec [seeed-8mic-voicecard], device 0: bcm2835-i2s-ac10x-codec0 ac10x-codec.1-0035-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0
As I mentioned earlier I am interested in card 1, the seeed8micvoicec entry. Here it is the conformance test output:
20 passed, 0 failed Device Information Name: hw:CARD=1,0 Stream: PLAYBACK Format: ['S32_LE'] Channels: [8] Rate: [8000, 11025, 16000, 22050, 44100, 48000] Period_size range: [8, 8192] Buffer_size range: [16, 16384] Test Params Set channels 8: pass Set format S32_LE: pass Set rate 8000: pass Set rate 11025: pass Set rate 16000: pass Set rate 22050: pass Set rate 44100: pass Set rate 48000: pass Test Rates Set rate 8000: pass Set rate 11025: pass Set rate 16000: pass Set rate 22050: pass Set rate 44100: pass Set rate 48000: pass Test All Pairs Set channels 8, format S32_LE, rate 8000: pass Set channels 8, format S32_LE, rate 11025: pass Set channels 8, format S32_LE, rate 16000: pass Set channels 8, format S32_LE, rate 22050: pass Set channels 8, format S32_LE, rate 44100: pass Set channels 8, format S32_LE, rate 48000: pass
There is probably a bug somewhere on not being able to use the card name?
Regards, Hin-Tak

On Sunday, 20 October 2019, 11:51:42 BST, Yu-Hsuan Hsu yuhsuan@chromium.org wrote:
Hi Hin-Tak, Maybe it is not the correct pcm name. I guess the correct one is "hw:seeed8micvoicec,0". Could you try it? By the way, you can also use aplay -D {device_name} to make sure whether the name is correct or not.
Best, Yu-Hsuan
Dear Yu-Hsuan,
No "hw:seeed8micvoicec,0" did not work as input to the conformance test. As input to 'aplay -D', both the ,0 and without it sort of works. (it waits for input from stdin).
When I actually gave it an channel file to play, both forms ('aplay -D hw:CARD=seeed8micvoicec ...' and 'aplay -D hw:CARD=seeed8micvoicec,0 ...') stopped with:
Playing WAVE 'Untitled recording 2019-10-11 19.15.11.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Channels 6 aplay: set_params:1339: Sample format non available Available formats: - S32_LE
The interesting part of 'aplay -L' is (there is another device):
sysdefault:CARD=seeed8micvoicec seeed-8mic-voicecard, Default Audio Device dmix:CARD=seeed8micvoicec,DEV=0 seeed-8mic-voicecard, Direct sample mixing device dsnoop:CARD=seeed8micvoicec,DEV=0 seeed-8mic-voicecard, Direct sample snooping device hw:CARD=seeed8micvoicec,DEV=0 seeed-8mic-voicecard, Direct hardware device without any conversions plughw:CARD=seeed8micvoicec,DEV=0 seeed-8mic-voicecard, Hardware device with all software conversions usbstream:CARD=seeed8micvoicec seeed-8mic-voicecard USB Stream Output
As I mentioned at the beginning, 'arecord -L' and running the conformance test in CAPTURE mode using 'hw:CARD=seeed8micvoicec' works. It is PLAYBACK which does not.
Regards, Hin-Tak

Hi Hin-Tak,
I finally found out the reason! It is because there is a length limit of PCM name in ALSA conformance test. I have increased it on https://chromium-review.googlesource.com/c/chromiumos/platform/audiotest/+/1.... Waiting for the review and merge. Thanks a lot for your catch!
Best, Yu-Hsuan
Hin-Tak Leung htl10@users.sourceforge.net 於 2019年10月21日 週一 下午9:57寫道:
On Sunday, 20 October 2019, 11:51:42 BST, Yu-Hsuan Hsu yuhsuan@chromium.org wrote:
Hi Hin-Tak, Maybe it is not the correct pcm name. I guess the correct one is "hw:seeed8micvoicec,0". Could you try it? By the way, you can also use aplay -D {device_name} to make sure whether the name is correct or not.
Best, Yu-Hsuan
Dear Yu-Hsuan,
No "hw:seeed8micvoicec,0" did not work as input to the conformance test. As input to 'aplay -D', both the ,0 and without it sort of works. (it waits for input from stdin).
When I actually gave it an channel file to play, both forms ('aplay -D hw:CARD=seeed8micvoicec ...' and 'aplay -D hw:CARD=seeed8micvoicec,0 ...') stopped with:
Playing WAVE 'Untitled recording 2019-10-11 19.15.11.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Channels 6 aplay: set_params:1339: Sample format non available Available formats:
- S32_LE
The interesting part of 'aplay -L' is (there is another device):
sysdefault:CARD=seeed8micvoicec seeed-8mic-voicecard, Default Audio Device dmix:CARD=seeed8micvoicec,DEV=0 seeed-8mic-voicecard, Direct sample mixing device dsnoop:CARD=seeed8micvoicec,DEV=0 seeed-8mic-voicecard, Direct sample snooping device hw:CARD=seeed8micvoicec,DEV=0 seeed-8mic-voicecard, Direct hardware device without any conversions plughw:CARD=seeed8micvoicec,DEV=0 seeed-8mic-voicecard, Hardware device with all software conversions usbstream:CARD=seeed8micvoicec seeed-8mic-voicecard USB Stream Output
As I mentioned at the beginning, 'arecord -L' and running the conformance test in CAPTURE mode using 'hw:CARD=seeed8micvoicec' works. It is PLAYBACK which does not.
Regards, Hin-Tak

On Tuesday, 22 October 2019, 04:12:12 BST, Yu-Hsuan Hsu yuhsuan@chromium.org wrote:
Hi Hin-Tak,
I finally found out the reason! It is because there is a length limit of PCM name in ALSA conformance test. I have increased it on https://chromium-review.googlesource.com/c/chromiumos/platform/audiotest/+/1.... Waiting for the review and merge. Thanks a lot for your catch!
Best, Yu-Hsuan
Dear Yu-Hsuan,
Yes, I hand-applied the one-line change, and it now works. I do wonder if you should change the args_set_capture_dev_name() also? At the moment, MAX_DEVICE_NAME_LENGTH is only used in exactly one place, for the playback device name. Hence the surprise that capture works but playback does not:
src/alsa_conformance_args.c-119-void args_set_playback_dev_name(struct alsa_conformance_args *args, src/alsa_conformance_args.c-120- const char *name) src/alsa_conformance_args.c-121-{ src/alsa_conformance_args.c-122- free(args->playback_dev_name); src/alsa_conformance_args.c:123: args->playback_dev_name = strndup(name, MAX_DEVICE_NAME_LENGTH); src/alsa_conformance_args.c-124-} src/alsa_conformance_args.c-125- src/alsa_conformance_args.c-126-void args_set_capture_dev_name(struct alsa_conformance_args *args, src/alsa_conformance_args.c-127- const char *name) src/alsa_conformance_args.c-128-{ src/alsa_conformance_args.c-129- free(args->capture_dev_name); src/alsa_conformance_args.c-130- args->capture_dev_name = strdup(name); src/alsa_conformance_args.c-131-} src/alsa_conformance_args.c-132-
Regards, Hin-Tak

Hi Hin-Tak,
Good catch again. I have fixed it in the same CL. Thanks!
Best, Yu-Hsuan
Hin-Tak Leung htl10@users.sourceforge.net 於 2019年10月22日 週二 下午5:39寫道:
On Tuesday, 22 October 2019, 04:12:12 BST, Yu-Hsuan Hsu yuhsuan@chromium.org wrote:
Hi Hin-Tak,
I finally found out the reason! It is because there is a length limit of PCM name in ALSA conformance test. I have increased it on https://chromium-review.googlesource.com/c/chromiumos/platform/audiotest/+/1.... Waiting for the review and merge. Thanks a lot for your catch!
Best, Yu-Hsuan
Dear Yu-Hsuan,
Yes, I hand-applied the one-line change, and it now works. I do wonder if you should change the args_set_capture_dev_name() also? At the moment, MAX_DEVICE_NAME_LENGTH is only used in exactly one place, for the playback device name. Hence the surprise that capture works but playback does not:
src/alsa_conformance_args.c-119-void args_set_playback_dev_name(struct alsa_conformance_args *args, src/alsa_conformance_args.c-120- const char *name) src/alsa_conformance_args.c-121-{ src/alsa_conformance_args.c-122- free(args->playback_dev_name); src/alsa_conformance_args.c:123: args->playback_dev_name = strndup(name, MAX_DEVICE_NAME_LENGTH); src/alsa_conformance_args.c-124-} src/alsa_conformance_args.c-125- src/alsa_conformance_args.c-126-void args_set_capture_dev_name(struct alsa_conformance_args *args, src/alsa_conformance_args.c-127- const char *name) src/alsa_conformance_args.c-128-{ src/alsa_conformance_args.c-129- free(args->capture_dev_name); src/alsa_conformance_args.c-130- args->capture_dev_name = strdup(name); src/alsa_conformance_args.c-131-} src/alsa_conformance_args.c-132-
Regards, Hin-Tak

On Wednesday, 23 October 2019, 04:25:30 BST, Yu-Hsuan Hsu yuhsuan@chromium.org wrote:
Hi Hin-Tak,
Good catch again. I have fixed it in the same CL. Thanks!
Best, Yu-Hsuan
Dear Yu-Hsuan,
I am glad it is all working out in the end for the better!
Regards, Hin-Tak
participants (3)
-
Hin-Tak Leung
-
Yu-hsuan Hsu
-
Yu-Hsuan Hsu