Skip to content

Commit 9eabb4c

Browse files
committed
Simplify search for the motorpath
use "*motor" instead of multiple tacho-motor dc-motor etc.
1 parent 12034b2 commit 9eabb4c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

showmotor

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
# 20140911 BL adapt to changes at kernel 3.16.1-2
1919
# 20140826 BL Add script header
2020
# 20150105 BL Add servo-motor
21+
# 20150115 BL Simplify search for the motorpath
2122
#============================================================================
2223
#
2324
#
@@ -30,9 +31,10 @@
3031
# /sys/class/tacho-motor/motor*/port_name is the link between motor# and port
3132
#
3233
#
33-
IFS=$' \n' read -a tachoPath <<< "`echo /sys/class/tacho-motor/motor*/ /sys/class/dc-motor/motor*/ /sys/class/servo-motor/motor*/`"
34+
# IFS=$' \n' read -a tachoPath <<< "`echo /sys/class/tacho-motor/motor*/ /sys/class/dc-motor/motor*/ /sys/class/servo-motor/motor*/`"
35+
IFS=$' \n' read -a tachoPath <<< "`echo /sys/class/*motor/motor*/`"
3436
#
35-
for i in ${!tachoPath[@]} # ! walk the index
37+
for i in ${!tachoPath[@]} # ! walk the index
3638
do
3739
echo -e "process $i ${tachoPath[$i]}"
3840
if [ -e ${tachoPath[$i]} ]; then

0 commit comments

Comments
 (0)