title: alsa - managing non-blocking stream
body: <p>Working with a usb audio device (its a HID with multiple channels) that constantly outputs data. </p>
  
  <p>What I'm hoping to achieve is to ignore the audio until a signal comes in from the device. At that point I would start monitoring the feed. A second signal from the device would indicate that I can go back to ignoring the data. I have opened said device in non-blocking mode so it won't interfere with other USB signals coming in. </p>
  
  <p>This is working fine except that when I start reading the data (via <code>snd_pcm_readi</code>) I get an EPIPE error indicating a buffer overrun. This can be fixed by calling <code>snd_pcm_prepare</code> every time but I'm hoping there is a way to let the buffer empty while Im ignoring it.</p>
  
  <p>I've looked at <code>snd_pcm_drain</code> and <code>snd_pcm_drop</code> but these stop the PCM and I'd rather keep it open.</p>
  
  <p>Suggestions?</p>