Felix Singer has submitted this change. ( https://review.coreboot.org/c/coreboot/+/85790?usp=email )
(
3 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: util/find_usbdebug: Fix lsusb -t parsing for usbutils v016 and newer ......................................................................
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] https://github.com/gregkh/usbutils/commit/e24294ff9ade6dafcd1909763e888d97b3...
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 --- M util/find_usbdebug/find_usbdebug.sh 1 file changed, 9 insertions(+), 2 deletions(-)
Approvals: Angel Pons: Looks good to me, approved Jan Philipp Groß: Looks good to me, but someone else must approve build bot (Jenkins): Verified
diff --git a/util/find_usbdebug/find_usbdebug.sh b/util/find_usbdebug/find_usbdebug.sh index 7c893c9..4606080 100755 --- a/util/find_usbdebug/find_usbdebug.sh +++ b/util/find_usbdebug/find_usbdebug.sh @@ -45,8 +45,15 @@ 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