summaryrefslogtreecommitdiff
path: root/sysutils/xcdroast/patches/patch-ac
blob: ad250e1e73e7edb1e67a5b8c2a24b758ffc2505b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
$NetBSD: patch-ac,v 1.5 2002/10/26 17:05:30 frueauf Exp $

--- io.c.orig	Tue Jul 17 21:39:11 2001
+++ io.c	Sat Oct 26 18:44:59 2002
@@ -16,6 +16,14 @@
 #include <sys/wait.h>
 #include <signal.h>
 #include <time.h>
+#ifdef __NetBSD__
+# include <sys/ioctl.h>
+# ifdef HAVE_OSS
+#  include <soundcard.h>
+# else
+#  include <sys/audioio.h>
+# endif
+#endif
 #if defined(linux) || defined(__FreeBSD__)
 # include <sys/soundcard.h>
 # include <sys/ioctl.h>
@@ -996,22 +1004,22 @@
 GList *dsp;
 GList *loop;
 struct stat buf;
-#ifdef sun
+#if defined(sun) || (defined(__NetBSD__) && !defined(HAVE_OSS))
 gchar *audiodev;
 #endif
 	dsp = NULL;
 
-#if defined(linux) || defined(__FreeBSD__)
+#if defined(linux) || defined(__FreeBSD__) || (defined(__NetBSD__) && defined(HAVE_OSS))
 	/* for linux check if /dev/dsp or /dev/dsp1 exist */
 
-	if (stat("/dev/dsp",&buf) == 0) {
-		dsp = g_list_append(dsp,"/dev/dsp");
+	if (stat("@DEVOSSAUDIO@",&buf) == 0) {
+		dsp = g_list_append(dsp,"@DEVOSSAUDIO@");
 	}
 	if (stat("/dev/dsp1",&buf) == 0) {
 		dsp = g_list_append(dsp,"/dev/dsp1");
 	}
 #endif
-#ifdef sun
+#if defined(sun) || (defined(__NetBSD__) && !defined(HAVE_OSS))
 	/* check if the user has any special audio-hardware running,
 	   which set the AUDIODEV-environment-variable */
 	audiodev = getenv("AUDIODEV");
@@ -1066,15 +1074,15 @@
 gchar *gen_mix_from_dspdev(gchar *dsp, gchar *ret) {
 gchar tmp[MAXLINE];
 struct stat buf;
-#if defined(linux) || defined(__FreeBSD__)
+#if defined(linux) || defined(__FreeBSD__) || (defined(__NetBSD__) && defined(HAVE_OSS))
 gchar tmp2[MAXLINE];
 #endif
 
 	strcpy(ret,"");
 
-#if defined(linux) || defined(__FreeBSD__)
+#if defined(linux) || defined(__FreeBSD__) || (defined(__NetBSD__) && defined(HAVE_OSS))
 
-	if (strncmp(dsp,"/dev/dsp",8) == 0) {
+	if (strncmp(dsp,"@DEVOSSAUDIO@",8) == 0) {
 		strcpy(tmp,dsp+8);
 		g_snprintf(tmp2,MAXLINE,"/dev/mixer%s",tmp);
 
@@ -1084,7 +1092,7 @@
 		}	
 	}	
 #endif
-#ifdef sun
+#if defined(sun) || (defined(__NetBSD__) && !defined(HAVE_OSS))
 
 	g_snprintf(tmp,MAXLINE,"%s%s",dsp,"ctl");
 
@@ -1991,7 +1999,7 @@
 		}
 
 		/* startup child */
-		if (execl("/bin/sh", "sh", "-c", cmd ,NULL) < 0) {
+		if (execl("/bin/sh", "sh", "-c", cmd ,(void *)NULL) < 0) {
 			g_error("execl error\n");
 		}
  
@@ -2362,10 +2370,10 @@
 
 gint query_mixer() {
 gint mix;
-#if defined(linux) || defined(__FreeBSD__)
+#if defined(linux) || defined(__FreeBSD__) || (defined(__NetBSD__) && defined(HAVE_OSS))
 gint val;
 #endif
-#ifdef sun
+#if defined(sun) || (defined(__NetBSD__) && !defined(HAVE_OSS))
 audio_info_t ainfo;
 #endif
 #ifdef hpux
@@ -2380,7 +2388,7 @@
 		return -1;
 	}
 
-#if defined(linux) || defined(__FreeBSD__)
+#if defined(linux) || defined(__FreeBSD__) || (defined(__NetBSD__) && defined(HAVE_OSS))
 
 	dodebug(10,"quering mixer %s\n", setupdata.mix_device);
 	mix = open(setupdata.mix_device, O_RDWR);
@@ -2400,7 +2408,7 @@
 	return ((val & 0x7f) + ((val >> 8) & 0x7f))/2;
 
 #endif
-#ifdef sun
+#if defined(sun) || (defined(__NetBSD__) && !defined(HAVE_OSS))
 
 	dodebug(10,"quering mixer %s\n", setupdata.mix_device);
 	mix = open(setupdata.mix_device, O_RDONLY);
@@ -2450,7 +2458,7 @@
 
 gint set_mixer(gint val) {
 gint mix;
-#ifdef sun
+#if defined(sun) || (defined(__NetBSD__) && !defined(HAVE_OSS))
 audio_info_t ainfo;
 #endif
 #ifdef hpux
@@ -2464,7 +2472,7 @@
 		return -1;
 	}
 
-#if defined(linux) || defined(__FreeBSD__)
+#if defined(linux) || defined(__FreeBSD__) || (defined(__NetBSD__) && defined(HAVE_OSS))
 
 	dodebug(10,"setting mixer %s to %d\n", setupdata.mix_device, val);
 	mix = open(setupdata.mix_device, O_RDWR);
@@ -2482,7 +2490,7 @@
 	close(mix);
 
 #endif 
-#ifdef sun
+#if defined(sun) || (defined(__NetBSD__) && !defined(HAVE_OSS))
 
 	dodebug(10,"setting mixer %s to %d\n", setupdata.mix_device, val);
 	mix = open(setupdata.mix_device, O_WRONLY);
@@ -3275,6 +3283,9 @@
 		/* 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;
 		}
 	}