mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 20:28:42 -05:00
- 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:
parent
80161a3285
commit
f55f7c0dc4
53
configure
vendored
53
configure
vendored
@ -2,7 +2,7 @@
|
|||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.53 for wsjt 5.9.2.
|
# 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
|
# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
|
||||||
# Free Software Foundation, Inc.
|
# Free Software Foundation, Inc.
|
||||||
@ -840,6 +840,8 @@ Optional Features:
|
|||||||
--enable-oss Force OSS SOUND usage.
|
--enable-oss Force OSS SOUND usage.
|
||||||
--enable-portaudio Force PORTAUDIO SOUND usage.
|
--enable-portaudio Force PORTAUDIO SOUND usage.
|
||||||
--enable-jack Force JACK 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-g95 Use G95 compiler if available.
|
||||||
--enable-gfortran Use gfortran 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
|
This configure script is free software; the Free Software Foundation
|
||||||
gives unlimited permission to copy, distribute and modify it.
|
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
|
_ACEOF
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@ -2074,7 +2076,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
# Provide some information about the compiler.
|
# Provide some information about the compiler.
|
||||||
echo "$as_me:2077:" \
|
echo "$as_me:2079:" \
|
||||||
"checking for Fortran 77 compiler version" >&5
|
"checking for Fortran 77 compiler version" >&5
|
||||||
ac_compiler=`set X $ac_compile; echo $2`
|
ac_compiler=`set X $ac_compile; echo $2`
|
||||||
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
|
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
|
||||||
@ -5975,6 +5977,23 @@ else
|
|||||||
fi;
|
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.
|
# Check whether --enable-g95 or --disable-g95 was given.
|
||||||
if test "${enable_g95+set}" = set; then
|
if test "${enable_g95+set}" = set; then
|
||||||
enableval="$enable_g95"
|
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 "$alsa" != yes -a "$oss" != yes -a "$portaudio" != yes; then
|
||||||
if test $HAS_PORTAUDIO_H -eq 1; then
|
if test $HAS_PORTAUDIO_H -eq 1; then
|
||||||
portaudio=yes;
|
portaudio=yes;
|
||||||
@ -7040,6 +7079,14 @@ if test $jack == "yes"; then
|
|||||||
echo "Using jack.";
|
echo "Using jack.";
|
||||||
fi
|
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
|
||||||
echo "Compiling $PACKAGE_NAME $PACKAGE_VERSION"
|
echo "Compiling $PACKAGE_NAME $PACKAGE_VERSION"
|
||||||
echo
|
echo
|
||||||
|
31
configure.ac
31
configure.ac
@ -234,6 +234,17 @@ AC_ARG_ENABLE(jack,
|
|||||||
AC_HELP_STRING([--enable-jack],[Force JACK usage.]),
|
AC_HELP_STRING([--enable-jack],[Force JACK usage.]),
|
||||||
[jack=$enableval] , [jack=no])
|
[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 pick gfortran or g95
|
||||||
dnl ====================
|
dnl ====================
|
||||||
|
|
||||||
@ -283,6 +294,18 @@ AC_SUBST(FC, "${FC}")
|
|||||||
dnl set defaults
|
dnl set defaults
|
||||||
dnl ============
|
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 "$alsa" != yes -a "$oss" != yes -a "$portaudio" != yes; then
|
||||||
if test $HAS_PORTAUDIO_H -eq 1; then
|
if test $HAS_PORTAUDIO_H -eq 1; then
|
||||||
[portaudio=yes];
|
[portaudio=yes];
|
||||||
@ -408,6 +431,14 @@ if test $jack == "yes"; then
|
|||||||
echo "Using jack.";
|
echo "Using jack.";
|
||||||
fi
|
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
|
||||||
echo "Compiling $PACKAGE_NAME $PACKAGE_VERSION"
|
echo "Compiling $PACKAGE_NAME $PACKAGE_VERSION"
|
||||||
echo
|
echo
|
||||||
|
@ -104,11 +104,11 @@ subroutine fivehz
|
|||||||
! Switch PTT line and TxOK appropriately
|
! Switch PTT line and TxOK appropriately
|
||||||
if(lauto.eq.1) then
|
if(lauto.eq.1) then
|
||||||
if(txtime .and. iptt.eq.0 .and. &
|
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
|
if(.not.txtime .or. mute.eq.1) TxOK=0 !Lower TxOK
|
||||||
else
|
else
|
||||||
if(mantx.eq.1 .and. iptt.eq.0 .and. &
|
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
|
if(mantx.eq.0 .or. mute.eq.1) TxOK=0 !Lower TxOK
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ subroutine fivehz
|
|||||||
if(nc0a.lt.5) nc0a=5
|
if(nc0a.lt.5) nc0a=5
|
||||||
if(TxOK.eq.0 .and. TxOKz.eq.1 .and. iptt.eq.1) nc0=-nc0a-1
|
if(TxOK.eq.0 .and. TxOKz.eq.1 .and. iptt.eq.1) nc0=-nc0a-1
|
||||||
if(nc0.le.0) nc0=nc0+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
|
if(iptt.eq.0 .and.TxOK.eq.0) then
|
||||||
sending=" "
|
sending=" "
|
||||||
|
207
ftn_init.F90
207
ftn_init.F90
@ -1,104 +1,103 @@
|
|||||||
! Fortran logical units used in WSJT6
|
! Fortran logical units used in WSJT6
|
||||||
!
|
!
|
||||||
! 10 wave files read from disk
|
! 10 wave files read from disk
|
||||||
! 11 decoded.txt
|
! 11 decoded.txt
|
||||||
! 12 decoded.ave
|
! 12 decoded.ave
|
||||||
! 13 tsky.dat
|
! 13 tsky.dat
|
||||||
! 14 azel.dat
|
! 14 azel.dat
|
||||||
! 15 debug.txt
|
! 15 debug.txt
|
||||||
! 16 c:/wsjt.reg
|
! 16 c:/wsjt.reg
|
||||||
! 17 wave files written to disk
|
! 17 wave files written to disk
|
||||||
! 18 test file to be transmitted (wsjtgen.f90)
|
! 18 test file to be transmitted (wsjtgen.f90)
|
||||||
! 19
|
! 19
|
||||||
! 20
|
! 20
|
||||||
! 21 ALL.TXT
|
! 21 ALL.TXT
|
||||||
! 22 kvasd.dat
|
! 22 kvasd.dat
|
||||||
! 23 CALL3.TXT
|
! 23 CALL3.TXT
|
||||||
|
|
||||||
!------------------------------------------------ ftn_init
|
!------------------------------------------------ ftn_init
|
||||||
subroutine ftn_init
|
subroutine ftn_init
|
||||||
|
|
||||||
character*1 cjunk
|
character*1 cjunk
|
||||||
include 'gcom1.f90'
|
include 'gcom1.f90'
|
||||||
include 'gcom2.f90'
|
include 'gcom2.f90'
|
||||||
include 'gcom3.f90'
|
include 'gcom3.f90'
|
||||||
include 'gcom4.f90'
|
include 'gcom4.f90'
|
||||||
|
|
||||||
! print*,'ftn_init.F90 nport=', nport, 'pttport=', pttport
|
i=ptt(nport,0,iptt) !Clear the PTT line
|
||||||
i=ptt(nport,pttport,0,iptt) !Clear the PTT line
|
addpfx=' '
|
||||||
addpfx=' '
|
|
||||||
|
do i=80,1,-1
|
||||||
do i=80,1,-1
|
if(AppDir(i:i).ne.' ') goto 1
|
||||||
if(AppDir(i:i).ne.' ') goto 1
|
enddo
|
||||||
enddo
|
1 iz=i
|
||||||
1 iz=i
|
lenappdir=iz
|
||||||
lenappdir=iz
|
call pfxdump(appdir(:iz)//'/prefixes.txt')
|
||||||
call pfxdump(appdir(:iz)//'/prefixes.txt')
|
|
||||||
|
#ifdef Win32
|
||||||
#ifdef Win32
|
open(11,file=appdir(:iz)//'/decoded.txt',status='unknown', &
|
||||||
open(11,file=appdir(:iz)//'/decoded.txt',status='unknown', &
|
share='denynone',err=910)
|
||||||
share='denynone',err=910)
|
#else
|
||||||
#else
|
open(11,file=appdir(:iz)//'/decoded.txt',status='unknown', &
|
||||||
open(11,file=appdir(:iz)//'/decoded.txt',status='unknown', &
|
err=910)
|
||||||
err=910)
|
#endif
|
||||||
#endif
|
endfile 11
|
||||||
endfile 11
|
|
||||||
|
#ifdef Win32
|
||||||
#ifdef Win32
|
open(12,file=appdir(:iz)//'/decoded.ave',status='unknown', &
|
||||||
open(12,file=appdir(:iz)//'/decoded.ave',status='unknown', &
|
share='denynone',err=920)
|
||||||
share='denynone',err=920)
|
#else
|
||||||
#else
|
open(12,file=appdir(:iz)//'/decoded.ave',status='unknown', &
|
||||||
open(12,file=appdir(:iz)//'/decoded.ave',status='unknown', &
|
err=920)
|
||||||
err=920)
|
#endif
|
||||||
#endif
|
endfile 12
|
||||||
endfile 12
|
|
||||||
|
#ifdef Win32
|
||||||
#ifdef Win32
|
open(14,file=appdir(:iz)//'/azel.dat',status='unknown', &
|
||||||
open(14,file=appdir(:iz)//'/azel.dat',status='unknown', &
|
share='denynone',err=930)
|
||||||
share='denynone',err=930)
|
#else
|
||||||
#else
|
open(14,file=appdir(:iz)//'/azel.dat',status='unknown', &
|
||||||
open(14,file=appdir(:iz)//'/azel.dat',status='unknown', &
|
err=930)
|
||||||
err=930)
|
#endif
|
||||||
#endif
|
|
||||||
|
#ifdef Win32
|
||||||
#ifdef Win32
|
open(15,file=appdir(:iz)//'/debug.txt',status='unknown', &
|
||||||
open(15,file=appdir(:iz)//'/debug.txt',status='unknown', &
|
share='denynone',err=940)
|
||||||
share='denynone',err=940)
|
#else
|
||||||
#else
|
open(15,file=appdir(:iz)//'/debug.txt',status='unknown', &
|
||||||
open(15,file=appdir(:iz)//'/debug.txt',status='unknown', &
|
err=940)
|
||||||
err=940)
|
#endif
|
||||||
#endif
|
|
||||||
|
#ifdef Win32
|
||||||
#ifdef Win32
|
open(21,file=appdir(:iz)//'/ALL.TXT',status='unknown', &
|
||||||
open(21,file=appdir(:iz)//'/ALL.TXT',status='unknown', &
|
access='append',share='denynone',err=950)
|
||||||
access='append',share='denynone',err=950)
|
#else
|
||||||
#else
|
open(21,file=appdir(:iz)//'/ALL.TXT',status='unknown',err=950)
|
||||||
open(21,file=appdir(:iz)//'/ALL.TXT',status='unknown',err=950)
|
do i=1,9999999
|
||||||
do i=1,9999999
|
read(21,*,end=10) cjunk
|
||||||
read(21,*,end=10) cjunk
|
enddo
|
||||||
enddo
|
10 continue
|
||||||
10 continue
|
#endif
|
||||||
#endif
|
|
||||||
|
#ifdef Win32
|
||||||
#ifdef Win32
|
open(22,file=appdir(:iz)//'/kvasd.dat',access='direct',recl=1024, &
|
||||||
open(22,file=appdir(:iz)//'/kvasd.dat',access='direct',recl=1024, &
|
status='unknown',share='denynone')
|
||||||
status='unknown',share='denynone')
|
#else
|
||||||
#else
|
open(22,file=appdir(:iz)//'/kvasd.dat',access='direct',recl=1024, &
|
||||||
open(22,file=appdir(:iz)//'/kvasd.dat',access='direct',recl=1024, &
|
status='unknown')
|
||||||
status='unknown')
|
#endif
|
||||||
#endif
|
|
||||||
|
return
|
||||||
return
|
|
||||||
|
910 print*,'Error opening DECODED.TXT'
|
||||||
910 print*,'Error opening DECODED.TXT'
|
stop
|
||||||
stop
|
920 print*,'Error opening DECODED.AVE'
|
||||||
920 print*,'Error opening DECODED.AVE'
|
stop
|
||||||
stop
|
930 print*,'Error opening AZEL.DAT'
|
||||||
930 print*,'Error opening AZEL.DAT'
|
stop
|
||||||
stop
|
940 print*,'Error opening DEBUG.TXT'
|
||||||
940 print*,'Error opening DEBUG.TXT'
|
stop
|
||||||
stop
|
950 print*,'Error opening ALL.TXT'
|
||||||
950 print*,'Error opening ALL.TXT'
|
stop
|
||||||
stop
|
|
||||||
|
end subroutine ftn_init
|
||||||
end subroutine ftn_init
|
|
||||||
|
@ -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):',
|
idinterval=Pmw.EntryField(g1.interior(),labelpos=W,label_text='ID Interval (m):',
|
||||||
value=10,entry_textvariable=IDinterval,entry_width=12)
|
value=10,entry_textvariable=IDinterval,entry_width=12)
|
||||||
comport=Pmw.EntryField(g1.interior(),labelpos=W,label_text='PTT Port:',
|
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:',
|
audioin=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Audio In:',
|
||||||
value='0',entry_textvariable=DevinName,entry_width=12)
|
value='0',entry_textvariable=DevinName,entry_width=12)
|
||||||
audioout=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Audio Out:',
|
audioout=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Audio Out:',
|
||||||
|
2
ptt.c
2
ptt.c
@ -1,7 +1,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdio.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 HANDLE hFile;
|
||||||
static int open=0;
|
static int open=0;
|
||||||
|
242
ptt_unix.c
242
ptt_unix.c
@ -43,18 +43,6 @@
|
|||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
#endif
|
#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
|
#ifdef HAVE_SYS_STAT_H
|
||||||
# include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
#endif
|
#endif
|
||||||
@ -62,107 +50,87 @@ int lp_ptt (int fd, int onoff);
|
|||||||
# include <sys/param.h>
|
# include <sys/param.h>
|
||||||
#endif
|
#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>
|
#include <sys/io.h>
|
||||||
|
#define TTYNAME "/dev/ttyUSB%d"
|
||||||
#endif
|
#endif
|
||||||
#include <string.h>
|
|
||||||
/* parport functions */
|
|
||||||
|
|
||||||
int dev_is_parport(const char *fname);
|
/* Not quite right for size but '%d + 1' should be plenty enough -db */
|
||||||
int ptt_parallel(int fd, int *ntx, int *iptt);
|
/* As TTYNAME is a string, just at 20 chars do udevd is happier. */
|
||||||
int ptt_serial(int fd, int *ntx, int *iptt);
|
/* E.g. USB serial ports appear as /dev/ttyUSB0 */
|
||||||
|
#define TTYNAME_SIZE sizeof(TTYNAME)+20
|
||||||
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
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ptt_(int unused, char *ptt_port, int *ntx, int *iptt)
|
ptt_(int *nport, 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)
|
|
||||||
{
|
{
|
||||||
|
/* Fixme, nport should be a sting and not a number */
|
||||||
|
static int nopen=0;
|
||||||
int control = TIOCM_RTS | TIOCM_DTR;
|
int control = TIOCM_RTS | TIOCM_DTR;
|
||||||
|
|
||||||
if(*ntx) {
|
char s[TTYNAME_SIZE];
|
||||||
ioctl(fd, TIOCMBIS, &control); /* Set DTR and RTS */
|
|
||||||
*iptt = 1;
|
if(*nport < 0) {
|
||||||
} else {
|
*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);
|
ioctl(fd, TIOCMBIC, &control);
|
||||||
*iptt = 0;
|
close(fd);
|
||||||
|
*iptt=0;
|
||||||
|
nopen=0;
|
||||||
}
|
}
|
||||||
return(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 */
|
/* parport functions */
|
||||||
|
|
||||||
@ -181,11 +149,13 @@ int lp_ptt (int fd, int onoff);
|
|||||||
int
|
int
|
||||||
dev_is_parport(const char *fname)
|
dev_is_parport(const char *fname)
|
||||||
{
|
{
|
||||||
|
char nm[MAXPATHLEN];
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int fd;
|
int fd, m;
|
||||||
|
|
||||||
snprintf(nm, sizeof(nm), "/dev/%s", fname);
|
|
||||||
|
|
||||||
|
m = snprintf(nm, sizeof(nm), "/dev/%s", fname);
|
||||||
|
if (m >= sizeof(nm))
|
||||||
|
return (-1);
|
||||||
if ((fd = open(nm, O_RDWR | O_NONBLOCK)) == -1)
|
if ((fd = open(nm, O_RDWR | O_NONBLOCK)) == -1)
|
||||||
return (-1);
|
return (-1);
|
||||||
if (fstat(fd, &st) == -1)
|
if (fstat(fd, &st) == -1)
|
||||||
@ -205,16 +175,14 @@ out:
|
|||||||
int
|
int
|
||||||
dev_is_parport(const char *fname)
|
dev_is_parport(const char *fname)
|
||||||
{
|
{
|
||||||
|
char nm[MAXPATHLEN];
|
||||||
struct stat st;
|
struct stat st;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
int fd;
|
int fd, m;
|
||||||
char *p;
|
|
||||||
|
|
||||||
if ((p = strchr(fname, '/')) != NULL) /* Look for /dev */
|
|
||||||
snprintf(nm, sizeof(nm), "%s", fname);
|
|
||||||
else
|
|
||||||
snprintf(nm, sizeof(nm), "/dev/%s", fname);
|
|
||||||
|
|
||||||
|
m = snprintf(nm, sizeof(nm), "/dev/%s", fname);
|
||||||
|
if (m >= sizeof(nm))
|
||||||
|
return (-1);
|
||||||
if ((fd = open(nm, O_RDWR | O_NONBLOCK)) == -1)
|
if ((fd = open(nm, O_RDWR | O_NONBLOCK)) == -1)
|
||||||
return (-1);
|
return (-1);
|
||||||
if (fstat(fd, &st) == -1)
|
if (fstat(fd, &st) == -1)
|
||||||
@ -307,6 +275,7 @@ lp_init (int fd)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "Claiming parallel port %s", dev->desc);
|
fprintf(stderr, "Claiming parallel port %s", dev->desc);
|
||||||
debug ("HINT: did you unload the lp kernel module?");
|
debug ("HINT: did you unload the lp kernel module?");
|
||||||
|
debug ("HINT: perhaps there is another cwdaemon running?");
|
||||||
close (fd);
|
close (fd);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
@ -372,26 +341,47 @@ lp_ptt (int fd, int onoff)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* XXX I am totally unsure of this, LPNAME should come from
|
||||||
* ptt_parallel
|
* the WSJT.INI instead but for now this should work -- db
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*/
|
*/
|
||||||
|
#ifdef BSD
|
||||||
|
#define LPNAME "lpt%d"
|
||||||
|
#else
|
||||||
|
#define LPNAME "lp%d"
|
||||||
|
#endif
|
||||||
|
#define LPNAME_SIZE (sizeof(LPNAME))
|
||||||
|
|
||||||
int
|
int
|
||||||
ptt_parallel(int fd, int *ntx, int *iptt)
|
ptt_(int *nport, int *ntx, int *iptt)
|
||||||
{
|
{
|
||||||
if(*ntx) {
|
static int nopen=0;
|
||||||
lp_ptt(fd, 1);
|
int fd;
|
||||||
*iptt=1;
|
char s[LPNAME_SIZE];
|
||||||
} else {
|
|
||||||
lp_ptt(fd, 0);
|
if(*nport < 0) {
|
||||||
*iptt=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);
|
return(0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
8
wsjt.py
8
wsjt.py
@ -1517,10 +1517,6 @@ def update():
|
|||||||
Audio.gcom2.nport=options.ComPort.get()
|
Audio.gcom2.nport=options.ComPort.get()
|
||||||
except:
|
except:
|
||||||
Audio.gcom2.nport=0
|
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
|
# Queue up the next update
|
||||||
ldate.after(100,update)
|
ldate.after(100,update)
|
||||||
@ -2026,8 +2022,8 @@ try:
|
|||||||
options.ComPort.set(0)
|
options.ComPort.set(0)
|
||||||
Audio.gcom2.nport=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 == 'Mileskm': options.mileskm.set(value)
|
||||||
elif key == 'MsgStyle': options.ireport.set(value)
|
elif key == 'MsgStyle': options.ireport.set(value)
|
||||||
elif key == 'Region': options.iregion.set(value)
|
elif key == 'Region': options.iregion.set(value)
|
||||||
|
Loading…
Reference in New Issue
Block a user