#!/usr/bin/perl -w # # clone-send # John Simpson 2005-08-01 # # sends data to an Alinco DJ-296T which thinks it's receiving cloning commands # ############################################################################### # # Copyright (C) 2005 John Simpson. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # or visit http://www.gnu.org/licenses/gpl.txt # ############################################################################### require 5.003 ; use strict ; use Serial ; my $device = "/dev/cu.USA19QWb232P1.1" ; ############################################################################### # # debugging function my $do_debug = 0 ; sub debug($) { $do_debug && print STDERR $_[0] ; } ############################################################################### ############################################################################### ############################################################################### # # figure out where we're writing the output my $infile = ( shift || die "No filename specified\n" ) ; open ( I , "<$infile" ) or die "Can\'t read $infile: $!\n" ; ############################################################################### # # open the port system "stty -f $device 9600 cs8 -parenb -cstopb -crtscts raw" ; openport ( $device ) ; while ( my $line = ) { chomp $line ; debug "SEND\t$line\n" ; sendline ( $line ) ; my $resp = "" ; while ( ( $resp ne "OK" ) && ( $resp ne "ERROR" ) ) { $resp = recvline() ; next if ( $resp eq $line ) ; debug "RECV\t$resp\n" ; } } close I ;