Yair K. wrote:
Hi,

  I noticed pulseaudio has problems starting when OSSv4 is loaded, and traced 
it down to using select() and GET{I,O}SPACE with an mmap()'d device (PulseAudio 
tries using mmap unless explicitly told otherwise). OSS doesn't support that, 
and returns -EIO, which is an error code PulseAudio doesn't check for and 
eventually leads to it failing to start. One might consider blaming Pulseaudio, 
except:

   A) These limitations aren't documented anywhere I can see. AFAICT FreeBSD's 
implementation does support using select(),etc. with mmap().
   B) OSS's return value isn't entirely consistent: It returns OSS_EIO when 
select() is used (oss_audio_core.c / oss_audio_chpoll() ), but OSS_EPERM when 
GETOSPACE is used with mmap. OSS_EIO seems wrong to me - the device is okay, 
it's just select() isn't supported in the current mode.

The attached diff comments out the error checking. However the result is probably that select/poll will never report data available. However could you try if it makes any difference with pulseaudio.

The correct behaviour might be waiting for the next interrupt before returning from poll/select. This may require nasty rewriting of the code.

Best regards,

Hannu
diff -r a962227d9394 kernel/framework/audio/oss_audio_core.c
--- a/kernel/framework/audio/oss_audio_core.c   Mon Aug 18 23:18:20 2008 +0300
+++ b/kernel/framework/audio/oss_audio_core.c   Tue Aug 19 14:23:32 2008 +0300
@@ -5692,6 +5692,12 @@ oss_audio_chpoll (int dev, struct filein
       int limit;
 
       dmap = adev->dmap_out;
+#if 1
+      /*
+       * It might actually be better to permit pollling in mmapped
+       * mode rather than returning an error.
+       */
+#else
       if (dmap->mapping_flags & DMA_MAP_MAPPED)
        {
          oss_audio_set_error (adev->engine_num, E_PLAY,
@@ -5703,8 +5709,9 @@ oss_audio_chpoll (int dev, struct filein
           * The select() and poll() system calls are not defined for OSS 
devices
           * when the device is in mmap mode.
           */
-         return OSS_EIO;
-       }
+         return OSS_EPERM;
+       }
+#endif
 
       if (dmap->dma_mode == PCM_ENABLE_INPUT)
        {
@@ -5749,6 +5756,12 @@ oss_audio_chpoll (int dev, struct filein
       int limit;
 
       dmap = adev->dmap_in;
+#if 1
+      /*
+       * It might actually be better to permit pollling in mmapped
+       * mode rather than returning an error.
+       */
+#else
       if (dmap->mapping_flags & DMA_MAP_MAPPED)
        {
          oss_audio_set_error (adev->engine_num, E_REC,
@@ -5762,6 +5775,7 @@ oss_audio_chpoll (int dev, struct filein
           */
          return OSS_EIO;
        }
+#endif
 
       if (dmap->dma_mode != PCM_ENABLE_INPUT)
        {
_______________________________________________
oss-devel mailing list
oss-devel@mailman.opensound.com
http://mailman.opensound.com/mailman/listinfo/oss-devel

Reply via email to