$OpenBSD: patch-io_c,v 1.1.1.1 2002/07/14 19:34:28 wilfried Exp $
--- io.c.orig	Tue May 14 08:37:51 2002
+++ io.c	Tue May 14 08:38:12 2002
@@ -20,7 +20,8 @@
 # include <sys/soundcard.h>
 # include <sys/ioctl.h>
 #endif
-#ifdef sun 
+#if defined(sun) || defined (__OpenBSD__) 
+# include <sys/ioctl.h>
 # include <sys/audioio.h>
 #endif
 #ifdef hpux 
@@ -996,7 +997,7 @@ GList *get_dsp_devices() {
 GList *dsp;
 GList *loop;
 struct stat buf;
-#ifdef sun
+#if defined(sun) || defined(__OpenBSD__)
 gchar *audiodev;
 #endif
 	dsp = NULL;
@@ -1011,7 +1012,7 @@ gchar *audiodev;
 		dsp = g_list_append(dsp,"/dev/dsp1");
 	}
 #endif
-#ifdef sun
+#if defined(sun) || defined(__OpenBSD__)
 	/* check if the user has any special audio-hardware running,
 	   which set the AUDIODEV-environment-variable */
 	audiodev = getenv("AUDIODEV");
@@ -1084,7 +1085,7 @@ gchar tmp2[MAXLINE];
 		}	
 	}	
 #endif
-#ifdef sun
+#if defined(sun) || defined(__OpenBSD__)
 
 	g_snprintf(tmp,MAXLINE,"%s%s",dsp,"ctl");
 
@@ -2365,7 +2366,7 @@ gint mix;
 #if defined(linux) || defined(__FreeBSD__)
 gint val;
 #endif
-#ifdef sun
+#if defined(sun) || defined(__OpenBSD__)
 audio_info_t ainfo;
 #endif
 #ifdef hpux
@@ -2400,7 +2401,7 @@ struct audio_gains again;
 	return ((val & 0x7f) + ((val >> 8) & 0x7f))/2;
 
 #endif
-#ifdef sun
+#if defined(sun) || defined(__OpenBSD__)
 
 	dodebug(10,"quering mixer %s\n", setupdata.mix_device);
 	mix = open(setupdata.mix_device, O_RDONLY);
@@ -2450,7 +2451,7 @@ struct audio_gains again;
 
 gint set_mixer(gint val) {
 gint mix;
-#ifdef sun
+#if defined(sun) || defined(__OpenBSD__)
 audio_info_t ainfo;
 #endif
 #ifdef hpux
@@ -2482,7 +2483,7 @@ struct audio_gains again;
 	close(mix);
 
 #endif 
-#ifdef sun
+#if defined(sun) || defined(__OpenBSD__)
 
 	dodebug(10,"setting mixer %s to %d\n", setupdata.mix_device, val);
 	mix = open(setupdata.mix_device, O_WRONLY);
@@ -3275,6 +3276,9 @@ gint ret,found;
 		/* got the message that no medium is present?
 		   in this case, ignore return code */ 
 		if (strstr(line,"medium not present")) {
+			found = 1;
+		}
+		if (strstr(line,"Device not ready")) {
 			found = 1;
 		}
 	}
