From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MW9U8-0000u1-Ey for qemu-devel@nongnu.org; Wed, 29 Jul 2009 09:46:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MW9U3-0000pG-HS for qemu-devel@nongnu.org; Wed, 29 Jul 2009 09:46:23 -0400 Received: from [199.232.76.173] (port=56001 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MW9U2-0000p1-Vs for qemu-devel@nongnu.org; Wed, 29 Jul 2009 09:46:19 -0400 Received: from canardo.mork.no ([148.122.252.1]:59612) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MW9Tz-0002qz-9r for qemu-devel@nongnu.org; Wed, 29 Jul 2009 09:46:15 -0400 From: =?utf-8?Q?Bj=C3=B8rn_Mork?= Subject: Re: [Qemu-devel] [PATCH] alsa broken when the host is suspended (or hibernated) References: <1248864666-31387-1-git-send-email-bjorn@mork.no> <87fxcf64zy.fsf@nemi.mork.no> Date: Wed, 29 Jul 2009 15:46:01 +0200 In-Reply-To: <87fxcf64zy.fsf@nemi.mork.no> (=?utf-8?Q?=22Bj=C3=B8rn?= Mork"'s message of "Wed, 29 Jul 2009 14:36:01 +0200") Message-ID: <87bpn361ra.fsf@nemi.mork.no> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: malc Cc: qemu-devel@nongnu.org Bj=C3=B8rn Mork writes: > I tried your modified patch with Windows XP as a client, using the > Windows "Sound Recorder" app for testing audio capture. I have it > working up until the host is suspended, but cannot make it work after > resuming. Nothing is captured and nothing is logged to the QEMU > monitor. The "Sound Recorder" app just sits there after pressing record, > without ever changing the stream position from 0,00 sec. I added a few debug printf's and found that the problem is that alsa_get_avail() will report 0 consistently after suspend. Thus, we end up silently returning before ever trying to snd_pcm_readi() anything: avail =3D alsa_get_avail (alsa->handle); decr =3D audio_MIN (dead, avail); if (!decr) { return 0; } I don't know how to best fix this. We probably need to add some code triggering ESTRPIPE when the driver is suspended, even if alsa_get_avail() returns 0. But I hesitate, as that seems rather inefficent just for a special case like suspend/resume. Bj=C3=B8rn