Hi all,

I am trying to communicate to one machine through serial port ( COM port )
sau /etc/ttyS0. I am making use of serialPort.pm for this. The script is
able to open the connection using new() method but after that nothing comes
up . I want who lot of boot up messages to come on console. I am getting all
these messages when i use minicom cli modem. This is the script i am using.
Please  help me . this is very urgent.

****************************************************************************
***
test.pl
****************************************************************************
****

#!/usr/bin/perl -w
# cross-platform example6

use strict;
use vars qw( $OS_win $ob $port );

BEGIN {
        $OS_win = ($^O eq "MSWin32") ? 1 : 0;
        if ($OS_win) {
            eval "use Win32::SerialPort 0.11";
            die "$@\n" if ($@);
        }
        else {
            eval "use Device::SerialPort";
            die "$@\n" if ($@);
        }
} # End BEGIN

$file = "test.cfg";
if ($OS_win) {
    $ob = Win32::SerialPort->start ($file);
}
else {
    $port = '/dev/ttyS0';
    $ob = Device::SerialPort->new ($port);

    }

die "Can't open serial port from $file: $^E\n" unless ($ob);
my $baud = $ob->baudrate(9600);
my $parity = $ob->parity('none');
my $data = $ob->databits(8);
my $stop = $ob->stopbits(1);

print "B = $baud, D = $data, S = $stop, P = $parity\n";


while(1)
{
($count, $result) = $ob->read(10);
print  $result;
}
undef $ob;


This program just prints few lines of the boot log. Can anybody points me to
the mistake. I would highly appreciate a quick response. This is kind of
urgent. If somebosy have some sample programs , pls send them to me.

Regards,
Sushil

_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users

Reply via email to