strip leading zero from raspi-gpio pin numbers
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 6 Jun 2018 09:19:57 +0000 (11:19 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 6 Jun 2018 09:19:57 +0000 (11:19 +0200)
gpio.pl

diff --git a/gpio.pl b/gpio.pl
index 0e75092..99e1703 100755 (executable)
--- a/gpio.pl
+++ b/gpio.pl
@@ -232,7 +232,7 @@ open(my $pio, '-|', 'raspi-gpio get');
 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;
        }