added funcs from raspi-gpio with -a flag
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 18 Apr 2018 15:35:56 +0000 (15:35 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 18 Apr 2018 15:38:43 +0000 (15:38 +0000)
gpio.pl

diff --git a/gpio.pl b/gpio.pl
index 1d3047e..6702865 100755 (executable)
--- a/gpio.pl
+++ b/gpio.pl
@@ -217,16 +217,29 @@ close($pio);
 my $have_raspi_gpio = `which raspi-gpio`;
 if ( $have_raspi_gpio ) {
 
+my @gpio_pins;
+
 open(my $pio, '-|', 'raspi-gpio get');
 while(<$pio>) {
        chomp;
        if ( m/^GPIO (\d+): (.+)/ ) {
                my $pin = 'gpio' . $1;
+               push @gpio_pins, $1;
                annotate_pin $pin, $2 if ! $opt_svg;
        }
 }
 close($pio);
 
+open(my $pio, '-|', 'raspi-gpio funcs '.join(',',@gpio_pins));
+while(<$pio>) {
+       chomp;
+       s/,\s/ /g;
+       if (m/^(\d+)\s+(.*)/) {
+               annotate_pin 'gpio'.$1,"($2)" if $opt_alt;
+       }
+}
+close($pio);
+
 } # have_raspi_gpio