display io and offset for p command
[x300-pci] / gpio.pl
diff --git a/gpio.pl b/gpio.pl
index 5c1c82e..078e63f 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`;
@@ -39,8 +44,10 @@ foreach (@gpio) {
        s/([ \d]{2})(...GPIO.)../$1$2$1/;
        s/(GPIO.)..(...)(\s*\d+)/$1$3$2$3/;
 
-       my $line = substr($_,0,29) . substr($_,39);
-       $line .= shift @pcf || '';
+       my $line = substr($_,0,29) . '  ' . substr($_,39);
+       if ( my $add = shift @pcf ) {
+               $line .= '  ' . $add;
+       }
 
        chomp $line;
        my @l = split(/\|/, $line);