- undoing boo-boo

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@167 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Diane Bruce 2006-04-17 00:00:23 +00:00
parent 80161a3285
commit f55f7c0dc4
8 changed files with 307 additions and 244 deletions

53
configure vendored
View File

@ -2,7 +2,7 @@
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.53 for wsjt 5.9.2.
#
# $Id: configure.ac 162 2006-04-13 15:13:25Z va3db $
# $Id: configure.ac 161 2006-04-13 04:50:00Z va3db $
#
# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
@ -840,6 +840,8 @@ Optional Features:
--enable-oss Force OSS SOUND usage.
--enable-portaudio Force PORTAUDIO SOUND usage.
--enable-jack Force JACK usage.
--enable-parallel Force PARALLEL port usage for ptt.
--enable-serial Force SERIAL port usage for ptt.
--enable-g95 Use G95 compiler if available.
--enable-gfortran Use gfortran compiler if available.
@ -927,7 +929,7 @@ Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
$Id: configure.ac 162 2006-04-13 15:13:25Z va3db $
$Id: configure.ac 161 2006-04-13 04:50:00Z va3db $
_ACEOF
exit 0
fi
@ -2074,7 +2076,7 @@ fi
# Provide some information about the compiler.
echo "$as_me:2077:" \
echo "$as_me:2079:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@ -5975,6 +5977,23 @@ else
fi;
# Check whether --enable-parallel or --disable-parallel was given.
if test "${enable_parallel+set}" = set; then
enableval="$enable_parallel"
parallel=$enableval
else
parallel=no
fi;
# Check whether --enable-serial or --disable-serial was given.
if test "${enable_serial+set}" = set; then
enableval="$enable_serial"
serial=$enableval
else
serial=no
fi;
# Check whether --enable-g95 or --disable-g95 was given.
if test "${enable_g95+set}" = set; then
enableval="$enable_g95"
@ -6037,6 +6056,26 @@ FC="${FC}"
if test "$serial" != yes -a "$parallel" != yes; then
serial=yes;
fi
if test "$serial" = yes; then
cat >>confdefs.h <<\_ACEOF
#define USE_SERIAL 1
_ACEOF
fi
if test "$parallel" = yes; then
cat >>confdefs.h <<\_ACEOF
#define USE_PARALLEL 1
_ACEOF
fi
if test "$alsa" != yes -a "$oss" != yes -a "$portaudio" != yes; then
if test $HAS_PORTAUDIO_H -eq 1; then
portaudio=yes;
@ -7040,6 +7079,14 @@ if test $jack == "yes"; then
echo "Using jack.";
fi
if test $serial == "yes"; then
echo "Using serial port for ptt.";
fi
if test $parallel == "yes"; then
echo "Using parallel port for ptt.";
fi
echo
echo "Compiling $PACKAGE_NAME $PACKAGE_VERSION"
echo

View File

@ -234,6 +234,17 @@ AC_ARG_ENABLE(jack,
AC_HELP_STRING([--enable-jack],[Force JACK usage.]),
[jack=$enableval] , [jack=no])
dnl serial or parallel support (temporary until python changes)
dnl ===========================================================
AC_ARG_ENABLE(parallel,
AC_HELP_STRING([--enable-parallel],[Force PARALLEL port usage for ptt.]),
[parallel=$enableval], [parallel=no])
AC_ARG_ENABLE(serial,
AC_HELP_STRING([--enable-serial],[Force SERIAL port usage for ptt.]),
[serial=$enableval], [serial=no])
dnl pick gfortran or g95
dnl ====================
@ -283,6 +294,18 @@ AC_SUBST(FC, "${FC}")
dnl set defaults
dnl ============
if test "$serial" != yes -a "$parallel" != yes; then
[serial=yes];
fi
if test "$serial" = yes; then
AC_DEFINE(USE_SERIAL, 1, [Define if you want Serial port used.])
fi
if test "$parallel" = yes; then
AC_DEFINE(USE_PARALLEL, 1, [Define if you want Serial port used.])
fi
if test "$alsa" != yes -a "$oss" != yes -a "$portaudio" != yes; then
if test $HAS_PORTAUDIO_H -eq 1; then
[portaudio=yes];
@ -408,6 +431,14 @@ if test $jack == "yes"; then
echo "Using jack.";
fi
if test $serial == "yes"; then
echo "Using serial port for ptt.";
fi
if test $parallel == "yes"; then
echo "Using parallel port for ptt.";
fi
echo
echo "Compiling $PACKAGE_NAME $PACKAGE_VERSION"
echo

View File

@ -104,11 +104,11 @@ subroutine fivehz
! Switch PTT line and TxOK appropriately
if(lauto.eq.1) then
if(txtime .and. iptt.eq.0 .and. &
mute.eq.0) i1=ptt(nport,pttport,1,iptt) !Raise PTT
mute.eq.0) i1=ptt(nport,1,iptt) !Raise PTT
if(.not.txtime .or. mute.eq.1) TxOK=0 !Lower TxOK
else
if(mantx.eq.1 .and. iptt.eq.0 .and. &
mute.eq.0) i2=ptt(nport,pttport,1,iptt) !Raise PTT
mute.eq.0) i2=ptt(nport,1,iptt) !Raise PTT
if(mantx.eq.0 .or. mute.eq.1) TxOK=0 !Lower TxOK
endif
@ -130,7 +130,7 @@ subroutine fivehz
if(nc0a.lt.5) nc0a=5
if(TxOK.eq.0 .and. TxOKz.eq.1 .and. iptt.eq.1) nc0=-nc0a-1
if(nc0.le.0) nc0=nc0+1
if(nc0.eq.0) i3=ptt(nport,pttport,0,iptt)
if(nc0.eq.0) i3=ptt(nport,0,iptt)
if(iptt.eq.0 .and.TxOK.eq.0) then
sending=" "

View File

@ -1,104 +1,103 @@
! Fortran logical units used in WSJT6
!
! 10 wave files read from disk
! 11 decoded.txt
! 12 decoded.ave
! 13 tsky.dat
! 14 azel.dat
! 15 debug.txt
! 16 c:/wsjt.reg
! 17 wave files written to disk
! 18 test file to be transmitted (wsjtgen.f90)
! 19
! 20
! 21 ALL.TXT
! 22 kvasd.dat
! 23 CALL3.TXT
!------------------------------------------------ ftn_init
subroutine ftn_init
character*1 cjunk
include 'gcom1.f90'
include 'gcom2.f90'
include 'gcom3.f90'
include 'gcom4.f90'
! print*,'ftn_init.F90 nport=', nport, 'pttport=', pttport
i=ptt(nport,pttport,0,iptt) !Clear the PTT line
addpfx=' '
do i=80,1,-1
if(AppDir(i:i).ne.' ') goto 1
enddo
1 iz=i
lenappdir=iz
call pfxdump(appdir(:iz)//'/prefixes.txt')
#ifdef Win32
open(11,file=appdir(:iz)//'/decoded.txt',status='unknown', &
share='denynone',err=910)
#else
open(11,file=appdir(:iz)//'/decoded.txt',status='unknown', &
err=910)
#endif
endfile 11
#ifdef Win32
open(12,file=appdir(:iz)//'/decoded.ave',status='unknown', &
share='denynone',err=920)
#else
open(12,file=appdir(:iz)//'/decoded.ave',status='unknown', &
err=920)
#endif
endfile 12
#ifdef Win32
open(14,file=appdir(:iz)//'/azel.dat',status='unknown', &
share='denynone',err=930)
#else
open(14,file=appdir(:iz)//'/azel.dat',status='unknown', &
err=930)
#endif
#ifdef Win32
open(15,file=appdir(:iz)//'/debug.txt',status='unknown', &
share='denynone',err=940)
#else
open(15,file=appdir(:iz)//'/debug.txt',status='unknown', &
err=940)
#endif
#ifdef Win32
open(21,file=appdir(:iz)//'/ALL.TXT',status='unknown', &
access='append',share='denynone',err=950)
#else
open(21,file=appdir(:iz)//'/ALL.TXT',status='unknown',err=950)
do i=1,9999999
read(21,*,end=10) cjunk
enddo
10 continue
#endif
#ifdef Win32
open(22,file=appdir(:iz)//'/kvasd.dat',access='direct',recl=1024, &
status='unknown',share='denynone')
#else
open(22,file=appdir(:iz)//'/kvasd.dat',access='direct',recl=1024, &
status='unknown')
#endif
return
910 print*,'Error opening DECODED.TXT'
stop
920 print*,'Error opening DECODED.AVE'
stop
930 print*,'Error opening AZEL.DAT'
stop
940 print*,'Error opening DEBUG.TXT'
stop
950 print*,'Error opening ALL.TXT'
stop
end subroutine ftn_init
! Fortran logical units used in WSJT6
!
! 10 wave files read from disk
! 11 decoded.txt
! 12 decoded.ave
! 13 tsky.dat
! 14 azel.dat
! 15 debug.txt
! 16 c:/wsjt.reg
! 17 wave files written to disk
! 18 test file to be transmitted (wsjtgen.f90)
! 19
! 20
! 21 ALL.TXT
! 22 kvasd.dat
! 23 CALL3.TXT
!------------------------------------------------ ftn_init
subroutine ftn_init
character*1 cjunk
include 'gcom1.f90'
include 'gcom2.f90'
include 'gcom3.f90'
include 'gcom4.f90'
i=ptt(nport,0,iptt) !Clear the PTT line
addpfx=' '
do i=80,1,-1
if(AppDir(i:i).ne.' ') goto 1
enddo
1 iz=i
lenappdir=iz
call pfxdump(appdir(:iz)//'/prefixes.txt')
#ifdef Win32
open(11,file=appdir(:iz)//'/decoded.txt',status='unknown', &
share='denynone',err=910)
#else
open(11,file=appdir(:iz)//'/decoded.txt',status='unknown', &
err=910)
#endif
endfile 11
#ifdef Win32
open(12,file=appdir(:iz)//'/decoded.ave',status='unknown', &
share='denynone',err=920)
#else
open(12,file=appdir(:iz)//'/decoded.ave',status='unknown', &
err=920)
#endif
endfile 12
#ifdef Win32
open(14,file=appdir(:iz)//'/azel.dat',status='unknown', &
share='denynone',err=930)
#else
open(14,file=appdir(:iz)//'/azel.dat',status='unknown', &
err=930)
#endif
#ifdef Win32
open(15,file=appdir(:iz)//'/debug.txt',status='unknown', &
share='denynone',err=940)
#else
open(15,file=appdir(:iz)//'/debug.txt',status='unknown', &
err=940)
#endif
#ifdef Win32
open(21,file=appdir(:iz)//'/ALL.TXT',status='unknown', &
access='append',share='denynone',err=950)
#else
open(21,file=appdir(:iz)//'/ALL.TXT',status='unknown',err=950)
do i=1,9999999
read(21,*,end=10) cjunk
enddo
10 continue
#endif
#ifdef Win32
open(22,file=appdir(:iz)//'/kvasd.dat',access='direct',recl=1024, &
status='unknown',share='denynone')
#else
open(22,file=appdir(:iz)//'/kvasd.dat',access='direct',recl=1024, &
status='unknown')
#endif
return
910 print*,'Error opening DECODED.TXT'
stop
920 print*,'Error opening DECODED.AVE'
stop
930 print*,'Error opening AZEL.DAT'
stop
940 print*,'Error opening DEBUG.TXT'
stop
950 print*,'Error opening ALL.TXT'
stop
end subroutine ftn_init

View File

@ -110,7 +110,7 @@ mygrid=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Grid Locator:',
idinterval=Pmw.EntryField(g1.interior(),labelpos=W,label_text='ID Interval (m):',
value=10,entry_textvariable=IDinterval,entry_width=12)
comport=Pmw.EntryField(g1.interior(),labelpos=W,label_text='PTT Port:',
value='/dev/cuad0',entry_textvariable=PttPort,entry_width=12)
value='1',entry_textvariable=PttPort,entry_width=12)
audioin=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Audio In:',
value='0',entry_textvariable=DevinName,entry_width=12)
audioout=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Audio Out:',

2
ptt.c
View File

@ -1,7 +1,7 @@
#include <windows.h>
#include <stdio.h>
int ptt_(int *nport, char *unused, int *ntx, int *iptt)
int ptt_(int *nport, int *ntx, int *iptt)
{
static HANDLE hFile;
static int open=0;

View File

@ -43,18 +43,6 @@
# include <fcntl.h>
#endif
#ifdef HAVE_LINUX_PPDEV_H
# include <linux/ppdev.h>
# include <linux/parport.h>
#endif
#ifdef HAVE_DEV_PPBUS_PPI_H
# include <dev/ppbus/ppi.h>
# include <dev/ppbus/ppbconf.h>
int lp_reset (int fd);
int lp_ptt (int fd, int onoff);
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
@ -62,107 +50,87 @@ int lp_ptt (int fd, int onoff);
# include <sys/param.h>
#endif
#ifndef BSD /* #ifdef LINUX ? */
int fd; /* Used for both serial and parallel */
#ifdef USE_SERIAL
/* First cut, note that this only distinguishes Linux from BSDs,
* it will be done better later on using configure. N.B. that OSX
* will come up as BSD but I think this is also the right serial port
* for OSX. -db
*/
#if defined(BSD)
#define TTYNAME "/dev/cuad%d" /* Use non blocking form */
#else
#include <sys/io.h>
#define TTYNAME "/dev/ttyUSB%d"
#endif
#include <string.h>
/* parport functions */
int dev_is_parport(const char *fname);
int ptt_parallel(int fd, int *ntx, int *iptt);
int ptt_serial(int fd, int *ntx, int *iptt);
int fd=-1; /* Used for both serial and parallel */
char nm[MAXPATHLEN];
/*
* ptt_
*
* generic unix PTT routine called from Fortran
*
* unused - Unused, to satisfy old windows calling convention
* ptt_port - device name serial or parallel
* ntx - pointer to fortran command on or off
* iptt - pointer to fortran command status on or off
*/
/* Tiny state machine */
#define STATE_PORT_CLOSED 0
#define STATE_PORT_OPEN_PARALLEL 1
#define STATE_PORT_OPEN_SERIAL 2
/* Not quite right for size but '%d + 1' should be plenty enough -db */
/* As TTYNAME is a string, just at 20 chars do udevd is happier. */
/* E.g. USB serial ports appear as /dev/ttyUSB0 */
#define TTYNAME_SIZE sizeof(TTYNAME)+20
int
ptt_(int unused, char *ptt_port, int *ntx, int *iptt)
{
static int state=0;
char *p;
switch (state) {
case STATE_PORT_CLOSED:
if ((p = strchr(ptt_port, ' ')) != NULL)
*p = '\0';
if (p == NULL || *p == '\0') {
*iptt = *ntx;
return(0);
}
if ((fd = dev_is_parport(ptt_port)) > 0) {
state = STATE_PORT_OPEN_PARALLEL;
lp_reset(fd);
} else {
if ((fd = open(nm, O_RDWR | O_NDELAY)) < 0) {
fprintf(stderr, "Can't open %s.\n", nm);
return(1);
}
else
state = STATE_PORT_OPEN_SERIAL;
}
break;
case STATE_PORT_OPEN_PARALLEL:
ptt_parallel(fd, ntx, iptt);
break;
case STATE_PORT_OPEN_SERIAL:
ptt_serial(fd, ntx, iptt);
break;
default:
close(fd);
fd = -1;
state = STATE_PORT_CLOSED;
break;
}
return(0);
}
/*
* ptt_serial
*
* generic serial unix PTT routine called indirectly from Fortran
*
* fd - already opened file descriptor
* ntx - pointer to fortran command on or off
* iptt - pointer to fortran command status on or off
*/
int
ptt_serial(int fd, int *ntx, int *iptt)
ptt_(int *nport, int *ntx, int *iptt)
{
/* Fixme, nport should be a sting and not a number */
static int nopen=0;
int control = TIOCM_RTS | TIOCM_DTR;
if(*ntx) {
ioctl(fd, TIOCMBIS, &control); /* Set DTR and RTS */
*iptt = 1;
} else {
char s[TTYNAME_SIZE];
if(*nport < 0) {
*iptt=*ntx;
return(0);
}
if(*ntx && (!nopen)) {
snprintf(s, TTYNAME_SIZE, TTYNAME, (*nport) - 1); /* Comport 1 == dev 0 */
s[TTYNAME_SIZE] = '\0';
/* open the device */
printf("Opening %s\n", s);
if ((fd = open(s, O_RDWR | O_NDELAY)) < 0) {
fprintf(stderr, "Can't open %s.\n", s);
return(1);
}
nopen=1;
return(0);
}
if(*ntx && nopen) {
ioctl(fd, TIOCMBIS, &control); // Set DTR and RTS
*iptt=1;
}
else {
ioctl(fd, TIOCMBIC, &control);
*iptt = 0;
close(fd);
*iptt=0;
nopen=0;
}
return(0);
}
#endif
#ifdef USE_PARALLEL
#ifdef HAVE_LINUX_PPDEV_H
# include <linux/ppdev.h>
# include <linux/parport.h>
#endif
#ifdef HAVE_DEV_PPBUS_PPI_H
# include <dev/ppbus/ppi.h>
# include <dev/ppbus/ppbconf.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#if (defined(__unix__) || defined(unix)) && !defined(USG)
# include <sys/param.h>
#endif
/* parport functions */
@ -181,11 +149,13 @@ int lp_ptt (int fd, int onoff);
int
dev_is_parport(const char *fname)
{
char nm[MAXPATHLEN];
struct stat st;
int fd;
snprintf(nm, sizeof(nm), "/dev/%s", fname);
int fd, m;
m = snprintf(nm, sizeof(nm), "/dev/%s", fname);
if (m >= sizeof(nm))
return (-1);
if ((fd = open(nm, O_RDWR | O_NONBLOCK)) == -1)
return (-1);
if (fstat(fd, &st) == -1)
@ -205,16 +175,14 @@ out:
int
dev_is_parport(const char *fname)
{
char nm[MAXPATHLEN];
struct stat st;
unsigned char c;
int fd;
char *p;
if ((p = strchr(fname, '/')) != NULL) /* Look for /dev */
snprintf(nm, sizeof(nm), "%s", fname);
else
snprintf(nm, sizeof(nm), "/dev/%s", fname);
int fd, m;
m = snprintf(nm, sizeof(nm), "/dev/%s", fname);
if (m >= sizeof(nm))
return (-1);
if ((fd = open(nm, O_RDWR | O_NONBLOCK)) == -1)
return (-1);
if (fstat(fd, &st) == -1)
@ -307,6 +275,7 @@ lp_init (int fd)
{
fprintf(stderr, "Claiming parallel port %s", dev->desc);
debug ("HINT: did you unload the lp kernel module?");
debug ("HINT: perhaps there is another cwdaemon running?");
close (fd);
exit (1);
}
@ -372,26 +341,47 @@ lp_ptt (int fd, int onoff)
return 0;
}
/*
* ptt_parallel
*
* generic parallel unix PTT routine called indirectly from Fortran
*
* fd - already opened file descriptor
* ntx - pointer to fortran command on or off
* iptt - pointer to fortran command status on or off
/* XXX I am totally unsure of this, LPNAME should come from
* the WSJT.INI instead but for now this should work -- db
*/
#ifdef BSD
#define LPNAME "lpt%d"
#else
#define LPNAME "lp%d"
#endif
#define LPNAME_SIZE (sizeof(LPNAME))
int
ptt_parallel(int fd, int *ntx, int *iptt)
ptt_(int *nport, int *ntx, int *iptt)
{
if(*ntx) {
lp_ptt(fd, 1);
*iptt=1;
} else {
lp_ptt(fd, 0);
*iptt=0;
static int nopen=0;
int fd;
char s[LPNAME_SIZE];
if(*nport < 0) {
*iptt=*ntx;
return(0);
}
if(*ntx && (!nopen)) {
snprintf(s, LPNAME_SIZE, LPNAME, (*nport) - 1); /* Comport 1 == dev 0 */
s[LPNAME_SIZE] = '\0';
if ((fd = dev_is_parport(s)) < 0) {
fprintf(stderr, "Can't use %s.", s);
return(1);
}
if(*ntx && nopen) {
lp_ptt(fd, 1);
*iptt=1;
} else {
lp_ptt(fd, 0);
close(fd);
*iptt=0;
nopen=0;
}
}
return(0);
}
#endif

View File

@ -1517,10 +1517,6 @@ def update():
Audio.gcom2.nport=options.ComPort.get()
except:
Audio.gcom2.nport=0
# print 'About to init Audio.gcom2.PttPort in save some parameters'
Audio.gcom2.pttport=(options.PttPort.get() + ' ')[:12]
# print Audio.gcom2.pttport
# Queue up the next update
ldate.after(100,update)
@ -2026,8 +2022,8 @@ try:
options.ComPort.set(0)
Audio.gcom2.nport=0
Audio.gcom2.pttport=(options.PttPort.get()+' ')[:12]
Audio.gcom2.PttPort=options.ComPort.get()
elif key == 'Mileskm': options.mileskm.set(value)
elif key == 'MsgStyle': options.ireport.set(value)
elif key == 'Region': options.iregion.set(value)