#!/usr/bin/perl -w

# Requires Device-Serial perl module.
use Device::SerialPort 0.05;
use strict;

my $mate = "/dev/ttyUSB0";


# Constructor & Basic Values

my $ob = Device::SerialPort->new ($mate) || die "Cannot open $mate:$!";

$ob->baudrate (19200) || die "fail setting baudrate";
$ob->parity ("none") || die "fail setting parity";
$ob->databits (8) || die "fail setting databits";
$ob->stopbits (1) || die "fail setting stopbits";
$ob->handshake ("none") || die "fail setting handshake";
$ob->dtr_active (1) || die "fail setting dtr_active";

$ob->rts_active (0) || die "fail setting rts_active";

sleep 1;

if ((my $return = $ob->input) ne "")
{
#   $ob->write ($return);
      print "$return";
      }
      else
      {
         print "ERROR!! Did not receive anything from Mate.\n";
      }
         
     undef $ob

#source: http://www.outbackpower.com/forum/viewtopic.php?f=14&t=2410&p=13765&hilit=linux#p13765
