util/find_usbdebug: Fix lsusb -t parsing for usbutils v016 and newer
Commit e24294ff9ade ("lsusb -t: print ports and busses and devices with
same width") [1] in the usbutils repository changed the format of the
lsusb -t output, breaking the find_usbdebug.sh script. This commit is
present in usbutils version 016 and later.
Use the output of lsusb -V to set the parsing patterns based on the
version in order to maintain compatibility with older versions of
usbutils. A simple integer comparison of the version number is used for
this, which will not work with versions older than v001 as those use a
0.nn version number format. However, since v001 was released in late
2010, it is probably safe to assume that no one will be using a version
of usbutils older than that. Usbutils v016 was released in late 2023 so
there could still conceivably be systems using older versions, such as
Ubuntu 22.04 LTS which is on v014.
TEST=find_usbdebug.sh works as expected with both lsusb v015 and v017
[1] e24294ff9a
Change-Id: Iffa1238b995d387d6e51459f85ae96da52a5c0ff
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/85790
Reviewed-by: Jan Philipp Groß <jeangrande@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
parent
4ff7a4a5a0
commit
94247e93a2
1 changed files with 9 additions and 2 deletions
|
|
@ -45,8 +45,15 @@ dmesgfile=$1
|
|||
find_devs_in_tree () {
|
||||
bus=$1
|
||||
port=$2
|
||||
busstr=`printf "Bus %02d" "$bus"`
|
||||
portstr="Port $port"
|
||||
|
||||
# lsusb -t uses 3 digits for bus/port nunmbers as of version 016 and later
|
||||
if [ $(lsusb -V | cut -f 3 -d " ") -lt 16 ]; then
|
||||
busstr=`printf "Bus %02d" "$bus"`
|
||||
portstr="Port $port"
|
||||
else
|
||||
busstr=`printf "Bus %03d" "$bus"`
|
||||
portstr=`printf "Port %03d" "$port"`
|
||||
fi
|
||||
|
||||
hubs_to_ignore="8087:0020 8087:0024 8087:8000 8087:8008"
|
||||
reqlvl=1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue