Here is one pretty easy and useful one liner in Perl:

perl -MDevice::SerialPort -e 'Device::SerialPort->new("/dev/ttyACM0")->pulse_dtr_on(300);'

And here is a fully functional perl script that I wrote for the same purpose:

#!/usr/bin/perl
use Device::SerialPort;

sub find_dev {
        my $test = shift;
        my $dev = '';
        for (my $i=0; $i< =4; $i++) {
                if ( -e $test . $i ) {
                        $dev = $test . $i;
                        last
                }
        }
        return $dev;
}

my $dev = '';
$dev = find_dev('/dev/ttyACM');

if ($dev eq '') {
        $dev = find_dev('/dev/ttyUSB');
}

if ($dev eq '') {
        print "Unable to find a suitable device\n";
        exit;
}
print "Device located at $dev\nSending reset!\n";

Device::SerialPort->new($dev)->pulse_dtr_on(300);

Comments are closed.

Posted by HackMan
Dated: 24th November 2012
Filled Under: Uncategorized