mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-28 20:32:28 -04:00
- This imports the freebsd branch modifications
- This gets rid of the need to configure for parallel or serial port - The code picks up the device name from WSJT.INI for ComPort (misnamed now) which is actually a device name for either a serial port or parallel port. ptt_unix.c then uses the appropriate code to "talk" to a parallel or serial port. - audio in/audio out should work the same way on windows as it did before, however it is actually now a string name value, which can be used to open the appropriate /dev/dsp on OSS or in future, be passed to the ALSA init routines or other audio routines as needed. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@185 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
a68074eb7d
commit
ad643f3353
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.59 for wsjt 5.9.2.
|
# Generated by GNU Autoconf 2.59 for wsjt 5.9.2.
|
||||||
#
|
#
|
||||||
# $Id: configure.ac 175 2006-04-17 20:43:21Z va3db $
|
# $Id: configure.ac 184 2006-07-05 03:03:11Z va3db $
|
||||||
#
|
#
|
||||||
# Copyright (C) 2003 Free Software Foundation, Inc.
|
# Copyright (C) 2003 Free Software Foundation, Inc.
|
||||||
# This configure script is free software; the Free Software Foundation
|
# This configure script is free software; the Free Software Foundation
|
||||||
@ -858,8 +858,6 @@ 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.
|
||||||
|
|
||||||
@ -979,7 +977,7 @@ Copyright (C) 2003 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 175 2006-04-17 20:43:21Z va3db $
|
$Id: configure.ac 184 2006-07-05 03:03:11Z va3db $
|
||||||
_ACEOF
|
_ACEOF
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@ -2356,7 +2354,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
# Provide some information about the compiler.
|
# Provide some information about the compiler.
|
||||||
echo "$as_me:2359:" \
|
echo "$as_me:2357:" \
|
||||||
"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
|
||||||
@ -6649,23 +6647,6 @@ 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"
|
||||||
@ -6728,26 +6709,6 @@ 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 \
|
if test "$alsa" != yes -a "$oss" != yes -a \
|
||||||
"$portaudio" != yes -a "$jack" != yes; then
|
"$portaudio" != yes -a "$jack" != yes; then
|
||||||
if test $HAS_PORTAUDIO_H -eq 1; then
|
if test $HAS_PORTAUDIO_H -eq 1; then
|
||||||
@ -7859,14 +7820,6 @@ 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
@ -240,17 +240,6 @@ 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 ====================
|
||||||
|
|
||||||
@ -300,18 +289,6 @@ 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 \
|
if test "$alsa" != yes -a "$oss" != yes -a \
|
||||||
"$portaudio" != yes -a "$jack" != yes; then
|
"$portaudio" != yes -a "$jack" != yes; then
|
||||||
if test $HAS_PORTAUDIO_H -eq 1; then
|
if test $HAS_PORTAUDIO_H -eq 1; then
|
||||||
@ -444,14 +421,6 @@ 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,1,iptt) !Raise PTT
|
mute.eq.0) i1=ptt(nport,pttport,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,1,iptt) !Raise PTT
|
mute.eq.0) i2=ptt(nport,1,pttport,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,0,iptt)
|
if(nc0.eq.0) i3=ptt(nport,pttport,0,iptt)
|
||||||
|
|
||||||
if(iptt.eq.0 .and.TxOK.eq.0) then
|
if(iptt.eq.0 .and.TxOK.eq.0) then
|
||||||
sending=" "
|
sending=" "
|
||||||
|
@ -24,7 +24,8 @@ subroutine ftn_init
|
|||||||
include 'gcom3.f90'
|
include 'gcom3.f90'
|
||||||
include 'gcom4.f90'
|
include 'gcom4.f90'
|
||||||
|
|
||||||
i=ptt(nport,0,iptt) !Clear the PTT line
|
! print*,'ftn_init.F90 nport=', nport, 'pttport=', pttport
|
||||||
|
i=ptt(nport,pttport,0,iptt) !Clear the PTT line
|
||||||
addpfx=' '
|
addpfx=' '
|
||||||
|
|
||||||
do i=80,1,-1
|
do i=80,1,-1
|
||||||
|
@ -40,12 +40,13 @@ integer nx !x coordinate for waterfall pixmap GUI
|
|||||||
integer mfsample !Measured sample rate, input SoundIn
|
integer mfsample !Measured sample rate, input SoundIn
|
||||||
integer mfsample2 !Measured sample rate, output SoundOut
|
integer mfsample2 !Measured sample rate, output SoundOut
|
||||||
integer ns0 !Time at last ALL.TXT date entry Decoder
|
integer ns0 !Time at last ALL.TXT date entry Decoder
|
||||||
|
character*12 devin_name,devout_name ! GUI
|
||||||
|
|
||||||
common/gcom1/Tbuf(1024),ntrbuf(1024),Tsec,rxdelay,txdelay, &
|
common/gcom1/Tbuf(1024),ntrbuf(1024),Tsec,rxdelay,txdelay, &
|
||||||
samfacin,samfacout,txsnrdb,y1(NRXMAX),y2(NRXMAX), &
|
samfacin,samfacout,txsnrdb,y1(NRXMAX),y2(NRXMAX), &
|
||||||
nmax,iwrite,iread,iwave(NTXMAX),nwave,TxOK,Receiving,Transmitting, &
|
nmax,iwrite,iread,iwave(NTXMAX),nwave,TxOK,Receiving,Transmitting, &
|
||||||
TxFirst,TRPeriod,ibuf,ibuf0,ave,rms,ngo,level,mute,newdat,ndsec, &
|
TxFirst,TRPeriod,ibuf,ibuf0,ave,rms,ngo,level,mute,newdat,ndsec, &
|
||||||
ndevin,ndevout,nx,mfsample,mfsample2,ns0
|
ndevin,ndevout,nx,mfsample,mfsample2,ns0,devin_name,devout_name
|
||||||
|
|
||||||
!### volatile /gcom1/
|
!### volatile /gcom1/
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@ character*24 decodedfile
|
|||||||
character*80 AppDir !WSJT installation directory GUI
|
character*80 AppDir !WSJT installation directory GUI
|
||||||
character*80 filetokilla !Filenames (full path) Decoder
|
character*80 filetokilla !Filenames (full path) Decoder
|
||||||
character*80 filetokillb
|
character*80 filetokillb
|
||||||
|
character*12 pttport
|
||||||
|
|
||||||
common/gcom2/ps0(431),psavg(450),s2(64,3100),ccf(-5:540), &
|
common/gcom2/ps0(431),psavg(450),s2(64,3100),ccf(-5:540), &
|
||||||
green(500),ngreen,dgain,iter,ndecoding,ndecoding0,mousebutton, &
|
green(500),ngreen,dgain,iter,ndecoding,ndecoding0,mousebutton, &
|
||||||
@ -90,6 +91,6 @@ common/gcom2/ps0(431),psavg(450),s2(64,3100),ccf(-5:540), &
|
|||||||
idinterval,msmax,lenappdir,ndiskdat,nlines,nflat,ntxreq,ntxnow, &
|
idinterval,msmax,lenappdir,ndiskdat,nlines,nflat,ntxreq,ntxnow, &
|
||||||
ndepth,nspecial,ndf,ss1(-224:224),ss2(-224:224), &
|
ndepth,nspecial,ndf,ss1(-224:224),ss2(-224:224), &
|
||||||
mycall,hiscall,hisgrid,txmsg,sending,mode,fname0,fnamea, &
|
mycall,hiscall,hisgrid,txmsg,sending,mode,fname0,fnamea, &
|
||||||
fnameb,decodedfile,AppDir,filetokilla,filetokillb,utcdate
|
fnameb,decodedfile,AppDir,filetokilla,filetokillb,utcdate,pttport
|
||||||
|
|
||||||
!### volatile /gcom2/
|
!### volatile /gcom2/
|
||||||
|
11
options.py
11
options.py
@ -25,8 +25,11 @@ MyGrid=StringVar()
|
|||||||
#TxDelay=StringVar()
|
#TxDelay=StringVar()
|
||||||
IDinterval=IntVar()
|
IDinterval=IntVar()
|
||||||
ComPort=IntVar()
|
ComPort=IntVar()
|
||||||
|
PttPort=StringVar()
|
||||||
ndevin=IntVar()
|
ndevin=IntVar()
|
||||||
ndevout=IntVar()
|
ndevout=IntVar()
|
||||||
|
DevinName=StringVar()
|
||||||
|
DevoutName=StringVar()
|
||||||
samfacin=DoubleVar()
|
samfacin=DoubleVar()
|
||||||
samfacout=DoubleVar()
|
samfacout=DoubleVar()
|
||||||
Template1=StringVar()
|
Template1=StringVar()
|
||||||
@ -106,12 +109,12 @@ mygrid=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Grid Locator:',
|
|||||||
## value='0.2',entry_textvariable=TxDelay)
|
## value='0.2',entry_textvariable=TxDelay)
|
||||||
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='COM Port:',
|
comport=Pmw.EntryField(g1.interior(),labelpos=W,label_text='PTT Port:',
|
||||||
value=1,entry_textvariable=ComPort,entry_width=12)
|
value='/dev/cuad0',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=ndevin,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:',
|
||||||
value=0,entry_textvariable=ndevout,entry_width=12)
|
value='0',entry_textvariable=DevoutName,entry_width=12)
|
||||||
ratein=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Rate In:',
|
ratein=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Rate In:',
|
||||||
value=1.0000,entry_textvariable=samfacin,entry_width=12)
|
value=1.0000,entry_textvariable=samfacin,entry_width=12)
|
||||||
rateout=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Rate Out:',
|
rateout=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Rate 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, int *ntx, int *iptt)
|
int ptt_(int *nport, char *unused, int *ntx, int *iptt)
|
||||||
{
|
{
|
||||||
static HANDLE hFile;
|
static HANDLE hFile;
|
||||||
static int open=0;
|
static int open=0;
|
||||||
|
253
ptt_unix.c
253
ptt_unix.c
@ -43,80 +43,6 @@
|
|||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SYS_STAT_H
|
|
||||||
# include <sys/stat.h>
|
|
||||||
#endif
|
|
||||||
#if (defined(__unix__) || defined(unix)) && !defined(USG)
|
|
||||||
# include <sys/param.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
/* 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 *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;
|
|
||||||
|
|
||||||
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);
|
|
||||||
close(fd);
|
|
||||||
*iptt=0;
|
|
||||||
nopen=0;
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_PARALLEL
|
|
||||||
|
|
||||||
#ifdef HAVE_LINUX_PPDEV_H
|
#ifdef HAVE_LINUX_PPDEV_H
|
||||||
# include <linux/ppdev.h>
|
# include <linux/ppdev.h>
|
||||||
# include <linux/parport.h>
|
# include <linux/parport.h>
|
||||||
@ -124,6 +50,10 @@ ptt_(int *nport, int *ntx, int *iptt)
|
|||||||
#ifdef HAVE_DEV_PPBUS_PPI_H
|
#ifdef HAVE_DEV_PPBUS_PPI_H
|
||||||
# include <dev/ppbus/ppi.h>
|
# include <dev/ppbus/ppi.h>
|
||||||
# include <dev/ppbus/ppbconf.h>
|
# include <dev/ppbus/ppbconf.h>
|
||||||
|
|
||||||
|
int lp_reset (int fd);
|
||||||
|
int lp_ptt (int fd, int onoff);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SYS_STAT_H
|
#ifdef HAVE_SYS_STAT_H
|
||||||
# include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
@ -132,6 +62,108 @@ ptt_(int *nport, int *ntx, int *iptt)
|
|||||||
# include <sys/param.h>
|
# include <sys/param.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef BSD /* #ifdef LINUX ? */
|
||||||
|
#include <sys/io.h>
|
||||||
|
#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
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
int control = TIOCM_RTS | TIOCM_DTR;
|
||||||
|
|
||||||
|
if(*ntx) {
|
||||||
|
ioctl(fd, TIOCMBIS, &control); /* Set DTR and RTS */
|
||||||
|
*iptt = 1;
|
||||||
|
} else {
|
||||||
|
ioctl(fd, TIOCMBIC, &control);
|
||||||
|
*iptt = 0;
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* parport functions */
|
/* parport functions */
|
||||||
|
|
||||||
int lp_reset (int fd);
|
int lp_reset (int fd);
|
||||||
@ -149,13 +181,11 @@ 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, m;
|
int fd;
|
||||||
|
|
||||||
|
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)
|
||||||
@ -175,14 +205,16 @@ 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, m;
|
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);
|
||||||
|
|
||||||
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)
|
||||||
@ -275,7 +307,6 @@ 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);
|
||||||
}
|
}
|
||||||
@ -341,47 +372,25 @@ lp_ptt (int fd, int onoff)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX I am totally unsure of this, LPNAME should come from
|
/*
|
||||||
* the WSJT.INI instead but for now this should work -- db
|
* 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
|
||||||
*/
|
*/
|
||||||
#ifdef BSD
|
|
||||||
#define LPNAME "lpt%d"
|
|
||||||
#else
|
|
||||||
#define LPNAME "lp%d"
|
|
||||||
#endif
|
|
||||||
#define LPNAME_SIZE (sizeof(LPNAME))
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ptt_(int *nport, int *ntx, int *iptt)
|
ptt_parallel(int fd, int *ntx, int *iptt)
|
||||||
{
|
{
|
||||||
static int nopen=0;
|
if(*ntx) {
|
||||||
int fd;
|
lp_ptt(fd, 1);
|
||||||
char s[LPNAME_SIZE];
|
*iptt=1;
|
||||||
|
} else {
|
||||||
if(*nport < 0) {
|
lp_ptt(fd, 0);
|
||||||
*iptt=*ntx;
|
*iptt=0;
|
||||||
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
|
|
||||||
|
18
specjt.py
18
specjt.py
@ -489,11 +489,21 @@ if g.cmap == "AFMHot":
|
|||||||
|
|
||||||
#---------------------------------------------- Display GUI and start mainloop
|
#---------------------------------------------- Display GUI and start mainloop
|
||||||
draw_axis()
|
draw_axis()
|
||||||
Audio.gcom1.ndevin=g.ndevin.get()
|
try:
|
||||||
Audio.gcom1.ndevout=g.ndevout.get()
|
ndevin=g.ndevin.get()
|
||||||
ndevin=g.ndevin.get()
|
except:
|
||||||
ndevout=g.ndevout.get()
|
ndevin=0
|
||||||
|
Audio.gcom1.ndevin=ndevin
|
||||||
|
|
||||||
|
try:
|
||||||
|
ndevout=g.ndevout.get()
|
||||||
|
except:
|
||||||
|
ndevout=0
|
||||||
|
Audio.gcom1.ndevout=ndevout
|
||||||
|
# Only valid for windows
|
||||||
|
# for now
|
||||||
Audio.audio_init(ndevin,ndevout) #Start the audio stream
|
Audio.audio_init(ndevin,ndevout) #Start the audio stream
|
||||||
|
|
||||||
ltime.after(200,update)
|
ltime.after(200,update)
|
||||||
|
|
||||||
root.deiconify()
|
root.deiconify()
|
||||||
|
13
wsjt.py
13
wsjt.py
@ -1513,6 +1513,10 @@ def update():
|
|||||||
Audio.gcom2.nport=int(options.ComPort.get())
|
Audio.gcom2.nport=int(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)
|
||||||
@ -2013,7 +2017,8 @@ try:
|
|||||||
elif key == 'ComPort':
|
elif key == 'ComPort':
|
||||||
options.ComPort.set(value)
|
options.ComPort.set(value)
|
||||||
Audio.gcom2.nport=int(options.ComPort.get())
|
Audio.gcom2.nport=int(options.ComPort.get())
|
||||||
elif key == 'Mileskm': options.mileskm.set(value)
|
Audio.gcom2.pttport=(options.PttPort.get()+' ')[:12]
|
||||||
|
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)
|
||||||
elif key == 'AudioIn':
|
elif key == 'AudioIn':
|
||||||
@ -2111,12 +2116,12 @@ f.write("HisGrid " + t + "\n")
|
|||||||
#f.write("RxDelay " + str(options.RxDelay.get()) + "\n")
|
#f.write("RxDelay " + str(options.RxDelay.get()) + "\n")
|
||||||
#f.write("TxDelay " + str(options.TxDelay.get()) + "\n")
|
#f.write("TxDelay " + str(options.TxDelay.get()) + "\n")
|
||||||
f.write("IDinterval " + str(options.IDinterval.get()) + "\n")
|
f.write("IDinterval " + str(options.IDinterval.get()) + "\n")
|
||||||
f.write("ComPort " + str(options.ComPort.get()) + "\n")
|
f.write("ComPort " + str(options.PttPort.get()) + "\n")
|
||||||
f.write("Mileskm " + str(options.mileskm.get()) + "\n")
|
f.write("Mileskm " + str(options.mileskm.get()) + "\n")
|
||||||
f.write("MsgStyle " + str(options.ireport.get()) + "\n")
|
f.write("MsgStyle " + str(options.ireport.get()) + "\n")
|
||||||
f.write("Region " + str(options.iregion.get()) + "\n")
|
f.write("Region " + str(options.iregion.get()) + "\n")
|
||||||
f.write("AudioIn " + str(options.ndevin.get()) + "\n")
|
f.write("AudioIn " + str(options.DevinName.get()) + "\n")
|
||||||
f.write("AudioOut " + str(options.ndevout.get()) + "\n")
|
f.write("AudioOut " + str(options.DevoutName.get()) + "\n")
|
||||||
f.write("SamFacIn " + str(options.samfacin.get()) + "\n")
|
f.write("SamFacIn " + str(options.samfacin.get()) + "\n")
|
||||||
f.write("SamFacOut " + str(options.samfacout.get()) + "\n")
|
f.write("SamFacOut " + str(options.samfacout.get()) + "\n")
|
||||||
if options.Template6.get()=="": options.Template6.set("_")
|
if options.Template6.get()=="": options.Template6.set("_")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user