Skip to contentSkip to conversation

ossaudio: fix oss_audio_init

GIT PULL New Gerd Hoffmann 1 participant 3 messages Nov 7, 2013

lore
Share & tools
lore
#0 lore raw

Hi,

Revert broken ossaudio patch, fix oss init for real.

please pull,
Gerd

The following changes since commit c2d30667760e3d7b81290d801e567d4f758825ca:

rtc: remove dead SQW IRQ code (2013-11-05 20:04:03 -0800)

are available in the git repository at:

git://git.kraxel.org/qemu audio.3

for you to fetch changes up to 73204cffe55ce65b3a344afc3da637d67beb8c32:

ossaudio: check for oss support in oss_audio_init (2013-11-07 12:26:00 +0100)

----------------------------------------------------------------
Gerd Hoffmann (2):
Revert "ossaudio: do not enable by default"
ossaudio: check for oss support in oss_audio_init

 audio/ossaudio.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
#1 lore raw

PATCH 1/2 Revert "ossaudio: do not enable by default"

This reverts commit c905c5012ac0c6fde3b8094d2206a3139deddba2.

There is a better fix for the issue at hand.

---
 audio/ossaudio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
audio/ossaudio.c +1 -1
index 3e04a58..007c641 100644
@@ -932,7 +932,7 @@ struct audio_driver oss_audio_driver = {
     .init           = oss_audio_init,
     .fini           = oss_audio_fini,
     .pcm_ops        = &oss_pcm_ops,
-    .can_be_default = 0,
+    .can_be_default = 1,
     .max_voices_out = INT_MAX,
     .max_voices_in  = INT_MAX,
     .voice_size_out = sizeof (OSSVoiceOut),
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/2 ossaudio: check for oss support in oss_audio_init

In reply to Gerd Hoffmann

Check whenever the device path (/dev/dsp by default) exists and qemu is allowed to access it. Return NULL if it isn't, so ossaudio will not be used on systems wihtout oss support (increasinly common on modern linux systems).

---
 audio/ossaudio.c | 4 ++++
 1 file changed, 4 insertions(+)
audio/ossaudio.c +4 -0
index 007c641..5a73716 100644
@@ -849,6 +849,10 @@ static int oss_ctl_in (HWVoiceIn *hw, int cmd, ...)
 
 static void *oss_audio_init (void)
 {
+    if (access(conf.devpath_in, R_OK | W_OK) < 0 ||
+        access(conf.devpath_out, R_OK | W_OK) < 0) {
+        return NULL;
+    }
     return &conf;
 }
 
Signature · 1 line
1.8.3.1