View | Details | Raw Unified | Return to bug 106247 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-14 / +16 lines)
Lines 2-18 Link Here
2
# Date created:		7 July 2004
2
# Date created:		7 July 2004
3
# Whom:			db
3
# Whom:			db
4
#
4
#
5
# $FreeBSD: ports/comms/linrad/Makefile,v 1.8 2006/09/12 08:14:21 itetcu Exp $
5
# $FreeBSD: ports/comms/linrad/Makefile,v 1.7 2006/09/08 22:52:36 itetcu Exp $
6
#
6
#
7
7
8
PORTNAME=	linrad
8
PORTNAME=	linrad
9
PORTVERSION=	2.17
9
PORTVERSION=	2.20
10
PORTREVISION=	1
11
CATEGORIES=	comms
10
CATEGORIES=	comms
12
MASTER_SITES=	http://www.nitehawk.com/sm5bsz/linuxdsp/archive/\
11
MASTER_SITES=	http://www.nitehawk.com/sm5bsz/linuxdsp/archive/\
13
		http://g7rau.demon.co.uk/sm5bsz/linuxdsp/archive/\
12
		http://g7rau.demon.co.uk/sm5bsz/linuxdsp/archive/\
14
		http://www.sm5bsz.com/linuxdsp/archive/
13
		http://www.sm5bsz.com/linuxdsp/archive/
15
DISTNAME=	lir02-17
14
DISTNAME=	lir02-20
16
EXTRACT_SUFX=	.tbz
15
EXTRACT_SUFX=	.tbz
17
DIST_SUBDIR=	${PORTNAME}
16
DIST_SUBDIR=	${PORTNAME}
18
17
Lines 21-46 Link Here
21
20
22
BUILD_DEPENDS=	nasm:${PORTSDIR}/devel/nasm
21
BUILD_DEPENDS=	nasm:${PORTSDIR}/devel/nasm
23
22
24
WRKSRC=		${WRKDIR}/${PORTNAME}-02.17
23
WRKSRC=		${WRKDIR}/${PORTNAME}-02.20
25
24
26
USE_AUTOTOOLS=	autoconf:253
25
USE_AUTOTOOLS=	autoconf:253
27
HAS_CONFIGURE=	yes
26
GNU_CONFIGURE=	yes
27
USE_GMAKE=	yes
28
USE_BZIP2=	yes
28
USE_BZIP2=	yes
29
ALL_TARGET=	xlinrad
29
ALL_TARGET=	xlinrad
30
USE_X_PREFIX=	yes
30
USE_X_PREFIX=	yes
31
ONLY_FOR_ARCHS=	i386
31
ONLY_FOR_ARCHS=	i386
32
X11_PATCHFILES=	Makefile.in help.c xmain.c
32
33
33
.include <bsd.port.pre.mk>
34
.include <bsd.port.pre.mk>
34
.if ${OSVERSION} < 500000
35
.if ${OSVERSION} < 500000
35
IGNORE=		does not compile on FreeBSD 4.x
36
BROKEN=		Does not compile on FreeBSD 4.x
36
.endif
37
.endif
37
38
38
post-patch:
39
post-patch:
39
	@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
40
	@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
40
	-e 's|%%X11BASE%%|${X11BASE}|g' \
41
	-e 's|-lpthread|${PTHREAD_LIBS}|g' ${WRKSRC}/Makefile.in
41
	-e 's|-lpthread|${PTHREAD_LIBS}|g' ${WRKSRC}/Makefile.in
42
	@${REINPLACE_CMD} -e 's|%%DATADIR%%|${DATADIR}/|' \
42
	@${REINPLACE_CMD} -e 's|%%DATADIR%%|${DATADIR}/|' \
43
		${WRKSRC}/help.c
43
		${WRKSRC}/help.c
44
.for f in ${X11_PATCHFILES}
45
	@${REINPLACE_CMD} -e 's|/usr/X11R6|${X11BASE}|g' ${WRKSRC}/${f}
46
.endfor
47
44
do-install:
48
do-install:
45
	${MKDIR} ${DATADIR}
49
	${MKDIR} ${DATADIR}
46
	${INSTALL_DATA} ${WRKSRC}/errors.lir ${DATADIR}/errors.lir
50
	${INSTALL_DATA} ${WRKSRC}/errors.lir ${DATADIR}/errors.lir
Lines 49-55 Link Here
49
# Some day we may want the svga version as well.
53
# Some day we may want the svga version as well.
50
#	${INSTALL_PROGRAM} -m04555 ${WRKSRC}/${PORTNAME} ${PREFIX}/bin/${PORTNAME}.svga
54
#	${INSTALL_PROGRAM} -m04555 ${WRKSRC}/${PORTNAME} ${PREFIX}/bin/${PORTNAME}.svga
51
	${INSTALL_PROGRAM} -m04555 ${WRKSRC}/x${PORTNAME} ${PREFIX}/bin/x${PORTNAME}
55
	${INSTALL_PROGRAM} -m04555 ${WRKSRC}/x${PORTNAME} ${PREFIX}/bin/x${PORTNAME}
52
53
.if !defined(NOPORTDOCS)
56
.if !defined(NOPORTDOCS)
54
	${MKDIR} ${DOCSDIR}
57
	${MKDIR} ${DOCSDIR}
55
	${INSTALL_DATA} ${WRKSRC}/z_APM.txt ${DOCSDIR}/z_APM.txt
58
	${INSTALL_DATA} ${WRKSRC}/z_APM.txt ${DOCSDIR}/z_APM.txt
Lines 57-68 Link Here
57
	${INSTALL_DATA} ${WRKSRC}/z_CALIBRATE.txt ${DOCSDIR}/z_CALIBRATE.txt
60
	${INSTALL_DATA} ${WRKSRC}/z_CALIBRATE.txt ${DOCSDIR}/z_CALIBRATE.txt
58
	${INSTALL_DATA} ${WRKSRC}/z_COPYRIGHT.txt ${DOCSDIR}/z_COPYRIGHT.txt
61
	${INSTALL_DATA} ${WRKSRC}/z_COPYRIGHT.txt ${DOCSDIR}/z_COPYRIGHT.txt
59
	${INSTALL_DATA} ${WRKSRC}/z_GIFINFO.txt ${DOCSDIR}/z_GIFINFO.txt
62
	${INSTALL_DATA} ${WRKSRC}/z_GIFINFO.txt ${DOCSDIR}/z_GIFINFO.txt
60
	${INSTALL_DATA} ${WRKSRC}/z_MLOCK.txt ${DOCSDIR}/z_MLOCK.txt
61
	${INSTALL_DATA} ${WRKSRC}/z_MOUSE.txt ${DOCSDIR}/z_MOUSE.txt
63
	${INSTALL_DATA} ${WRKSRC}/z_MOUSE.txt ${DOCSDIR}/z_MOUSE.txt
62
	${INSTALL_DATA} ${WRKSRC}/z_PARALLEL_PORT.txt ${DOCSDIR}/z_PARALLEL_PORT.txt
64
	${INSTALL_DATA} ${WRKSRC}/z_MOUSE.txt ${DOCSDIR}/z_PARALLEL_PORT.txt
63
	${INSTALL_DATA} ${WRKSRC}/z_SETTINGS.txt ${DOCSDIR}/z_SETTINGS.txt
65
	${INSTALL_DATA} ${WRKSRC}/z_MOUSE.txt ${DOCSDIR}/z_SETTINGS.txt
64
	${INSTALL_DATA} ${WRKSRC}/z_USERS_EXTRA.txt ${DOCSDIR}/z_USERS_EXTRA.txt
66
	${INSTALL_DATA} ${WRKSRC}/z_MOUSE.txt ${DOCSDIR}/z_USERS_EXTRA.txt
65
	${INSTALL_DATA} ${WRKSRC}/z_USERS_HWARE.txt ${DOCSDIR}/z_USERS_HWARE.txt
67
	${INSTALL_DATA} ${WRKSRC}/z_MOUSE.txt ${DOCSDIR}/z_USERS_HWARE.txt
66
	${INSTALL_DATA} ${WRKSRC}/z_USLEEP.txt ${DOCSDIR}/z_USLEEP.txt
68
	${INSTALL_DATA} ${WRKSRC}/z_USLEEP.txt ${DOCSDIR}/z_USLEEP.txt
67
	@${ECHO} ""
69
	@${ECHO} ""
68
	@${ECHO} "linrad docs installed in ${DOCSDIR}"
70
	@${ECHO} "linrad docs installed in ${DOCSDIR}"
(-)distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
MD5 (linrad/lir02-17.tbz) = 8c87228f11be0baf48a54ec51992d93e
1
MD5 (linrad/lir02-20.tbz) = 00a7e94eb52ce4941004e7ca96243c84
2
SHA256 (linrad/lir02-17.tbz) = c48a3d31a56e147c9c86acfe787bfae96b4c9c81325f64d3ed65844332dad40b
2
SHA256 (linrad/lir02-20.tbz) = 91b91128ff441d6807fd7ea4957fb159748b24dc1d44c6203ac01f296711fde8
3
SIZE (linrad/lir02-17.tbz) = 429631
3
SIZE (linrad/lir02-20.tbz) = 445625
(-)pkg-message (-1 / +1 lines)
Lines 1-5 Link Here
1
linrad is now installed.
1
linrad is now installed.
2
linrad is now a shell script which "wraps" xlinrad.
2
linrad is a shell script which "wraps" xlinrad.
3
When used for the first time, the linrad wrapper will create a ~/.linrad
3
When used for the first time, the linrad wrapper will create a ~/.linrad
4
directory which will be your working directory.
4
directory which will be your working directory.
5
5
(-)pkg-plist (-1 lines)
Lines 7-13 Link Here
7
%%PORTDOCS%%%%DOCSDIR%%/z_CALIBRATE.txt
7
%%PORTDOCS%%%%DOCSDIR%%/z_CALIBRATE.txt
8
%%PORTDOCS%%%%DOCSDIR%%/z_COPYRIGHT.txt
8
%%PORTDOCS%%%%DOCSDIR%%/z_COPYRIGHT.txt
9
%%PORTDOCS%%%%DOCSDIR%%/z_GIFINFO.txt
9
%%PORTDOCS%%%%DOCSDIR%%/z_GIFINFO.txt
10
%%PORTDOCS%%%%DOCSDIR%%/z_MLOCK.txt
11
%%PORTDOCS%%%%DOCSDIR%%/z_MOUSE.txt
10
%%PORTDOCS%%%%DOCSDIR%%/z_MOUSE.txt
12
%%PORTDOCS%%%%DOCSDIR%%/z_PARALLEL_PORT.txt
11
%%PORTDOCS%%%%DOCSDIR%%/z_PARALLEL_PORT.txt
13
%%PORTDOCS%%%%DOCSDIR%%/z_SETTINGS.txt
12
%%PORTDOCS%%%%DOCSDIR%%/z_SETTINGS.txt
(-)files/patch-Makefile.in (-3 / +21 lines)
Lines 1-5 Link Here
1
--- Makefile.in.orig	Fri Jul 14 17:35:38 2006
1
--- Makefile.in.orig	Tue Nov  7 13:45:32 2006
2
+++ Makefile.in	Fri Jul 28 13:12:35 2006
2
+++ Makefile.in	Sun Dec  3 15:06:40 2006
3
@@ -4,17 +4,14 @@
3
@@ -4,17 +4,14 @@
4
 # Name the output files *.ol instead of *.o 
4
 # Name the output files *.ol instead of *.o 
5
 # so we definitely know it is for Linux. 
5
 # so we definitely know it is for Linux. 
Lines 16-22 Link Here
16
--Wunused -Wcomment -Wchar-subscripts -Wshadow -Wuninitialized \
16
--Wunused -Wcomment -Wchar-subscripts -Wshadow -Wuninitialized \
17
--Wparentheses -Wstrict-prototypes -Werror -ffast-math \
17
--Wparentheses -Wstrict-prototypes -Werror -ffast-math \
18
--fomit-frame-pointer -c -o
18
--fomit-frame-pointer -c -o
19
+CFL	= ${CFLAGS} -I%%LOCALBASE%%/include -I%%X11BASE%%/include -L%%LOCALBASE%%/lib -L%%X11BASE%%/lib -DOSNUM=1 -ffast-math -fomit-frame-pointer -c -o 
19
+CFL	= ${CFLAGS} -I/usr/local/include -I/usr/X11R6/include -L/usr/local/lib -L/usr/X11R6/lib -DOSNUM=1 -ffast-math -fomit-frame-pointer -c -o 
20
 CFW	= -g -O -DOSNUM=2 -W -Wimplicit -Wreturn-type -Wformat \
20
 CFW	= -g -O -DOSNUM=2 -W -Wimplicit -Wreturn-type -Wformat \
21
 -Wunused -Wcomment -Wchar-subscripts -Wshadow -Wuninitialized \
21
 -Wunused -Wcomment -Wchar-subscripts -Wshadow -Wuninitialized \
22
 -Wparentheses -Wstrict-prototypes -Werror -ffast-math \
22
 -Wparentheses -Wstrict-prototypes -Werror -ffast-math \
23
@@ -386,7 +383,7 @@
24
 meter_graph.ol fonts.ol screensub.ol membeg.ol lxsys.ol memend.ol
25
 
26
 
27
-	gcc -olinrad -lvgagl -lvga -lpthread -lm \
28
+	gcc -olinrad -lvgagl -lvga -pthread -lm \
29
 -Wl,-Map,linrad.lmap,-warn-common \
30
 	membeg.ol lmain.ol linvar.ol ui.ol lsetad.ol fft1.ol buf.ol \
31
 mouse.ol wide_graph.ol getiq.ol fft0.ol adtest.ol hires_graph.ol \
32
@@ -432,7 +429,7 @@
33
 
34
 
35
 
36
-	gcc -oxlinrad -L/usr/X11R6/lib -lX11 -lpthread -lm \
37
+	gcc -oxlinrad -L/usr/X11R6/lib -lX11 -pthread -lm \
38
 -Wl,-Map,linrad.xmap,-warn-common \
39
 membeg.ol xmain.ol xvar.ol ui.ol lsetad.ol fft1.ol buf.ol \
40
 mouse.ol wide_graph.ol getiq.ol fft0.ol adtest.ol hires_graph.ol \
(-)files/patch-help.c (-6 / +6 lines)
Lines 1-20 Link Here
1
--- help.c.orig	Fri Jul 28 13:12:59 2006
1
--- help.c.orig	Tue Nov  7 13:45:32 2006
2
+++ help.c	Sat Jul 29 00:50:34 2006
2
+++ help.c	Fri Nov 24 18:02:31 2006
3
@@ -337,7 +337,7 @@
3
@@ -352,7 +352,7 @@
4
   printf("\n%s",s);
4
   printf("\n%s",s);
5
   DEB"\n%s",s);
5
   DEB"\n%s",s);
6
   }  
6
   }  
7
-msg_filename="errors.lir";
7
-msg_filename="errors.lir";
8
+msg_filename="%%DATADIR%%errors.lir";
8
+msg_filename="/usr/X11R6/share/linrad/errors.lir";
9
 line=3;
9
 line=3;
10
 if(screen_mode)
10
 if(screen_mode)
11
   {
11
   {
12
@@ -352,7 +352,7 @@
12
@@ -367,7 +367,7 @@
13
 {
13
 {
14
 int line;
14
 int line;
15
 if(msg_no < 0)return;
15
 if(msg_no < 0)return;
16
-msg_filename="help.lir";
16
-msg_filename="help.lir";
17
+msg_filename="%%DATADIR%%help.lir";
17
+msg_filename="/usr/X11R6/share/linrad/help.lir";
18
 line=0;
18
 line=0;
19
 settextcolor(15);
19
 settextcolor(15);
20
 clear_screen();
20
 clear_screen();
(-)files/patch-lsetad.c (-1289 lines)
Removed Link Here
1
--- lsetad.c.orig	Tue Aug 15 15:27:44 2006
2
+++ lsetad.c	Mon Sep 11 15:46:13 2006
3
@@ -39,7 +39,7 @@
4
 #define ABOVE_MAX_SPEED 768000
5
 #if SND_DEV == 1
6
 #define DEVNAME_BASE "/dev/dsp"
7
-#else 
8
+#else
9
 #define DEVNAME_BASE "/dev/sound/dsp"
10
 #endif
11
 
12
@@ -83,15 +83,12 @@
13
 sdr=-1;
14
 }
15
 
16
-
17
 void display_sdi(void)
18
 {
19
 FILE *sdifile;
20
-int  ch_cnt;
21
-char ch_read[80];
22
+char *p;
23
 char work_line [80];
24
-int  work_line_pos ; 
25
-int  sdi_screen_line_counter; 
26
+int  sdi_screen_line_counter;
27
 char sdi_intro_msg [26]= "SOUND DRIVER INFORMATION:" ;
28
 char sdi_error_msg [46]= "No OSS or ALSA sound-driver information found";
29
 char sndstat_filename [25];
30
@@ -111,59 +108,46 @@
31
 // if OSS not active, try  ALSA
32
 if (sdifile==NULL)
33
   {
34
-  strcpy (sndstat_filename,"/proc/asound/oss/sndstat");   
35
-  sdifile=fopen (sndstat_filename,"r"); 
36
-  }
37
-if (sdifile==NULL) 
38
-  {
39
-  settextcolor(LIGHT_RED); 
40
-  lir_text ( 80, sdi_screen_line_counter++, sdi_error_msg);
41
-  fprintf (sndlog,"\n%s",sdi_error_msg ); 
42
-  goto display_sdi_x;
43
+  strcpy (sndstat_filename,"/proc/asound/oss/sndstat");
44
+  sdifile=fopen (sndstat_filename,"r");
45
   }
46
-fprintf (sndlog,"\n(output of 'cat %s' command): \n\n",sndstat_filename );
47
-memset (work_line, '\0',sizeof(work_line));
48
-work_line_pos =0; 
49
-settextcolor(LIGHT_GREEN);
50
-ch_cnt=fread(ch_read,1,1,sdifile);
51
-while (ch_cnt== 1)
52
+if (sdifile!=NULL)
53
   {
54
-// check if work_line is ready for output processing
55
-  if ((ch_read[0] =='\n') || (work_line_pos == 78))
56
+  fprintf (sndlog,"\n(output of 'cat %s' command): \n\n",sndstat_filename );
57
+  settextcolor(LIGHT_GREEN);
58
+  while(fgets(work_line, sizeof(work_line)-1, sdifile) != NULL)
59
     {
60
+// check if work_line is ready for output processing
61
+    p=strchr(work_line, '\n');
62
+    if(p != NULL)p[0]=0;
63
+    if (*work_line != '\0')
64
+      {
65
 // display work_line only if it is not blank
66
 // and there are enough lines available on the screen
67
 // and there are at least 40 characters available on a line
68
-    if ((work_line_pos >1) && 
69
-       ( sdi_screen_line_counter < screen_last_line) &&  
70
-       ((screen_last_col - 40)>= 80))
71
-      {
72
-      if (ch_read[0] !='\n') work_line[work_line_pos]=ch_read[0]; 
73
-      sdi_screen_line_counter++;
74
-      lir_text (80, sdi_screen_line_counter, work_line);
75
-      }
76
+      if (sdi_screen_line_counter < screen_last_line &&
77
+                                               (screen_last_col - 40)>= 80)
78
+        {
79
+        sdi_screen_line_counter++;
80
+        lir_text (80, sdi_screen_line_counter, work_line);
81
+        }
82
 // write  to soundboard_init.log
83
-    if (ch_read[0] =='\n')  work_line[work_line_pos]=ch_read[0]; 
84
-    if (ch_read[0] !='\n') 
85
-      {
86
-// this is a truncated line. Add newline character
87
-      work_line[work_line_pos]=ch_read[0]; 
88
-      work_line[work_line_pos+1]='\n';
89
-      }
90
-    fprintf (sndlog,"%s",work_line); 
91
-    memset (work_line, '\0',sizeof(work_line));   
92
-    work_line_pos=-1;
93
-    }
94
-  work_line[work_line_pos]=ch_read[0]; 
95
-  work_line_pos++;
96
-  ch_cnt=fread(ch_read,1,1,sdifile);
97
+      fprintf (sndlog,"%s\n",work_line);
98
+      }
99
+    }
100
+  fclose(sdifile);
101
+  }
102
+else
103
+  {
104
+  settextcolor(LIGHT_RED);
105
+  lir_text ( 80, sdi_screen_line_counter++, sdi_error_msg);
106
+  fprintf (sndlog,"\n%s",sdi_error_msg );
107
   }
108
-fclose(sdifile);
109
-display_sdi_x:;
110
 fprintf(sndlog,sndlog_sep);
111
 fflush(sndlog);
112
 }
113
 
114
+
115
 void clear_sdi(void)
116
 {
117
 int x, w;
118
@@ -209,6 +193,8 @@
119
         thread_status_flag[THREAD_SCREEN]!=THRFLAG_IDLE &&
120
         thread_status_flag[THREAD_SCREEN]!=THRFLAG_SEM_WAIT)
121
     {
122
+    if(thread_command_flag[THREAD_RX_ADINPUT] == 
123
+                                           THRFLAG_KILL)goto rxadin_error_exit;
124
     lir_sleep(10000);
125
     }
126
   }
127
@@ -239,7 +225,7 @@
128
     }
129
 #endif
130
   if(hware_flag != 0)
131
-    {    
132
+    {
133
     dt1=current_time();
134
     if(dt1 - hware_time > 0.005)
135
       {
136
@@ -265,7 +251,7 @@
137
       measured_ad_speed=total_reads*ad_read_fragments/dt1;
138
       }
139
     }
140
-// Here we post to the screen routine every 0.1 second.      
141
+// Here we post to the screen routine every 0.1 second.
142
   screen_loop_counter--;
143
   if(screen_loop_counter == 0)
144
     {
145
@@ -304,8 +290,8 @@
146
         rxin_int[4*i+2]=rxin_int2[2*i  ];
147
         rxin_int[4*i+3]=rxin_int2[2*i+1];
148
         }
149
-      }    
150
-    }    
151
+      }
152
+    }
153
   if(network_flag == 1)
154
     {
155
     if(network_modeno == 1)
156
@@ -321,14 +307,14 @@
157
         }
158
       write(network_sockfd, rxin_isho, ad_read_bytes);
159
       }
160
-    }  
161
+    }
162
   finish_rx_read(rxin_isho);
163
   if(kill_all_flag) goto rxadin_error_exit;
164
   }
165
-rxadin_error_exit:;  
166
+rxadin_error_exit:;
167
 while( audio_out == audio_in)lir_sleep(10000);
168
-close_rx_sndin();  
169
-rx_adin_init_error:;  
170
+close_rx_sndin();
171
+rx_adin_init_error:;
172
 thread_status_flag[THREAD_RX_ADINPUT]=THRFLAG_RETURNED;
173
 while(thread_command_flag[THREAD_RX_ADINPUT] != THRFLAG_NOT_ACTIVE)
174
   {
175
@@ -360,7 +346,7 @@
176
   lir_sleep(3000);
177
   i++;
178
   if(i<10)goto buftest;
179
-  }  
180
+  }
181
 i=da_totbytes-da_info.bytes;
182
 i/=(da_output_channels*da_output_bytes);
183
 return i;
184
@@ -375,13 +361,13 @@
185
 for(i=0; i<daout_block; i++)da_wrbuf[i]=0;
186
 write(audio_out,da_wrbuf,daout_block);
187
 if(ioctl(audio_out,SNDCTL_DSP_GETOSPACE, &da_info) == -1)lirerr(errcod);
188
-} 
189
+}
190
 
191
 
192
 void lir_empty_da_device_buffer(void)
193
 {
194
 int i;
195
-if( audio_out == -1) 
196
+if( audio_out == -1)
197
   {
198
   open_rx_sndout();
199
   if(kill_all_flag) return;
200
@@ -402,7 +388,7 @@
201
   if(da_info.fragstotal - da_info.fragments <= 4)
202
     {
203
     write(audio_out,da_wrbuf,daout_block);
204
-    } 
205
+    }
206
   if(ioctl(audio_out,SNDCTL_DSP_RESET,0)==-1)
207
     {
208
     if(ui.da_stopstart == 0)
209
@@ -470,7 +456,7 @@
210
   if(i<25)goto buftest;
211
   err_restart_da(23855);
212
   if(kill_all_flag) return;
213
-  }  
214
+  }
215
 write(audio_out,da_wrbuf,daout_block);
216
 }
217
 
218
@@ -490,11 +476,11 @@
219
   lirerr(9236);
220
   return;
221
   }
222
-if (n+2 == MAX_DEVNAMES) 
223
+if (n+2 == MAX_DEVNAMES)
224
   {
225
   sprintf(dev_name, "%s", DEVNAME_BASE);
226
-  } 
227
-else 
228
+  }
229
+else
230
   {
231
   sprintf(dev_name, "%s%d", DEVNAME_BASE, n);
232
   }
233
@@ -525,6 +511,11 @@
234
 if(i&AFMT_S16_LE)ui.max_output_bytes=2;
235
 ui.max_output_speed=ABOVE_MAX_SPEED;
236
 ui.min_output_speed=1;
237
+//
238
+// To allow a separate #ifdef __FreeBSD__
239
+// - Diane Bruce VA3DB, Sept 6, 2006
240
+//
241
+#ifdef __linux__
242
 if(ioctl(audio_out, SNDCTL_DSP_SPEED, &ui.max_output_speed) == -1)
243
   {
244
   lirerr(1072);
245
@@ -535,7 +526,8 @@
246
   lirerr(1073);
247
   return;
248
   }
249
-if(ui.max_output_speed==ABOVE_MAX_SPEED || 
250
+#endif
251
+if(ui.max_output_speed==ABOVE_MAX_SPEED ||
252
    ui.min_output_speed <= 1 ||
253
    ui.max_output_speed < ui.min_output_speed)
254
   {
255
@@ -592,7 +584,7 @@
256
   i>>=1;
257
   frag++;
258
   }
259
-if(frag < 4)frag=4;  
260
+if(frag < 4)frag=4;
261
 frag|=0x7fff0000;
262
 return frag;
263
 }
264
@@ -614,7 +606,7 @@
265
     free(da_wrbuf);
266
     da_wrbuf=NULL;
267
     }
268
-  }  
269
+  }
270
 audio_out=-1;
271
 }
272
 
273
@@ -623,7 +615,7 @@
274
 float t1;
275
 int i, j, frag;
276
 audio_buf_info ad_info;
277
-if( disksave_flag == 2 || 
278
+if( disksave_flag == 2 ||
279
     network_flag == 2 ||
280
     ui.ad_device_no == SDR14_DEVICE_CODE ||
281
     ( (ui.input_mode&NO_DUPLEX) != 0 && audio_out != -1) )
282
@@ -632,7 +624,7 @@
283
   }
284
 if( (audio_in) != -1)
285
   {
286
-  if( ui.ad_device_mode == O_RDWR)return;    
287
+  if( ui.ad_device_mode == O_RDWR)return;
288
   lirerr(100031);
289
   return;
290
   }
291
@@ -662,22 +654,22 @@
292
   i>>=1;
293
   frag++;
294
   }
295
-if(frag < 4)frag=4;  
296
+if(frag < 4)frag=4;
297
 if(ui.ad_device_no > 255)
298
   {
299
   frag--;
300
-  if(frag < 4)frag=4;  
301
+  if(frag < 4)frag=4;
302
   frag=frag|0x7fff0000;
303
   if(ioctl(audio_in2, SNDCTL_DSP_SETFRAGMENT, &frag) == -1)
304
     {
305
-    lirerr(1175);  
306
+    lirerr(1175);
307
     return;
308
     }
309
   }
310
 frag=frag|0x7fff0000;
311
 if(ioctl(audio_in, SNDCTL_DSP_SETFRAGMENT, &frag) == -1)
312
   {
313
-  lirerr(1008);  
314
+  lirerr(1008);
315
   return;
316
   }
317
 i=AFMT_S16_LE;
318
@@ -721,7 +713,7 @@
319
 i=j;
320
 if(ioctl(audio_in, SNDCTL_DSP_CHANNELS, &i) == -1)
321
   {
322
-  lirerr(1009);  
323
+  lirerr(1009);
324
   return;
325
   }
326
 if(i != j)
327
@@ -734,7 +726,7 @@
328
   i=j;
329
   if(ioctl(audio_in2, SNDCTL_DSP_CHANNELS, &i) == -1)
330
     {
331
-    lirerr(1178);  
332
+    lirerr(1178);
333
     return;
334
     }
335
   if(i != j)
336
@@ -791,7 +783,7 @@
337
   i=PCM_ENABLE_INPUT;
338
   if(ioctl(audio_in2,SNDCTL_DSP_SETTRIGGER,&i)==-1)
339
     {
340
-    lirerr(1184); 
341
+    lirerr(1184);
342
     return;
343
     }
344
   }
345
@@ -814,7 +806,7 @@
346
     }
347
   }
348
 ioctl(audio_in,SNDCTL_DSP_GETBLKSIZE,&i);
349
-}  
350
+}
351
 
352
 
353
 
354
@@ -854,7 +846,7 @@
355
     }
356
   }
357
 // *******************************************
358
-if(ui.ad_device_no == ui.da_device_no && 
359
+if(ui.ad_device_no == ui.da_device_no &&
360
    ui.ad_device_mode == O_RDWR &&
361
    network_flag != 2)
362
   {
363
@@ -887,7 +879,7 @@
364
       {
365
       lirerr(1191);
366
       }
367
-    else  
368
+    else
369
       {
370
       lirerr(1017);
371
       }
372
@@ -907,7 +899,7 @@
373
   i=da_output_channels;
374
   if(ioctl(audio_out, SNDCTL_DSP_CHANNELS, &i) == -1)
375
     {
376
-    lirerr(1019);  
377
+    lirerr(1019);
378
     return;
379
     }
380
   if(i != da_output_channels)
381
@@ -923,7 +915,7 @@
382
     {
383
     i=AFMT_S16_LE;
384
     }
385
-  j=i;    
386
+  j=i;
387
   if(ioctl(audio_out, SNDCTL_DSP_SETFMT, &i) == -1)
388
     {
389
     lirerr(1020);
390
@@ -957,7 +949,7 @@
391
   lirerr(1025);
392
   return;
393
   }
394
-for(i=0; i<daout_block; i++)da_wrbuf[i]=0;  
395
+for(i=0; i<daout_block; i++)da_wrbuf[i]=0;
396
 ioctl(audio_out, SNDCTL_DSP_GETBLKSIZE,&i);
397
 if(ioctl(audio_out,SNDCTL_DSP_GETOSPACE, &da_info) == -1)err_restart_da(1149);
398
 da_totbytes=da_info.fragstotal*da_info.fragsize;
399
@@ -1010,7 +1002,7 @@
400
 return 0;
401
 }
402
 
403
-int find_output_devices(int line, int *dev_flag, int *dev_wr_bits, 
404
+int find_output_devices(int line, int *dev_flag, int *dev_wr_bits,
405
           int *dev_wr_channels, int *dev_max_wr_speed, int *dev_min_wr_speed)
406
 {
407
 char s[80];
408
@@ -1039,7 +1031,7 @@
409
       dev_wr_bits[device_no]=0;
410
       }
411
     else
412
-      {  
413
+      {
414
       SNDLOG"\n8-bit output supported");
415
       dev_wr_bits[device_no]=8;
416
       }
417
@@ -1047,7 +1039,7 @@
418
 // We simply assume that all cards that can do 16 bit are capable
419
 // of doing 8 bit as well.
420
     j=AFMT_S16_LE;
421
-    if(ioctl(audio_out, SNDCTL_DSP_SETFMT, &j) == -1  || j != AFMT_S16_LE) 
422
+    if(ioctl(audio_out, SNDCTL_DSP_SETFMT, &j) == -1  || j != AFMT_S16_LE)
423
       {
424
       SNDLOG"\nCould not set 16-bit output");
425
       }
426
@@ -1058,7 +1050,7 @@
427
     SNDLOG"\n16-bit output supported");
428
     sndlog_sync();
429
     if(dev_wr_bits[device_no]==0) goto errdev;
430
-    sndlog_sync();  
431
+    sndlog_sync();
432
     j=2;
433
     if(ioctl(audio_out, SNDCTL_DSP_CHANNELS, &j) == -1)
434
       {
435
@@ -1077,6 +1069,11 @@
436
     SNDLOG"\nNo of output channels= %d",j);
437
     sndlog_sync();
438
     dev_wr_channels[device_no]=j;
439
+//
440
+// To allow a separate #ifdef __FreeBSD__
441
+// - Diane Bruce VA3DB, Sept 6, 2006
442
+//
443
+#ifdef __linux__
444
     j=ABOVE_MAX_SPEED;
445
     if(ioctl(audio_out, SNDCTL_DSP_SPEED, &j) == -1 || j==ABOVE_MAX_SPEED)
446
       {
447
@@ -1087,7 +1084,7 @@
448
         SNDLOG"\nioctl(SPEED) failed");
449
         goto errdev;
450
         }
451
-      }    
452
+      }
453
     dev_max_wr_speed[device_no]=j;
454
     SNDLOG"\nMax output speed %d", dev_max_wr_speed[device_no]);
455
     j=1;
456
@@ -1099,28 +1096,50 @@
457
         SNDLOG"\nioctl(SPEED) failed");
458
        goto errdev;
459
         }
460
-      }    
461
+      }
462
     dev_min_wr_speed[device_no]=j;
463
     SNDLOG"\nMin output speed %d", dev_min_wr_speed[device_no]);
464
     sndlog_sync();
465
+#endif
466
+//
467
+// This code finds min max speed of sound card for FreeBSD
468
+// It probably works for other BSDs as well
469
+// Diane Bruce, db@db.net VA3DB
470
+// Sept 7, 2006
471
+//
472
+#ifdef __FreeBSD__
473
+      {
474
+      snd_capabilities capab;
475
+      int status;
476
+      bzero((void *)&capab, sizeof(capab));
477
+      status = ioctl(audio_out, AIOGCAP, &capab);
478
+      if (status < 0)goto errdev;
479
+      dev_min_wr_speed[device_no] = capab.rate_min;
480
+      dev_max_wr_speed[device_no]= capab.rate_max;
481
+      ui.min_output_speed = capab.rate_min;
482
+      ui.max_output_speed = capab.rate_max;
483
+      SNDLOG"\nMax output speed %d", dev_max_wr_speed[device_no]);
484
+      SNDLOG"\nMin output speed %d", dev_min_wr_speed[device_no]);
485
+      }
486
+#endif
487
     if(close(audio_out)==-1)
488
       {
489
-      goto errdev;  
490
+      goto errdev;
491
       }
492
     sprintf(s,"%02d  %s  %7d - %7d Hz   %d Chan.   %d bit WRONLY",
493
                 device_no, dev_name,
494
-                dev_min_wr_speed[device_no], 
495
-                dev_max_wr_speed[device_no], 
496
-                dev_wr_channels[device_no], 
497
+                dev_min_wr_speed[device_no],
498
+                dev_max_wr_speed[device_no],
499
+                dev_wr_channels[device_no],
500
                 dev_wr_bits[device_no]);
501
     lir_text(0,n+2,s);
502
     n++;
503
-    ui.da_device_no=device_no;  
504
+    ui.da_device_no=device_no;
505
     dev_flag[device_no]=4;
506
     }
507
-  else 
508
+  else
509
     {
510
-skipdev:;    
511
+skipdev:;
512
     dev_flag[device_no]=0;
513
     sndlog_sync();
514
     }
515
@@ -1156,7 +1175,7 @@
516
 int speed_warning;
517
 int i, j, k, n, nn, cn, m, min, max, olbytes;
518
 int wrcnt;
519
-int rdwr_channels, caps;  
520
+int rdwr_channels, caps;
521
 int trySpeed, deltaSpeed;
522
 int rdwr_max_speed;
523
 int rdwr_min_speed;
524
@@ -1228,7 +1247,7 @@
525
       lir_text(5,13,press_any_key);
526
       await_keyboard();
527
       if(kill_all_flag) goto sdr14_errexit;
528
-      clear_screen();  
529
+      clear_screen();
530
       ui.ad_device_no=-1;
531
       }
532
     else
533
@@ -1300,7 +1319,7 @@
534
       parfile_end(sdr14_file);
535
       }
536
     }
537
-  else  
538
+  else
539
     {
540
     if(lir_inkey != 'N')goto qsdr;
541
     clear_screen();
542
@@ -1311,7 +1330,7 @@
543
 if(ui.ad_device_no == -1)
544
   {
545
 // look for other hardwares
546
-  }  
547
+  }
548
 if(ui.ad_device_no != -1)
549
   {
550
   if(ui.da_device_no == -1)
551
@@ -1331,8 +1350,8 @@
552
     {
553
     goto setad_x;
554
     }
555
-  }    
556
-// If none of the supported SDR hardwares is found, use the 
557
+  }
558
+// If none of the supported SDR hardwares is found, use the
559
 // sound cards for input and output.
560
 // ----------------------------------------------------------
561
 // First step through all devices and check which ones
562
@@ -1386,7 +1405,7 @@
563
         k=0;
564
         }
565
       else
566
-        {  
567
+        {
568
         SNDLOG"\n16bit format supported");
569
         }
570
 #ifdef AFMT_S32_LE
571
@@ -1400,8 +1419,8 @@
572
       else
573
         {
574
         SNDLOG"\n32bit format NOT supported");
575
-        }          
576
-#endif   
577
+        }
578
+#endif
579
       sndlog_sync();
580
       if(k == 0)goto cls;
581
 // Find max no of channels.
582
@@ -1423,8 +1442,13 @@
583
       else
584
         {
585
         SNDLOG"\nMax no of channels = %d",m);
586
-        }  
587
+        }
588
       sndlog_sync();
589
+//
590
+// To allow a separate #ifdef __FreeBSD__
591
+// - Diane Bruce VA3DB, Sept 6, 2006
592
+//
593
+#ifdef __linux__
594
 // Find maximum speed
595
       rdwr_max_speed=ABOVE_MAX_SPEED;
596
       if(ioctl(audio_out, SNDCTL_DSP_SPEED, &rdwr_max_speed)==-1)
597
@@ -1444,6 +1468,25 @@
598
       lirerr(1040);
599
       goto setad_errexit;
600
 minok:;
601
+#endif
602
+//
603
+// This code finds min max speed of sound card for FreeBSD
604
+// It probably works for other BSDs as well
605
+// Diane Bruce, db@db.net VA3DB
606
+// Sept 7, 2006
607
+//
608
+#ifdef __FreeBSD__
609
+        {
610
+        snd_capabilities capab;
611
+        int status;
612
+        bzero((void *)&capab, sizeof(capab));
613
+        status = ioctl(audio_out, AIOGCAP, &capab);
614
+        if (status < 0)goto setad_errexit;
615
+        rdwr_min_speed = capab.rate_min;
616
+        rdwr_max_speed = capab.rate_max;
617
+        SNDLOG"\nMax output speed %d", rdwr_max_speed);
618
+        }
619
+#endif
620
       SNDLOG"\nMin sampling speed = %d Hz",rdwr_min_speed);
621
       sndlog_sync();
622
       if(mode != 1)
623
@@ -1487,30 +1530,30 @@
624
           dev_min_rd_speed[device_no]=rdwr_min_speed;
625
           dev_rd_bits[device_no]=rdwr_fmt;
626
           break;
627
-          
628
+
629
           case 1:
630
           dev_wr_channels[device_no]=rdwr_channels;
631
           dev_max_wr_speed[device_no]=rdwr_max_speed;
632
           dev_min_wr_speed[device_no]=rdwr_min_speed;
633
           dev_wr_bits[device_no]=rdwr_fmt;
634
           break;
635
-          
636
+
637
           case 2:
638
           dev_rdwr_channels[device_no]=rdwr_channels;
639
           dev_max_rdwr_speed[device_no]=rdwr_max_speed;
640
           dev_min_rdwr_speed[device_no]=rdwr_min_speed;
641
           dev_rdwr_bits[device_no]=rdwr_fmt;
642
           break;
643
-          }  
644
+          }
645
         }
646
       SNDLOG"\n");
647
-      }          
648
-    }      
649
+      }
650
+    }
651
   if(dev_flag[device_no] != 0)
652
     {
653
   SNDLOG"\nFLAG= %d",dev_flag[device_no]);
654
 // One device may be different hardwares for input and output.
655
-// Put them on different lines if characteristics differ.    
656
+// Put them on different lines if characteristics differ.
657
     k=0;
658
     j=0;
659
 // Store equal pairs in k
660
@@ -1524,7 +1567,7 @@
661
          dev_max_rd_speed[device_no]==dev_max_wr_speed[device_no] &&
662
          dev_min_rd_speed[device_no]==dev_min_wr_speed[device_no] &&
663
          dev_rd_bits[device_no]==dev_wr_bits[device_no]) k|=1;
664
-      } 
665
+      }
666
     if( (dev_flag[device_no]&5) == 5)
667
       {
668
       j|=2;
669
@@ -1550,33 +1593,33 @@
670
         {
671
         sprintf(ss,"%02d:%12s  %7d - %7d Hz   %d Chan.   %d bit",
672
                     device_no,dev_name,
673
-                    dev_min_rd_speed[device_no], 
674
-                    dev_max_rd_speed[device_no], 
675
-                    dev_max_rd_channels[device_no], 
676
+                    dev_min_rd_speed[device_no],
677
+                    dev_max_rd_speed[device_no],
678
+                    dev_max_rd_channels[device_no],
679
                     dev_rd_bits[device_no]);
680
         }
681
       else
682
-        {  
683
+        {
684
         if( (dev_flag[device_no]&2) == 2)
685
           {
686
           sprintf(ss,"%02d:%12s  %7d - %7d Hz   %d Chan.   %d bit",
687
                      device_no,dev_name,
688
-                     dev_min_wr_speed[device_no], 
689
-                     dev_max_wr_speed[device_no], 
690
-                     dev_wr_channels[device_no], 
691
+                     dev_min_wr_speed[device_no],
692
+                     dev_max_wr_speed[device_no],
693
+                     dev_wr_channels[device_no],
694
                      dev_wr_bits[device_no]);
695
           }
696
         }
697
       for(j=0; j<3; j++)
698
         {
699
-        k=1<<j;  
700
+        k=1<<j;
701
         if( (dev_flag[device_no]&k) != 0)
702
           {
703
           column=0;
704
           while(ss[column]!=0)column++;
705
           sprintf(&ss[column],"  %s",devmode_txt[j]);
706
           }
707
-        }  
708
+        }
709
       if( (dev_flag[device_no]&5) == 0)
710
         {
711
         color=0x17;
712
@@ -1610,19 +1653,19 @@
713
           sprintf(&ss[maxcolumn],
714
                      "%02d:%12s  %7d - %7d Hz   %d Chan.   %d bit  %s",
715
                       device_no,dev_name,
716
-                      dev_min_wr_speed[device_no], 
717
-                      dev_max_wr_speed[device_no], 
718
-                      dev_wr_channels[device_no], 
719
+                      dev_min_wr_speed[device_no],
720
+                      dev_max_wr_speed[device_no],
721
+                      dev_wr_channels[device_no],
722
                       dev_wr_bits[device_no],devmode_txt[1]);
723
           sprintf(ss,"%02d:%12s  %7d - %7d Hz   %d Chan.   %d bit  %s",
724
                       device_no,dev_name,
725
-                      dev_min_rd_speed[device_no], 
726
-                      dev_max_rd_speed[device_no], 
727
-                      dev_max_rd_channels[device_no], 
728
+                      dev_min_rd_speed[device_no],
729
+                      dev_max_rd_speed[device_no],
730
+                      dev_max_rd_channels[device_no],
731
                       dev_rd_bits[device_no],devmode_txt[0]);
732
           }
733
         else
734
-          {  
735
+          {
736
 // There is rdwr, read and write.
737
           if(k == 0)
738
             {
739
@@ -1632,23 +1675,23 @@
740
             sprintf(&ss[2*maxcolumn],
741
                   "%02d:%12s  %7d - %7d Hz   %d Chan.   %d bit  %s",
742
                       device_no,dev_name,
743
-                      dev_min_wr_speed[device_no], 
744
-                      dev_max_wr_speed[device_no], 
745
-                      dev_wr_channels[device_no], 
746
+                      dev_min_wr_speed[device_no],
747
+                      dev_max_wr_speed[device_no],
748
+                      dev_wr_channels[device_no],
749
                       dev_wr_bits[device_no],devmode_txt[1]);
750
             sprintf(&ss[maxcolumn],
751
                   "%02d:%12s  %7d - %7d Hz   %d Chan.   %d bit  %s",
752
                       device_no,dev_name,
753
-                      dev_min_rd_speed[device_no], 
754
-                      dev_max_rd_speed[device_no], 
755
-                      dev_max_rd_channels[device_no], 
756
+                      dev_min_rd_speed[device_no],
757
+                      dev_max_rd_speed[device_no],
758
+                      dev_max_rd_channels[device_no],
759
                       dev_rd_bits[device_no],devmode_txt[0]);
760
             sprintf(ss,
761
                   "%02d:%12s  %7d - %7d Hz   %d Chan.   %d bit  %s",
762
                       device_no,dev_name,
763
-                      dev_min_rdwr_speed[device_no], 
764
-                      dev_max_rdwr_speed[device_no], 
765
-                      dev_rdwr_channels[device_no], 
766
+                      dev_min_rdwr_speed[device_no],
767
+                      dev_max_rdwr_speed[device_no],
768
+                      dev_rdwr_channels[device_no],
769
                       dev_rdwr_bits[device_no],devmode_txt[2]);
770
             }
771
           else
772
@@ -1661,16 +1704,16 @@
773
               sprintf(&ss[maxcolumn],
774
                         "%02d:%12s  %7d - %7d Hz   %d Chan.   %d bit  %s",
775
                         device_no,dev_name,
776
-                        dev_min_wr_speed[device_no], 
777
-                        dev_max_wr_speed[device_no], 
778
-                        dev_wr_channels[device_no], 
779
+                        dev_min_wr_speed[device_no],
780
+                        dev_max_wr_speed[device_no],
781
+                        dev_wr_channels[device_no],
782
                         dev_wr_bits[device_no],devmode_txt[1]);
783
               sprintf(ss,
784
                   "%02d:%12s  %7d - %7d Hz   %d Chan.   %d bit  %s  %s",
785
                         device_no,dev_name,
786
-                        dev_min_rd_speed[device_no], 
787
-                        dev_max_rd_speed[device_no], 
788
-                        dev_max_rd_channels[device_no], 
789
+                        dev_min_rd_speed[device_no],
790
+                        dev_max_rd_speed[device_no],
791
+                        dev_max_rd_channels[device_no],
792
                         dev_rd_bits[device_no],
793
                         devmode_txt[0],devmode_txt[2]);
794
               }
795
@@ -1680,24 +1723,24 @@
796
               sprintf(&ss[maxcolumn],
797
                         "%02d:%12s  %7d - %7d Hz   %d Chan.   %d bit  %s  %s",
798
                         device_no,dev_name,
799
-                        dev_min_wr_speed[device_no], 
800
-                        dev_max_wr_speed[device_no], 
801
+                        dev_min_wr_speed[device_no],
802
+                        dev_max_wr_speed[device_no],
803
                         dev_wr_channels[device_no], dev_wr_bits[device_no],
804
                         devmode_txt[1],devmode_txt[2]);
805
               sprintf(ss,
806
                   "%02d:%12s  %7d - %7d Hz   %d Chan.   %d bit  %s",
807
                         device_no,dev_name,
808
-                        dev_min_rd_speed[device_no], 
809
-                        dev_max_rd_speed[device_no], 
810
-                        dev_max_rd_channels[device_no], 
811
+                        dev_min_rd_speed[device_no],
812
+                        dev_max_rd_speed[device_no],
813
+                        dev_max_rd_channels[device_no],
814
                         dev_rd_bits[device_no],
815
                         devmode_txt[0]);
816
               }
817
-            }  
818
+            }
819
           }
820
         }
821
       }
822
-    while (m >0)   
823
+    while (m >0)
824
       {
825
       m--;
826
       line++;
827
@@ -1715,15 +1758,15 @@
828
         bottom_line=maxline;
829
         line=1;
830
         }
831
-      settextcolor(color);  
832
+      settextcolor(color);
833
       column=0;
834
       while(ss[m*maxcolumn+column]!=0)column++;
835
       while(column < maxcolumn)
836
         {
837
         ss[m*maxcolumn+column]=' ';
838
-        column++; 
839
+        column++;
840
         }
841
-      ss[(m+1)*maxcolumn-1]=0;  
842
+      ss[(m+1)*maxcolumn-1]=0;
843
       lir_text(0,line,&ss[m*maxcolumn]);
844
       lir_refresh_screen();
845
       SNDLOG"\n%s    color=%d m=%d",&ss[m*maxcolumn],color,m);
846
@@ -1732,7 +1775,7 @@
847
     SNDLOG"\n");
848
     }
849
   }
850
-settextcolor(7);  
851
+settextcolor(7);
852
 line++;
853
 clear_lines(line,line);
854
 if(bottom_line > line)line=bottom_line;
855
@@ -1750,7 +1793,7 @@
856
   lir_text(0,line+10,
857
         "Sound board drivers are usually configured during Linux install");
858
   lir_text(20,line+12,press_any_key);
859
-  await_keyboard();  
860
+  await_keyboard();
861
   if(kill_all_flag) goto setad_errexit;
862
   SNDLOG"\nNo input device found");
863
   goto setad_errexit;
864
@@ -1761,7 +1804,7 @@
865
 get_addev:;
866
   settextcolor(14);
867
   lir_text(0,line,"Select device for input by first number on line");
868
-  display_sdi(); 
869
+  display_sdi();
870
   settextcolor(7);
871
   ui.ad_device_no=lir_get_integer(48, line, 3, 0,MAX_DEVNAMES-1);
872
   if(kill_all_flag)goto setad_errexit;
873
@@ -1802,7 +1845,7 @@
874
 // channels with the Lynx Two card (model A).
875
 // Do not confuse other users by asking for a second input device
876
 // unless the selected device has 32 bits but only allows 2 channels.
877
-if( dev_rd_bits[ui.ad_device_no] == 32 && 
878
+if( dev_rd_bits[ui.ad_device_no] == 32 &&
879
     dev_max_rd_channels[ui.ad_device_no]==2 &&
880
     (dev_flag[ui.ad_device_no]&1) != 0)
881
   {
882
@@ -1811,7 +1854,7 @@
883
   line=1;
884
   for(i=0; i<MAX_DEVNAMES; i++)
885
     {
886
-    if(i != ui.ad_device_no && 
887
+    if(i != ui.ad_device_no &&
888
        dev_max_rd_speed[i] == dev_max_rd_speed[ui.ad_device_no] &&
889
        dev_rd_bits[i] == 32 &&
890
        (dev_flag[i]&1) != 0)
891
@@ -1829,12 +1872,12 @@
892
         if(kill_all_flag) goto setad_errexit;
893
         if(lir_inkey == 'N')
894
           {
895
-          SNDLOG"\nUser skipped dual devices"); 
896
+          SNDLOG"\nUser skipped dual devices");
897
           goto skip_dual_devices;
898
           }
899
-        if(lir_inkey != 'Y')goto gt_dual;  
900
+        if(lir_inkey != 'Y')goto gt_dual;
901
         clear_screen();
902
-        SNDLOG"\nUser wants to try to open two read devices"); 
903
+        SNDLOG"\nUser wants to try to open two read devices");
904
         make_devname(ui.ad_device_no);
905
         audio_in=open( dev_name, O_RDONLY, 0);
906
         if(audio_in == -1)
907
@@ -1854,11 +1897,11 @@
908
           }
909
         if( (caps&DSP_CAP_TRIGGER) == 0)
910
           {
911
-          SNDLOG"\nDevice does not have DSP_CAP_TRIGGER"); 
912
+          SNDLOG"\nDevice does not have DSP_CAP_TRIGGER");
913
           close(audio_in);
914
           goto skip_dual_devices;
915
           }
916
-        j=2;  
917
+        j=2;
918
         if(ioctl(audio_in, SNDCTL_DSP_CHANNELS, &j) == -1)
919
           {
920
           lirerr(1185);
921
@@ -1882,9 +1925,9 @@
922
         SNDLOG"\n%s opened as second read device",dev_name);
923
         sprintf(s,"%2d:%12s  %7d - %7d Hz   %d Chan.   %d bit",
924
                 i,dev_name,
925
-                dev_min_rd_speed[i], 
926
-                dev_max_rd_speed[i], 
927
-                dev_max_rd_channels[i], 
928
+                dev_min_rd_speed[i],
929
+                dev_max_rd_speed[i],
930
+                dev_max_rd_channels[i],
931
                 dev_rd_bits[i]);
932
         lir_text(0,line,s);
933
         close(audio_in2);
934
@@ -1916,7 +1959,7 @@
935
   for(i=0; i<MAX_DEVNAMES; i++)
936
     {
937
     dev_flag[i]&=255;
938
-    }    
939
+    }
940
   audio_in2=open( dev_name, O_RDONLY|O_NONBLOCK, 0);
941
   if(audio_in2 == -1)
942
     {
943
@@ -1935,7 +1978,7 @@
944
     }
945
   if( (caps&DSP_CAP_TRIGGER) == 0)
946
     {
947
-    SNDLOG"\nSecond input device does not have DSP_CAP_TRIGGER"); 
948
+    SNDLOG"\nSecond input device does not have DSP_CAP_TRIGGER");
949
     close(audio_in);
950
     close(audio_in2);
951
     goto skip_dual_devices;
952
@@ -1959,8 +2002,8 @@
953
   {
954
   if( (1 & dev_flag[ui.ad_device_no]) != 0)
955
     {
956
-gt_rdo:;    
957
-    sprintf(s,"Open %s as RDONLY or RDWR? (O/W)  =>",dev_name);  
958
+gt_rdo:;
959
+    sprintf(s,"Open %s as RDONLY or RDWR? (O/W)  =>",dev_name);
960
     lir_text(10,10,s);
961
     await_processed_keyboard();
962
     if(kill_all_flag) goto setad_errexit;
963
@@ -1970,7 +2013,7 @@
964
     }
965
   else
966
     {
967
-rdwr:;    
968
+rdwr:;
969
     ui.ad_device_mode=O_RDWR;
970
     mode=2;
971
     SNDLOG"\nUser selected RDWR");
972
@@ -1981,7 +2024,7 @@
973
   SNDLOG"\nOnly RDONLY available");
974
   }
975
 sndlog_sync();
976
-clear_screen();  
977
+clear_screen();
978
 sprintf(s,"For analog input: %s opened in %s mode",dev_name,devmode_txt[mode]);
979
 lir_text(0,0,s);
980
 audio_in=open( dev_name, ui.ad_device_mode, 0);
981
@@ -2031,7 +2074,7 @@
982
   ui.rx_channels=1;
983
   ui.ad_channels=2;
984
   break;
985
-    
986
+
987
   case '3':
988
   ui.input_mode=TWO_CHANNELS;
989
   ui.rx_channels=2;
990
@@ -2288,7 +2331,7 @@
991
 sprintf(s,"Now trying to open a second device while %s is open",dev_name);
992
 lir_text(0,6,s);
993
 lir_text(0,7,"This may cause your system to hang. Try ctrlC to exit (or reboot)");
994
-lir_text(0,8,"Try another input device or install another sound system."); 
995
+lir_text(0,8,"Try another input device or install another sound system.");
996
 // Find devices that we may use for output.
997
 n=0;
998
 cn=0;
999
@@ -2314,16 +2357,16 @@
1000
         dev_flag[i]=0;
1001
         }
1002
       else
1003
-        {  
1004
+        {
1005
         sprintf(&s[column],"  %d Hz   %d Chan.   16 bit RDWR",
1006
                                           ui.input_speed, ui.ad_channels);
1007
         n++;
1008
-        ui.da_device_no=i;  
1009
+        ui.da_device_no=i;
1010
         }
1011
       }
1012
     }
1013
   else
1014
-    { 
1015
+    {
1016
 // Remove duplex flags on all devices except the one we use for input
1017
     dev_flag[i]&=0xffff-4;
1018
     if( (dev_flag[i]&2) != 0 )
1019
@@ -2331,7 +2374,7 @@
1020
       audio_out=open( dev_name, O_WRONLY|O_NONBLOCK, 0);
1021
       if(read_test_ad(testbuff)!=0)goto clr_wrdev;
1022
       if(audio_out != -1)
1023
-        { 
1024
+        {
1025
 #ifdef SNDCTL_DSP_COOKEDMODE
1026
         j=0;
1027
         ioctl(audio_out, SNDCTL_DSP_COOKEDMODE, &j);
1028
@@ -2351,13 +2394,13 @@
1029
           dev_wr_bits[i]=0;
1030
           }
1031
         else
1032
-          {  
1033
+          {
1034
           SNDLOG"\n8-bit output supported");
1035
           dev_wr_bits[i]=8;
1036
           }
1037
        sndlog_sync();
1038
        j=AFMT_S16_LE;
1039
-        if(ioctl(audio_out, SNDCTL_DSP_SETFMT, &j) == -1  || j != AFMT_S16_LE) 
1040
+        if(ioctl(audio_out, SNDCTL_DSP_SETFMT, &j) == -1  || j != AFMT_S16_LE)
1041
           {
1042
           SNDLOG"\nCould not set 16-bit output");
1043
           }
1044
@@ -2368,7 +2411,7 @@
1045
         SNDLOG"\n16-bit output supported");
1046
         sndlog_sync();
1047
         if(dev_wr_bits[i]==0) goto skip_wr_dev;
1048
-        sndlog_sync();  
1049
+        sndlog_sync();
1050
         j=2;
1051
         if(ioctl(audio_out, SNDCTL_DSP_CHANNELS, &j) == -1)
1052
           {
1053
@@ -2397,7 +2440,7 @@
1054
             SNDLOG"\nioctl(SPEED) failed");
1055
             goto skip_wr_dev;
1056
             }
1057
-          }    
1058
+          }
1059
         dev_max_wr_speed[i]=j;
1060
         SNDLOG"\nMax output speed %d", dev_max_wr_speed[i]);
1061
         j=1;
1062
@@ -2409,7 +2452,7 @@
1063
             SNDLOG"\nioctl(SPEED) failed");
1064
             goto skip_wr_dev;
1065
             }
1066
-          }    
1067
+          }
1068
         dev_min_wr_speed[i]=j;
1069
         SNDLOG"\nMin output speed %d", dev_min_wr_speed[i]);
1070
         sndlog_sync();
1071
@@ -2426,7 +2469,7 @@
1072
           SNDLOG"\nWrite failed");
1073
           goto skip_wr_dev;
1074
           }
1075
-        sound_start_time=current_time();  
1076
+        sound_start_time=current_time();
1077
         wrcnt=0;
1078
         j=ad_info.bytes;
1079
         while(wrcnt+ad_info.bytes < 3*1024+j )
1080
@@ -2438,7 +2481,7 @@
1081
             SNDLOG"\nSNDCTL_DSP_GETOSPACE failed");
1082
             goto skip_wr_dev;
1083
             }
1084
-          if( current_time() - sound_start_time > 0.7)  
1085
+          if( current_time() - sound_start_time > 0.7)
1086
             {
1087
             SNDLOG"\nTimeout");
1088
             goto skip_wr_dev;
1089
@@ -2456,7 +2499,7 @@
1090
           lirerr(1095);
1091
           goto setad_errexit;
1092
           }
1093
-        olbytes=ad_info.bytes;       
1094
+        olbytes=ad_info.bytes;
1095
         gettimeofday(&tim2,NULL);
1096
         while(ad_info.bytes-olbytes < 512)
1097
           {
1098
@@ -2475,31 +2518,31 @@
1099
           }
1100
         if(close(audio_out)==-1)
1101
           {
1102
-          goto skip_wr_dev;  
1103
+          goto skip_wr_dev;
1104
           }
1105
         sprintf(&s[column]," %7d - %7d Hz   %d Chan.   %d bit WRONLY",
1106
-                dev_min_wr_speed[i], 
1107
-                dev_max_wr_speed[i], 
1108
-                dev_wr_channels[i], 
1109
+                dev_min_wr_speed[i],
1110
+                dev_max_wr_speed[i],
1111
+                dev_wr_channels[i],
1112
                 dev_wr_bits[i]);
1113
         cn=1;
1114
         n++;
1115
-        ui.da_device_no=i;  
1116
+        ui.da_device_no=i;
1117
         }
1118
-      else 
1119
+      else
1120
         {
1121
-        goto clr_wrdev;  
1122
+        goto clr_wrdev;
1123
 skip_wr_dev:;
1124
         sndlog_sync();
1125
         if(close(audio_out)==-1)
1126
           {
1127
-          lirerr(1067);  
1128
+          lirerr(1067);
1129
           goto setad_errexit;
1130
           }
1131
 clr_wrdev:;
1132
         dev_flag[i]&=0xffff-2;
1133
         }
1134
-      }         
1135
+      }
1136
     }
1137
   if(cn != 0)
1138
     {
1139
@@ -2542,7 +2585,7 @@
1140
     while(s[column] != 0)column++;
1141
     audio_out=open( dev_name, O_WRONLY|O_NONBLOCK, 0);
1142
     if(audio_out != -1)
1143
-      { 
1144
+      {
1145
       #ifdef SNDCTL_DSP_COOKEDMODE
1146
         j=0;
1147
         ioctl(audio_out, SNDCTL_DSP_COOKEDMODE, &j);
1148
@@ -2556,11 +2599,11 @@
1149
         dev_wr_bits[i]=0;
1150
         }
1151
       else
1152
-        {  
1153
+        {
1154
         dev_wr_bits[i]=8;
1155
         }
1156
       j=AFMT_S16_LE;
1157
-      if(ioctl(audio_out, SNDCTL_DSP_SETFMT, &j) == -1  || j != AFMT_S16_LE) 
1158
+      if(ioctl(audio_out, SNDCTL_DSP_SETFMT, &j) == -1  || j != AFMT_S16_LE)
1159
         {
1160
         SNDLOG"\nCould not set 16-bit output");
1161
         }
1162
@@ -2569,7 +2612,7 @@
1163
         dev_wr_bits[i]=16;
1164
         }
1165
       if(dev_wr_bits[i]==0) goto skip_wr_dev_nodup;
1166
-      sndlog_sync();  
1167
+      sndlog_sync();
1168
       j=2;
1169
       if(ioctl(audio_out, SNDCTL_DSP_CHANNELS, &j) == -1)
1170
         {
1171
@@ -2597,7 +2640,7 @@
1172
           SNDLOG"\nioctl(SPEED) failed");
1173
           goto skip_wr_dev_nodup;
1174
           }
1175
-        }    
1176
+        }
1177
       dev_max_wr_speed[i]=j;
1178
       SNDLOG"\nMax output speed %d", dev_max_wr_speed[i]);
1179
       sndlog_sync();
1180
@@ -2613,17 +2656,17 @@
1181
         if(ioctl(audio_out,SNDCTL_DSP_GETOSPACE, &ad_info) == -1)
1182
                                                goto skip_wr_dev_nodup;
1183
         }
1184
-      if(close(audio_out)==-1)goto skip_wr_dev_nodup;  
1185
+      if(close(audio_out)==-1)goto skip_wr_dev_nodup;
1186
       sprintf(&s[column]," %d Hz   %d Chan.   %d bit WRONLY",
1187
               dev_max_wr_speed[i], dev_wr_channels[i], dev_wr_bits[i]);
1188
       cn=1;
1189
       n++;
1190
-      ui.da_device_no=i;  
1191
+      ui.da_device_no=i;
1192
       dev_flag[i] |= 2;
1193
       }
1194
-    else 
1195
+    else
1196
       {
1197
-      goto clr_wrdev_nodup;  
1198
+      goto clr_wrdev_nodup;
1199
 skip_wr_dev_nodup:;
1200
       sndlog_sync();
1201
       if(close(audio_out)==-1)
1202
@@ -2655,10 +2698,10 @@
1203
     lirerr(1139);
1204
     goto setad_errexit;
1205
     }
1206
-  ui.input_mode|=NO_DUPLEX;  
1207
+  ui.input_mode|=NO_DUPLEX;
1208
   ad_info.bytes=0;
1209
   }
1210
-dadev_select:;  
1211
+dadev_select:;
1212
 if(n > 1)
1213
   {
1214
 get_dadev:;
1215
@@ -2666,7 +2709,7 @@
1216
   j=0;
1217
   settextcolor(14);
1218
   lir_text(0,line,"Select device for output by line number");
1219
-  display_sdi(); 
1220
+  display_sdi();
1221
   settextcolor(7);
1222
   while(i<2)
1223
     {
1224
@@ -2683,7 +2726,7 @@
1225
     }
1226
   ui.da_device_no=j;
1227
 // Mod3:    Modified error message handling in get_dadev and get_addev
1228
-  if( (6 & dev_flag[ui.da_device_no]) == 0) 
1229
+  if( (6 & dev_flag[ui.da_device_no]) == 0)
1230
     {
1231
     settextcolor(15);
1232
     lir_text(43,line,"???");
1233
@@ -2693,10 +2736,10 @@
1234
     clear_lines(line,line+1);
1235
     goto get_dadev;
1236
     }
1237
-// -------------------------------------------------------  
1238
+// -------------------------------------------------------
1239
 // The original code was:
1240
 // if( (6 & dev_flag[ui.da_device_no]) == 0) goto get_dadev;
1241
-// -------------------------------------------------------  
1242
+// -------------------------------------------------------
1243
   }
1244
 make_devname(ui.da_device_no);
1245
 SNDLOG"\nUser selected %s for output.",dev_name);
1246
@@ -2711,7 +2754,7 @@
1247
   {
1248
   ui.da_stopstart=1;
1249
   }
1250
-else  
1251
+else
1252
   {
1253
   if(lir_inkey != 'N')goto get_da_stopstart;
1254
   ui.da_stopstart=0;
1255
@@ -2720,7 +2763,7 @@
1256
 // If we selected the same device for input and output,
1257
 // check if it was opened ad RDWR or if we shall open it
1258
 // for output now
1259
-if( ui.da_device_no == ui.ad_device_no && 
1260
+if( ui.da_device_no == ui.ad_device_no &&
1261
     ui.ad_device_mode == O_RDWR &&
1262
     (ui.input_mode&NO_DUPLEX) == 0 )
1263
   {
1264
@@ -2751,20 +2794,20 @@
1265
   close_rx_sndout();
1266
   }
1267
 close_rx_sndin();
1268
-sprintf(s,"Min output channels: %d",ui.min_output_channels);  
1269
+sprintf(s,"Min output channels: %d",ui.min_output_channels);
1270
 lir_text(0,8,s);
1271
-sprintf(s,"Max output channels: %d",ui.max_output_channels);  
1272
+sprintf(s,"Max output channels: %d",ui.max_output_channels);
1273
 lir_text(0,9,s);
1274
 da_output_channels=ui.min_output_channels;
1275
 da_output_bytes=ui.max_output_bytes;
1276
-sprintf(s,"Output no of bits=%d",8*ui.max_output_bytes);  
1277
+sprintf(s,"Output no of bits=%d",8*ui.max_output_bytes);
1278
 lir_text(35,7,s);
1279
 if(ui.max_output_bytes != ui.min_output_bytes)
1280
   {
1281
-  sprintf(s,"or %d",8*ui.min_output_bytes);  
1282
+  sprintf(s,"or %d",8*ui.min_output_bytes);
1283
   lir_text(56,7,s);
1284
   }
1285
-// Reopen with the current parameters. 
1286
+// Reopen with the current parameters.
1287
 // We will not goto setad_errexit here if something goes wrong.
1288
 if(  (ui.input_mode&NO_DUPLEX) == 0 && ui.ad_device_no != SDR14_DEVICE_CODE)
1289
   {
(-)files/patch-lxsys.c (-9 / +8 lines)
Lines 1-5 Link Here
1
--- lxsys.c.orig	Tue Aug 15 15:27:44 2006
1
--- lxsys.c.orig	Tue Nov  7 13:45:32 2006
2
+++ lxsys.c	Fri Sep  8 16:35:10 2006
2
+++ lxsys.c	Fri Nov 24 18:02:31 2006
3
@@ -1,12 +1,14 @@
3
@@ -1,12 +1,14 @@
4
-
4
-
5
-#include <sys/io.h>
5
-#include <sys/io.h>
Lines 18-32 Link Here
18
 #include <fcntl.h>
18
 #include <fcntl.h>
19
 #include <termios.h>
19
 #include <termios.h>
20
 #include "thrdef.h"
20
 #include "thrdef.h"
21
@@ -16,6 +18,7 @@
21
@@ -17,6 +19,7 @@
22
 #include "lindef.h"
22
 #include "lindef.h"
23
 #include "hwaredef.h"
23
 #include "hwaredef.h"
24
 
24
 
25
+extern int saved_euid;
25
+extern int saved_euid;
26
 
26
 
27
 char *locktext[6]={"*W A R N I N G*  Read z_MLOCK.txt for info.",
27
 void lirerr(int errcod)
28
                    "*** mlockall can cause system crashes!! ***",
28
 {
29
@@ -66,11 +69,9 @@
29
@@ -60,11 +63,9 @@
30
 // Get permission to write to the parallel port
30
 // Get permission to write to the parallel port
31
 if(ui.parport < 0x400-4)
31
 if(ui.parport < 0x400-4)
32
   {
32
   {
Lines 41-47 Link Here
41
   }
41
   }
42
 if(i != 0)
42
 if(i != 0)
43
   {
43
   {
44
@@ -214,11 +215,9 @@
44
@@ -208,11 +209,9 @@
45
 int i;
45
 int i;
46
 if(ui.parport < 0x400-4)
46
 if(ui.parport < 0x400-4)
47
   {
47
   {
Lines 56-62 Link Here
56
   }
56
   }
57
 if(i!=0)lirerr(764921);
57
 if(i!=0)lirerr(764921);
58
 i=1000;
58
 i=1000;
59
@@ -231,11 +230,9 @@
59
@@ -225,11 +224,9 @@
60
 int i;
60
 int i;
61
 if(ui.parport < 0x400-4)
61
 if(ui.parport < 0x400-4)
62
   {
62
   {
Lines 71-74 Link Here
71
   }
71
   }
72
 if(i!=0)lirerr(764921);
72
 if(i!=0)lirerr(764921);
73
 return inb(port);
73
 return inb(port);
74
(-)files/patch-uidef.h (-2 / +2 lines)
Lines 1-5 Link Here
1
--- uidef.h.orig	Sat Jul 29 16:29:21 2006
1
--- uidef.h.orig	Tue Nov  7 13:45:32 2006
2
+++ uidef.h	Sat Jul 29 16:29:34 2006
2
+++ uidef.h	Fri Nov 24 18:02:31 2006
3
@@ -5,7 +5,7 @@
3
@@ -5,7 +5,7 @@
4
 
4
 
5
 
5
 
(-)files/patch-xmain.c (-4 / +4 lines)
Lines 1-6 Link Here
1
--- xmain.c.orig	Fri Jul 14 17:35:38 2006
1
--- xmain.c.orig	Tue Nov  7 13:45:33 2006
2
+++ xmain.c	Fri Jul 28 12:45:20 2006
2
+++ xmain.c	Fri Nov 24 18:02:31 2006
3
@@ -39,7 +39,7 @@
3
@@ -40,7 +40,7 @@
4
 float total;
4
 float total;
5
 }PIXINFO;
5
 }PIXINFO;
6
 
6
 
Lines 9-15 Link Here
9
  
9
  
10
 int main(int argc, char **argv)
10
 int main(int argc, char **argv)
11
 {
11
 {
12
@@ -59,6 +59,8 @@
12
@@ -60,6 +60,8 @@
13
 XTextProperty window_title_property;
13
 XTextProperty window_title_property;
14
 unsigned short int *ipalette;
14
 unsigned short int *ipalette;
15
 XColor xco;
15
 XColor xco;

Return to bug 106247