@@ -48,7 +48,7 @@ parse () {
48
48
49
49
# Get the bus number. It's the first two hex digits of the Location ID.
50
50
# We'll convert to decimal later
51
- bus_num=` echo " $location " | sed -e ' s/^..\(..\).*/\1/;' `
51
+ bus_num=` echo " $location " | sed -e ' s/^..\(..\).*/\1/;' `
52
52
53
53
# Get the device number. It's after the '/' in the Location ID, already decimal.
54
54
device_num=` echo " $location " | awk -F' /' ' {print $2}' `
@@ -110,7 +110,7 @@ parse () {
110
110
# Filter by VID/PID if given as input argument.
111
111
if [ -n " $vid_pid " ]; then
112
112
# Convert input vid to lower case.
113
- if [ -n " $( echo " $vid_pid " | egrep ' :' ) " ]; then
113
+ if [ -n " $( echo " $vid_pid " | egrep ' :' ) " ]; then
114
114
arg_vid=` echo " $vid_pid " | awk -F' :' ' {print $1}' | sed ' s/^0x//' | tr ' [A-Z]' ' [a-z]' `
115
115
if [ -n " $arg_vid " ]; then
116
116
if [ $(( 16 #$arg_vid )) -ne $(( 16 #$VID )) ]; then
@@ -125,14 +125,14 @@ parse () {
125
125
fi
126
126
else
127
127
# Missing a colon is a syntax error in -d option
128
- help
128
+ help
129
129
exit 1
130
130
fi
131
131
fi
132
132
133
133
# Filter by BUS/DEV if given as input argument.
134
134
if [ -n " $bus_dev " ]; then
135
- if [ -n " $( echo " $bus_dev " | egrep ' :' ) " ]; then
135
+ if [ -n " $( echo " $bus_dev " | egrep ' :' ) " ]; then
136
136
# Convert input bus to lower case
137
137
arg_bus=` echo " $bus_dev " | awk -F' :' ' {print $1}' | sed ' s/^ *//; s/ *$//' `
138
138
if [ -n " $arg_bus " ]; then
@@ -150,7 +150,7 @@ parse () {
150
150
fi
151
151
fi
152
152
# Special case: no colon after -s means device-only.
153
- if [ -z " $( echo " $bus_dev " | egrep ' :' ) " ]; then
153
+ if [ -z " $( echo " $bus_dev " | egrep ' :' ) " ]; then
154
154
# Strip leading and trailing spaces from argument.
155
155
arg_dev=` echo " $bus_dev " | sed ' s/^ *//; s/ *$//' `
156
156
if [ -n " $arg_dev " ]; then
@@ -193,7 +193,7 @@ buildtreeline () {
193
193
# bb -- bus number in hexadecimal
194
194
# dddddd -- up to six levels for the tree, each digit represents its
195
195
# position on that level
196
- #
196
+ #
197
197
# So we start each line with the LocationID for sorting purposes, then append the rest of the line as we want it
198
198
# Later, we'll do the sort, then strip off the LocationID for display purposes
199
199
@@ -229,9 +229,9 @@ tree () {
229
229
treedata=" ${treedata} " " ${treeline} " $' \n '
230
230
done
231
231
232
- # Strip off final \n.
232
+ # Strip off final \n.
233
233
treedata=` echo " ${treedata} " | awk ' { prev_line = line; line = $0; } NR > 1 { print prev_line; } END { ORS = ""; print line; }' `
234
-
234
+
235
235
# Sort by Location ID.
236
236
treedata=` echo " ${treedata} " | sort`
237
237
@@ -245,7 +245,7 @@ tree () {
245
245
cleanup
246
246
247
247
# Not really needed, as cleanup routine does the exit.
248
- exit 0
248
+ exit 0
249
249
}
250
250
251
251
# Parse options
0 commit comments