From 100ef0ad2fa60462d9d2d65d08bbe532220aa323 Mon Sep 17 00:00:00 2001 From: Sebastian Apel Date: Wed, 13 Jan 2021 11:52:01 +0100 Subject: [PATCH] Replaced sudo by check if root plus warning/note to user --- src/tools/pw-gather-bluetooth-debug-info.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/tools/pw-gather-bluetooth-debug-info.sh b/src/tools/pw-gather-bluetooth-debug-info.sh index 1570c70a1..9000f93cd 100755 --- a/src/tools/pw-gather-bluetooth-debug-info.sh +++ b/src/tools/pw-gather-bluetooth-debug-info.sh @@ -8,8 +8,15 @@ cat /proc/version > /tmp/$LOGNAME echo "-------- lsusb -v 2>&1 | egrep 'bDeviceProtocol(.*)Bluetooth' -B7 | head -1 " >> /tmp/$LOGNAME lsusb -v 2>&1 | egrep 'bDeviceProtocol(.*)Bluetooth' -B7 | head -1 >> /tmp/$LOGNAME -echo "-------- cat /sys/kernel/debug/usb/devices" >> /tmp/$LOGNAME -sudo cat /sys/kernel/debug/usb/devices >> /tmp/$LOGNAME +if [ "$(id -u)" = "0" ]; then + echo "-------- cat /sys/kernel/debug/usb/devices" >> /tmp/$LOGNAME + cat /sys/kernel/debug/usb/devices >> /tmp/$LOGNAME +else + echo "-------- cat /sys/kernel/debug/usb/devices skipped" >> /tmp/$LOGNAME + echo "WARNING: Skipping the collection of kernel usb debug info (can only be accessed as root)" + echo " To include kernel usb debug info, re-run the script as root/via sudo" + echo " " +fi echo "-------- bluetoothctl devices" >> /tmp/$LOGNAME bluetoothctl devices >> /tmp/$LOGNAME