aboutsummaryrefslogtreecommitdiff
path: root/utils/get-data
diff options
context:
space:
mode:
Diffstat (limited to 'utils/get-data')
-rw-r--r--utils/get-data28
1 files changed, 28 insertions, 0 deletions
diff --git a/utils/get-data b/utils/get-data
new file mode 100644
index 0000000..f4309cd
--- /dev/null
+++ b/utils/get-data
@@ -0,0 +1,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;
+ }
+}