skip sunxi-pio if missing
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 1 Dec 2017 18:56:24 +0000 (19:56 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 1 Dec 2017 18:56:24 +0000 (19:56 +0100)
gpio.pl

diff --git a/gpio.pl b/gpio.pl
index ddede77..a209fa1 100755 (executable)
--- a/gpio.pl
+++ b/gpio.pl
@@ -158,6 +158,9 @@ while(<$fh>) {
 
 warn "# pin_function = ",dump($pin_function);
 
+my $have_sunxi_pio = `which sunxi-pio`;
+if ( $have_sunxi_pio ) {
+
 open(my $pio, '-|', 'sunxi-pio -m print');
 while(<$pio>) {
        chomp;
@@ -171,6 +174,8 @@ while(<$pio>) {
 }
 close($pio);
 
+} # have_sunxi_pio
+
 my @max_len = ( 0,0,0,0 );
 my @line_parts;