added two more possible pins
[x300-pci] / gpio.pl
diff --git a/gpio.pl b/gpio.pl
index 6c653d0..d4d9e3a 100755 (executable)
--- a/gpio.pl
+++ b/gpio.pl
@@ -22,6 +22,11 @@ foreach my $pin_file ( glob 'pins/bcm-*.tsv' ) {
        warn "# $pin_file ",dump($bcm_desc);
 }
 
+sub add_bcm_desc {
+       my ( $pin, $desc ) = @_;
+       $bcm_desc->{$pin} = $desc;
+}
+
 sub pins {
 
 my @pcf = `gpio -x pcf8591:120:0x48 readall`;
@@ -59,20 +64,27 @@ foreach (@gpio) {
                $mode->{ $l[11] } = [ $l[12], $l[13] ] if $l[13];
                #warn "## l = ",dump(@l) if $i > 2 && $i < 5;
        }
-       
+
+
+       $line = join('|', @l);
+       $line .= "|" unless $line =~ m/\+$/;
+
 
        if ( $last[$i] && $line ne $last[$i] ) {
+               $last[$i] = $line; # save before highlight
                foreach my $i ( 0 .. $#l ) {
                        $l[$i] = "\e[33;7;1m$l[$i]\e[0m" if $l[$i] ne $o[$i];
                }
+               $line = join('|', @l);
+               $line .= "|" unless $line =~ m/\+$/;
+       } else {
+               $last[$i] = $line;
        }
 
-       $last[$i] = $line;
+
        $i++;
 
        # re-create from modified data
-       $line = join('|', @l);
-       $line .= "|" unless $line =~ m/\+$/;
        print "$line\n";
 
 }