From 922d2845d6cd1513e12ef25efa85e88dbd67a98b Mon Sep 17 00:00:00 2001 From: Nicholas Chin Date: Sun, 29 Dec 2024 13:30:49 -0700 Subject: [PATCH] util/find_usbdebug: Check for lsusb and lspci Add a check to make sure lsusb and lspci are installed, as the script relies on them to function properly. Previously, if lsusb was not installed, the script proceeded as if nothing was wrong, but never found any devices plugged into the debug port. If lspci was not found, the script exited saying that no EHCI debug capable controller was found. The "command not found" messages that normally would have been shown in these situations was not being shown, as stderr is redirected to /dev/null to hide error messages that don't matter as per the comment near the top of the script. Change-Id: Ib56a20aab9552aa6321c2fb9ad0d2ca7d6cd00c7 Signed-off-by: Nicholas Chin Reviewed-on: https://review.coreboot.org/c/coreboot/+/85796 Tested-by: build bot (Jenkins) Reviewed-by: Riku Viitanen Reviewed-by: Elyes Haouas Reviewed-by: Felix Singer --- util/find_usbdebug/find_usbdebug.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/util/find_usbdebug/find_usbdebug.sh b/util/find_usbdebug/find_usbdebug.sh index de370b1fe8..7c893c96a4 100755 --- a/util/find_usbdebug/find_usbdebug.sh +++ b/util/find_usbdebug/find_usbdebug.sh @@ -27,6 +27,19 @@ if [ "$uid" -ne 0 ]; then echo "Must be run as root. Exiting." exit 1 fi + +if ! command -v lsusb; then + echo "lsusb not found. Please install \"usbutils\" from your +distribution's package manager. Exiting." + exit 1 +fi + +if ! command -v lspci; then + echo "lspci not found. Please install \"pciutils\" from your +distribution's package manager. Exiting." + exit 1 +fi + dmesgfile=$1 find_devs_in_tree () {