From: Dobrica Pavlinusic Date: Fri, 10 Nov 2017 18:45:32 +0000 (+0100) Subject: all devices don't have hex prefix, e.g. lirc module X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;ds=sidebyside;h=df949b3ca21b452f975b9b093ac233cf669477ee;hp=133e545d48c976381a1ea9042a866d42588b96af;p=linux-gpio-pinout all devices don't have hex prefix, e.g. lirc module --- diff --git a/gpio.pl b/gpio.pl index a681156..429982b 100755 --- a/gpio.pl +++ b/gpio.pl @@ -83,8 +83,9 @@ my $device; open(my $fh, '<', $opt_read . '/sys/kernel/debug/pinctrl/pinctrl-handles'); while(<$fh>) { chomp; - if ( m/device: [0-9a-f]+\.(\w+)/ ) { + if ( m/device: (\S+)/ ) { $device = $1; + $device =~ s/^[0-9a-f]*\.//; # remove hex address } elsif ( m/group: (\w+\d+)\s.+function: (\S+)/ ) { my ($pin, $function) = ($1,$2); $pin_function->{$pin} = "$device $function";