added PocketChip pins
[linux-gpio-pinout] / gpio.pl
diff --git a/gpio.pl b/gpio.pl
index 1d3047e..8c5a532 100755 (executable)
--- a/gpio.pl
+++ b/gpio.pl
@@ -83,6 +83,7 @@ if ( ! $opt_pins && ! $pins ) {
        my $glob = $model;
        $glob =~ s/^(\w+).*$/$1/;
        my @pins = glob "pins/${glob}*";
+       die "pins/${glob} NOT FOUND for this board, please create one and contribute" unless @pins;
        warn "# possible pins: ",dump( \@pins );
        $opt_pins = $pins[0];
        goto OPEN_PINS_AGAIN;
@@ -217,16 +218,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+): (.+)/ ) {
+       if ( m/^\s*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