projects
/
linux-gpio-pinout
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added gpio-ir-tx for IR board from RM Mini 3
[linux-gpio-pinout]
/
gpio.pl
diff --git
a/gpio.pl
b/gpio.pl
index
8c5a532
..
99e1703
100755
(executable)
--- a/
gpio.pl
+++ b/
gpio.pl
@@
-47,10
+47,19
@@
sub slurp {
}
my $pins;
}
my $pins;
+my $include = 0;
my $model = slurp('/proc/device-tree/model');
$model =~ s/\x00$//; # strip kernel NULL
warn "# model [$model]";
my $model = slurp('/proc/device-tree/model');
$model =~ s/\x00$//; # strip kernel NULL
warn "# model [$model]";
+if ( $opt_pins ) {
+ $model = $opt_pins;
+ $model =~ s/^.*\///; # strip dir
+ $model =~ s/\..+$//; # strip extension
+ $include = 1;
+ warn "# $opt_pins model [$model] $include";
+}
+warn "# $opt_pins model [$model] $include";
OPEN_PINS_AGAIN:
open(DATA, '<', $opt_pins) if $opt_pins;
OPEN_PINS_AGAIN:
open(DATA, '<', $opt_pins) if $opt_pins;
@@
-58,17
+67,16
@@
open(DATA, '<', $opt_pins) if $opt_pins;
my @lines;
my $line_i = 0;
my @lines;
my $line_i = 0;
-my $include = 0;
while(<DATA>) {
chomp;
if ( m/^#\s(.+)/ ) {
while(<DATA>) {
chomp;
if ( m/^#\s(.+)/ ) {
- warn "MODEL [$1] == [$model] ?\n";
if ( $model =~ m/$1/ ) {
$include = 1;
} else {
$include = 0;
}
if ( $model =~ m/$1/ ) {
$include = 1;
} else {
$include = 0;
}
- } elsif ( $include || $opt_pins ) {
+ warn "MODEL [$1] == [$model] include: $include\n";
+ } elsif ( $include ) {
push @{ $pins->{$1} }, $line_i while ( m/\t\s*(\w+\d+)/g );
push @lines, $_;
push @{ $pins->{$1} }, $line_i while ( m/\t\s*(\w+\d+)/g );
push @lines, $_;
@@
-224,7
+232,7
@@
open(my $pio, '-|', 'raspi-gpio get');
while(<$pio>) {
chomp;
if ( m/^\s*GPIO (\d+): (.+)/ ) {
while(<$pio>) {
chomp;
if ( m/^\s*GPIO (\d+): (.+)/ ) {
- my $pin = 'gpio' . $1
;
+ my $pin = 'gpio' . $1
* 1; # we need * 1 to strip leading zero
push @gpio_pins, $1;
annotate_pin $pin, $2 if ! $opt_svg;
}
push @gpio_pins, $1;
annotate_pin $pin, $2 if ! $opt_svg;
}