Re: Arecord hangs on poll() with USB sound card

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you for the tip. At a first glance systemtap seems quite cumbersome to compile for ARM, but I will be looking into it more extensively during the day.

I analyzed the dmesg output a bit closer after enabling more debug in the kernel; could these messages possibly have something to do with my issue?

> ALSA sound/usb/usbmixer.c:405: cannot set ctl value: req = 0x4, wValue = 0x200, wIndex = 0xd00, type = 4, data = 0x18/0x0
> ALSA sound/usb/usbmixer.c:405: cannot set ctl value: req = 0x4, wValue = 0x201, wIndex = 0x900, type = 4, data = 0x18/0x0

Also, I was curious wether there was any USB communication at all when recording, so I fired up usbmon to listen for data on the USB port. I can see that after arecord is started, the total data transferred quickly can be counted by the MBs (while not being affected at all if aplay/arecord is not used), which makes me draw the conclusion that traffic is indeed being sent from my sound card, but never reaches the application.

Tim

> # dmesg
> ...
> snd-usb-audio 1-1:1.0: usb_probe_interface
> snd-usb-audio 1-1:1.0: usb_probe_interface - got id
> ALSA sound/usb/usbaudio.c:2826: 2:1:1: add audio endpoint 0x1
> ALSA sound/usb/usbaudio.c:2826: 2:2:1: add audio endpoint 0x82
> ALSA sound/usb/usbmixer.c:988: [13] FU [Mic Playback Switch] ch = 1, val
> = 0/1/1
> ALSA sound/usb/usbmixer.c:405: cannot set ctl value: req = 0x4, wValue =
> 0x200, wIndex = 0xd00, type = 4, data = 0x18/0x0
> ALSA sound/usb/usbmixer.c:988: [13] FU [Mic Playback Volume] ch = 1, val
> = 0/12240/384
> ALSA sound/usb/usbmixer.c:988: [9] FU [Speaker Playback Switch] ch = 1,
> val = 0/1/1
> ALSA sound/usb/usbmixer.c:405: cannot set ctl value: req = 0x4, wValue =
> 0x201, wIndex = 0x900, type = 4, data = 0x18/0x0
> ALSA sound/usb/usbmixer.c:988: [9] FU [Speaker Playback Volume] ch = 2,
> val = -7264/-16/48
> ALSA sound/usb/usbmixer.c:988: [10] FU [Mic Capture Switch] ch = 1, val
> = 0/1/1
> ALSA sound/usb/usbmixer.c:405: cannot set ctl value: req = 0x4, wValue =
> 0x200, wIndex = 0xa00, type = 4, data = 0x18/0x0
> ALSA sound/usb/usbmixer.c:988: [10] FU [Mic Capture Volume] ch = 1, val
> = 0/6096/384
> ALSA sound/usb/usbmixer.c:988: [10] FU [Auto Gain Control] ch = 1, val =
> 0/1/1
> usbcore: registered new interface driver snd-usb-audio
> firmware: requesting NPE-C
> NPE-C: firmware's license can be found in /usr/share/doc/LICENSE.IPL
> NPE-C: firmware functionality 0x5, revision 0x2:1
> eth0: link down
> eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
> ALSA sound/usb/usbaudio.c:1350: setting usb interface 2:1
> ALSA sound/usb/usbaudio.c:1350: setting usb interface 2:1
> ALSA sound/usb/usbaudio.c:1350: setting usb interface 2:1
> ALSA sound/usb/usbaudio.c:1350: setting usb interface 2:1
> ALSA sound/usb/usbaudio.c:1350: setting usb interface 2:1
> ...

-----Original Message-----
From: Igor 'Lo' (Ð.L.) [mailto:bombsiteunrested@xxxxxxxxx] 
Sent: den 6 oktober 2010 18:45
To: Tim SjÃstrand
Subject: Re:  Arecord hangs on poll() with USB sound card

Hint: strace seems saying not so enough, get more debug info with
Systemtap < http://sourceware.org/systemtap/ > script like:

probe module("soundcore").function("*") { }
probe module("snd").function("*") { }
probe module("snd_hda_codec_realtek").function("*") { }

probe module("snd_hda_intel").function("*").call {
  printf ("%s -> %s\n", thread_indent(1), probefunc())
}
probe module("snd_hda_intel").function("*").return {
  printf ("%s <- %s\n", thread_indent(-1), probefunc())
}

Offtopic: can anyone recommend me with a good place to capture
function calls like pci register set for soundcards, alsa to pci
read/write calls? Interested in this stuff for my study.


On 6 October 2010 16:46, Tim SjÃstrand <tim.sjostrand@xxxxxxxxxxxxx> wrote:
>
> Hello
>
> I am trying to play and record sound on an ARM (big endian) platform using alsa and a USB sound card dongle.
>
> The sound card is detected properly both in dmesg and alsa, and a "Speaker" and "Mic" mixer control is visible in "amixer". Playback works fine. Recording does not work however: when using arecord, it produces a 44 byte large file (size of the wave header?) and seemingly hangs. Running strace with arecord shows that it is waiting on a poll() function (see output below).
>
> I can enable playback on the Mic control, and get the microphone input to play in the speakers, so I know the microphone is working.
>
> The "Mic" mixer control has been unmuted and set to capture via "amixer".
>
> One odd thing is that when using alsamixer (the ncurses interface), it is not possible to set the "Mic" mixer control to Capture with the Space key. Even if set via "amixer" (which seems to work, given the output) does not change how it is visually presented in alsamixer.
>
> Does anyone have any ideas on how I can continue from here on?
>
> I have been banging my head on this for several days, so any help would be appreciated! :)
>
> Also, I've attached output of several files (in case they may help):
>
> # uname -r
> 2.6.27.44
>
> # cat /proc/asound/version
> Advanced Linux Sound Architecture Driver Version 1.0.17.
>
> # amixer
> Simple mixer control 'Speaker',0
> ÂCapabilities: pvolume pswitch pswitch-joined penum
> ÂPlayback channels: Front Left - Front Right
> ÂLimits: Playback 0 - 151
> ÂMono:
> ÂFront Left: Playback 150 [99%] [-1.37dB] [on]
> ÂFront Right: Playback 150 [99%] [-1.37dB] [on]
> Simple mixer control 'Mic',0
> ÂCapabilities: pvolume pvolume-joined cvolume cvolume-joined pswitch pswitch-joined cswitch cswitch-joined penum
> ÂPlayback channels: Mono
> ÂCapture channels: Mono
> ÂLimits: Playback 0 - 32 Capture 0 - 16
> ÂMono: Playback 31 [97%] [46.50dB] [on] Capture 15 [94%] [22.50dB] [on]
> Simple mixer control 'Auto Gain Control',0
> ÂCapabilities: pswitch pswitch-joined penum
> ÂPlayback channels: Mono
> ÂMono: Playback [on]
>
> # lsmod | grep snd
> snd_hda_intel 288462 0 - Live 0xbf12e000
> snd_usb_audio 50368 0 - Live 0xbf120000
> snd_usb_lib 10176 1 snd_usb_audio, Live 0xbf11c000
> snd_rawmidi 11584 1 snd_usb_lib, Live 0xbf118000
> snd_pcm 45704 2 snd_hda_intel,snd_usb_audio, Live 0xbf10b000
> snd_page_alloc 4232 2 snd_hda_intel,snd_pcm, Live 0xbf108000
> snd_timer 13092 1 snd_pcm, Live 0xbf103000
> snd_hwdep 3524 1 snd_usb_audio, Live 0xbf101000
> snd_seq_device 3628 1 snd_rawmidi, Live 0xbf0ff000
> snd 26980 7 snd_hda_intel,snd_usb_audio,snd_rawmidi,snd_pcm,snd_timer,snd_hwdep,snd_seq_device, Live 0xbf0f7000
> soundcore 2948 1 snd, Live 0xbf0f5000
>
> # arecord -L
> null
> Â ÂDiscard all samples (playback) or generate zero samples (capture)
> default:CARD=default
> Â ÂC-Media USB Headphone Set Â, USB Audio
> Â ÂDefault Audio Device
>
> # strace arecord
> write(1, "RIFF$\0\0\200WAVE", 12RIFF$ WAVE) = 12
> write(1, "fmt \20\0\0\0", 8fmt Â) = 8
> write(1, "\1\0\1\0@\37\0\0@\37\0\0\1\0\10\0", 16 Â@ @ ) = 16
> write(1, "data\0\0\0\200", 8data ) = 8
> ioctl(4, 0xc0844123, 0x2ada0) = 0
> ioctl(4, 0xc0844123, 0x2ada0) = 0
> ioctl(4, 0x4142, 0x2ada0) = 0
> ioctl(4, 0xc0844123, 0x2ada0) = 0
> poll([{fd=4, events=POLLIN|POLLERR|POLLNVAL}], 1, -1
>
> # dmesg
> ...
> snd-usb-audio 1-1:1.0: usb_probe_interface
> snd-usb-audio 1-1:1.0: usb_probe_interface - got id
> ALSA sound/usb/usbaudio.c:2826: 2:1:1: add audio endpoint 0x1
> ALSA sound/usb/usbaudio.c:2826: 2:2:1: add audio endpoint 0x82
> ALSA sound/usb/usbmixer.c:988: [13] FU [Mic Playback Switch] ch = 1, val
> = 0/1/1
> ALSA sound/usb/usbmixer.c:405: cannot set ctl value: req = 0x4, wValue =
> 0x200, wIndex = 0xd00, type = 4, data = 0x18/0x0
> ALSA sound/usb/usbmixer.c:988: [13] FU [Mic Playback Volume] ch = 1, val
> = 0/12240/384
> ALSA sound/usb/usbmixer.c:988: [9] FU [Speaker Playback Switch] ch = 1,
> val = 0/1/1
> ALSA sound/usb/usbmixer.c:405: cannot set ctl value: req = 0x4, wValue =
> 0x201, wIndex = 0x900, type = 4, data = 0x18/0x0
> ALSA sound/usb/usbmixer.c:988: [9] FU [Speaker Playback Volume] ch = 2,
> val = -7264/-16/48
> ALSA sound/usb/usbmixer.c:988: [10] FU [Mic Capture Switch] ch = 1, val
> = 0/1/1
> ALSA sound/usb/usbmixer.c:405: cannot set ctl value: req = 0x4, wValue =
> 0x200, wIndex = 0xa00, type = 4, data = 0x18/0x0
> ALSA sound/usb/usbmixer.c:988: [10] FU [Mic Capture Volume] ch = 1, val
> = 0/6096/384
> ALSA sound/usb/usbmixer.c:988: [10] FU [Auto Gain Control] ch = 1, val =
> 0/1/1
> usbcore: registered new interface driver snd-usb-audio
> firmware: requesting NPE-C
> NPE-C: firmware's license can be found in /usr/share/doc/LICENSE.IPL
> NPE-C: firmware functionality 0x5, revision 0x2:1
> eth0: link down
> eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
> ALSA sound/usb/usbaudio.c:1350: setting usb interface 2:1
> ALSA sound/usb/usbaudio.c:1350: setting usb interface 2:1
> ALSA sound/usb/usbaudio.c:1350: setting usb interface 2:1
> ALSA sound/usb/usbaudio.c:1350: setting usb interface 2:1
> ALSA sound/usb/usbaudio.c:1350: setting usb interface 2:1
> ...
>
> --
> Tim SjÃstrand, Software Developer
> Communication Research Labs Sweden AB
>
> Address: GrÃndalsvÃgen 19, 392 36 Kalmar, Sweden
> E-mail: tim.sjostrand@xxxxxxxxxxxxx
> www.crlsweden.com
>
> This communication is confidential and is only intended for the use of the individual or entity to which it is directed. ÂThis Email (and any files or other attachments transmitted with it) is intended solely for the use of the addresee(s). ÂIf you are not the intended recipient, please destroy all copies and notify the sender, you should not retain the message or disclose its contents to anyone.
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ÂECMAScript5, and DOM L2 & L3.
> Spend less time writing and Ârewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Alsa-user mailing list
> Alsa-user@xxxxxxxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/alsa-user
>


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user



[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux