aboutsummaryrefslogtreecommitdiff
path: root/utils/get-data
blob: f4309cd623a0e230fd9e74f47a6aa9652cb92772 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env perl 
use strict;
use warnings;
use Path::Tiny;
use IO::Termios;
 
my $makefile = path(__FILE__)->parent(2)->child('Makefile');
my ($port) = $makefile->slurp() =~ /^UPLOAD_PORT\s*=\s*(\S+)/sm;
 
my $fh = IO::Termios->open($port'115200,8,n,1')
    or die "Can't open $port$!\n";
 
$fh->cfmakeraw();
 
print $fh "xx logcat\n"
    or die "Can't write: $!";
my $in_log=0;
while (<$fh>) {
    if (/^xx end\b/) {
        last;
    }
    elsif ($in_log) {
        print;
    }
    elsif (/^xx begin\b/) {
        $in_log=1;
    }
}