Re: Handling hardware error cleanly

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

 



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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux