[alsa-devel] Alsa "short read"

Pierre Vanhoucke pierre.vanhoucke at skynet.be
Thu Nov 20 12:35:55 CET 2008

Hi all,

Is there anybody out there who can help me to answer the following

I have converted an application called Linrad
( http://www.nitehawk.com/sm5bsz/linuxdsp/linrad.htm ) from OSS to ALSA.
Linrad is a remarkable DSP application used worldwide by many

I am facing hereby a problem with a "short read" :

An ALSA device is opened in blocking mode:

When I subsequently read the device with following statement I sometimes
get a "short read":
      err=snd_pcm_readi(rx_ad_handle,rxin_isho, rxad.block_frames);
      if((unsigned int)err != rxad.block_frames)
        if(err == -EPIPE)           // EPIPE, try recovery  
          err= snd_pcm_recover(rx_ad_handle, err, 0);
          if(err < 0)lirerr(1108);  // recovery failed
          if(err < 0)             
            lirerr(1113);           // catch all
            lirerr(1116);            // short read

Here are my questions:

1. How is it possible to get a "short read" in blocking mode ?
I would think that in blocking mode the control is only returned after
the read is completed.

2. What are the possible causes for a "short read" ?

3. What can be done to  avoid a "short read" ?

4. How am I supposed to recover from a "short read"?

Best regards,

Pierre Vanhoucke/ ON5GN

More information about the Alsa-devel mailing list