All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre Vanhoucke <pierre.vanhoucke@skynet.be>
To: alsa-devel@alsa-project.org
Subject: Alsa "short read"
Date: Thu, 20 Nov 2008 12:35:55 +0100	[thread overview]
Message-ID: <1227180955.7968.5.camel@pierre-desktop> (raw)

Hi all,

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

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
radio-hams.

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

An ALSA device is opened in blocking mode:

*********************************************
err=snd_pcm_open(&rx_ad_handle, 
                 rx_sndin_plughw_pcm_name,
                 SND_PCM_STREAM_CAPTURE,
                 0);
*********************************************
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
          }
        else 
          {
          if(err < 0)             
            {
            lirerr(1113);           // catch all
            }
          else
            {
            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

                 reply	other threads:[~2008-11-20 11:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1227180955.7968.5.camel@pierre-desktop \
    --to=pierre.vanhoucke@skynet.be \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.