From 168bd1d1189013b0eea5fa511200d6ba758ad546 Mon Sep 17 00:00:00 2001 From: Sebastian Apel Date: Wed, 13 Jan 2021 11:17:48 +0100 Subject: [PATCH 1/6] bluez5: Add script to collect debug info for bluetooth --- src/tools/gather-bluetooth-debug-info.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 src/tools/gather-bluetooth-debug-info.sh diff --git a/src/tools/gather-bluetooth-debug-info.sh b/src/tools/gather-bluetooth-debug-info.sh new file mode 100755 index 000000000..1570c70a1 --- /dev/null +++ b/src/tools/gather-bluetooth-debug-info.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +LOGNAME=bt-debuginfo-$(date +%Y%m%d-%H%M%S).txt + +echo "-------- cat /proc/versionus" >> /tmp/$LOGNAME +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 + +echo "-------- bluetoothctl devices" >> /tmp/$LOGNAME +bluetoothctl devices >> /tmp/$LOGNAME + +echo "-------- bluetoothctl info" >> /tmp/$LOGNAME +bluetoothctl info >> /tmp/$LOGNAME + +echo "-------- bluetoothctl info" >> /tmp/$LOGNAME +bluetoothctl info >> /tmp/$LOGNAME + +echo "Information on your bluetooth setup collected into /tmp/$LOGNAME" From 5d3a425853e83701a0639e5dac610f34b46c89bd Mon Sep 17 00:00:00 2001 From: Sebastian Apel Date: Wed, 13 Jan 2021 11:27:19 +0100 Subject: [PATCH 2/6] Renamed to begin with "pw-" --- ...-bluetooth-debug-info.sh => pw-gather-bluetooth-debug-info.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/tools/{gather-bluetooth-debug-info.sh => pw-gather-bluetooth-debug-info.sh} (100%) diff --git a/src/tools/gather-bluetooth-debug-info.sh b/src/tools/pw-gather-bluetooth-debug-info.sh similarity index 100% rename from src/tools/gather-bluetooth-debug-info.sh rename to src/tools/pw-gather-bluetooth-debug-info.sh From 100ef0ad2fa60462d9d2d65d08bbe532220aa323 Mon Sep 17 00:00:00 2001 From: Sebastian Apel Date: Wed, 13 Jan 2021 11:52:01 +0100 Subject: [PATCH 3/6] 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 From dbe44acbd3ece5772d426430a482575d83c5df95 Mon Sep 17 00:00:00 2001 From: Sebastian Apel Date: Wed, 13 Jan 2021 11:54:52 +0100 Subject: [PATCH 4/6] Added quotes around filename --- src/tools/pw-gather-bluetooth-debug-info.sh | 25 +++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/tools/pw-gather-bluetooth-debug-info.sh b/src/tools/pw-gather-bluetooth-debug-info.sh index 9000f93cd..14e443638 100755 --- a/src/tools/pw-gather-bluetooth-debug-info.sh +++ b/src/tools/pw-gather-bluetooth-debug-info.sh @@ -2,29 +2,26 @@ LOGNAME=bt-debuginfo-$(date +%Y%m%d-%H%M%S).txt -echo "-------- cat /proc/versionus" >> /tmp/$LOGNAME -cat /proc/version > /tmp/$LOGNAME +echo "-------- cat /proc/versionus" >> "/tmp/$LOGNAME" +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 "-------- lsusb -v 2>&1 | egrep 'bDeviceProtocol(.*)Bluetooth' -B7 | head -1 " >> "/tmp/$LOGNAME" +lsusb -v 2>&1 | egrep 'bDeviceProtocol(.*)Bluetooth' -B7 | head -1 >> "/tmp/$LOGNAME" if [ "$(id -u)" = "0" ]; then - echo "-------- cat /sys/kernel/debug/usb/devices" >> /tmp/$LOGNAME - cat /sys/kernel/debug/usb/devices >> /tmp/$LOGNAME + 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 "-------- 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 +echo "-------- bluetoothctl devices" >> "/tmp/$LOGNAME" +bluetoothctl devices >> "/tmp/$LOGNAME" -echo "-------- bluetoothctl info" >> /tmp/$LOGNAME -bluetoothctl info >> /tmp/$LOGNAME - -echo "-------- bluetoothctl info" >> /tmp/$LOGNAME -bluetoothctl info >> /tmp/$LOGNAME +echo "-------- bluetoothctl info" >> "/tmp/$LOGNAME" +bluetoothctl info >> "/tmp/$LOGNAME" echo "Information on your bluetooth setup collected into /tmp/$LOGNAME" From 1b54a4ab87a2c772c897772df39c8818e02ee120 Mon Sep 17 00:00:00 2001 From: Sebastian Apel Date: Wed, 13 Jan 2021 22:04:46 +0100 Subject: [PATCH 5/6] Bugfix: get bluetoothlctl info to work when more than one device is present Feature: add avinfo and hciconfig information --- src/tools/pw-gather-bluetooth-debug-info.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/tools/pw-gather-bluetooth-debug-info.sh b/src/tools/pw-gather-bluetooth-debug-info.sh index 14e443638..c6df30636 100755 --- a/src/tools/pw-gather-bluetooth-debug-info.sh +++ b/src/tools/pw-gather-bluetooth-debug-info.sh @@ -2,12 +2,19 @@ LOGNAME=bt-debuginfo-$(date +%Y%m%d-%H%M%S).txt -echo "-------- cat /proc/versionus" >> "/tmp/$LOGNAME" +echo "-------- cat /proc/version" >> "/tmp/$LOGNAME" 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 "-------- hciconfig" >> "/tmp/$LOGNAME" +hciconfig >> "/tmp/$LOGNAME" + +echo "-------- hciconfig hci0 features" >> "/tmp/$LOGNAME" +hciconfig hci0 features >> "/tmp/$LOGNAME" + + if [ "$(id -u)" = "0" ]; then echo "-------- cat /sys/kernel/debug/usb/devices" >> "/tmp/$LOGNAME" cat /sys/kernel/debug/usb/devices >> "/tmp/$LOGNAME" @@ -22,6 +29,15 @@ echo "-------- bluetoothctl devices" >> "/tmp/$LOGNAME" bluetoothctl devices >> "/tmp/$LOGNAME" echo "-------- bluetoothctl info" >> "/tmp/$LOGNAME" -bluetoothctl info >> "/tmp/$LOGNAME" +bluetoothctl devices | awk '{ print $2 }' | xargs -n 1 bluetoothctl info >> "/tmp/$LOGNAME" + +# avinfo is not installed on every system +echo "-------- avinfo codec information" >> "/tmp/$LOGNAME" +AVINFO=$(which avinfo) +if [ "$AVINFO" = "" ]; then + echo "avinfo not found - probably not installed on system" >> "/tmp/$LOGNAME" +else + bluetoothctl devices | awk '{ print $2 }' | xargs -n 1 "$AVINFO" +fi echo "Information on your bluetooth setup collected into /tmp/$LOGNAME" From 7fa1c54ac96e8e95364a7679eb4e5ce946d32cdb Mon Sep 17 00:00:00 2001 From: Sebastian Apel Date: Thu, 14 Jan 2021 10:22:04 +0100 Subject: [PATCH 6/6] Fix: Use "btmgmt info" instead of deprecated "hciconfig" --- src/tools/pw-gather-bluetooth-debug-info.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/pw-gather-bluetooth-debug-info.sh b/src/tools/pw-gather-bluetooth-debug-info.sh index c6df30636..e63ffc4dd 100755 --- a/src/tools/pw-gather-bluetooth-debug-info.sh +++ b/src/tools/pw-gather-bluetooth-debug-info.sh @@ -8,8 +8,8 @@ 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 "-------- hciconfig" >> "/tmp/$LOGNAME" -hciconfig >> "/tmp/$LOGNAME" +echo "-------- btmgmt info" >> "/tmp/$LOGNAME" +btmgmt info >> "/tmp/$LOGNAME" echo "-------- hciconfig hci0 features" >> "/tmp/$LOGNAME" hciconfig hci0 features >> "/tmp/$LOGNAME"