All of lore.kernel.org
 help / color / mirror / Atom feed
* Handling hardware error cleanly
@ 2006-11-19 22:29 Lee Revell
  2006-11-20 10:50 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Lee Revell @ 2006-11-19 22:29 UTC (permalink / raw)
  To: alsa-devel; +Cc: Takashi Iwai

I have an ALSA driver that uses a copy() callback for playback, which in
turn schedules a workqueue to deliver the audio to the hardware.  In
certain conditions, writing the data to the hardware can fail.  From the
workqueue handler, how can I indicate to the ALSA middle layer that a
fatal error has occurred and playback must be terminated with -EIO?

Lee


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Handling hardware error cleanly
  2006-11-19 22:29 Handling hardware error cleanly Lee Revell
@ 2006-11-20 10:50 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2006-11-20 10:50 UTC (permalink / raw)
  To: Lee Revell; +Cc: alsa-devel

At Sun, 19 Nov 2006 17:29:14 -0500,
Lee Revell wrote:
> 
> I have an ALSA driver that uses a copy() callback for playback, which in
> turn schedules a workqueue to deliver the audio to the hardware.  In
> certain conditions, writing the data to the hardware can fail.  From the
> workqueue handler, how can I indicate to the ALSA middle layer that a
> fatal error has occurred and playback must be terminated with -EIO?

You can stop the PCM stream from the work handler by calling
snd_pcm_stop().  Usually passing SNDRV_PCM_STATE_XRUN in the second
argument would be fine, especially if a following prepare call can
repair the PCM.

The copy callback can return an error, too.  In this case, the
callback itself should stop the stream explicitly.

Also, the pointer callback can return a special value
SNDRV_PCM_POS_XRUN to indicate the XRUN.  In this case, the PCM core
automatically stops the stream unlike the error case of copy
callback.


Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-11-20 10:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-19 22:29 Handling hardware error cleanly Lee Revell
2006-11-20 10:50 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.