summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2021-12-15 11:08:27 +0100
committerBastien Nocera <hadess@hadess.net>2022-01-06 11:11:22 +0100
commita1c66857a471cf6aa8c9def823bbe477485e6b3e (patch)
tree98a8ef3723cce3f78c303d723a000e4dbd4083c7
parent8aaff17d62c7bc4f30e931eb6f1e95bc4156d0ce (diff)
downloadgnome-bluetooth-a1c66857a471cf6aa8c9def823bbe477485e6b3e.tar.gz
contrib: Add script to unbind an adapter from its driver
This makes the Bluetooth drivers not handle the device, while still making sure the USB part of it is available for other purposes, such as virtualisation and gaming.
-rwxr-xr-xcontrib/unbind-bluetooth-driver.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/contrib/unbind-bluetooth-driver.sh b/contrib/unbind-bluetooth-driver.sh
new file mode 100755
index 00000000..fcf02858
--- /dev/null
+++ b/contrib/unbind-bluetooth-driver.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+ADAPTER_TO_DISABLE=${1:-hci0}
+SYSFS_PATH=/sys/class/bluetooth/$ADAPTER_TO_DISABLE
+
+if [ ! -h $SYSFS_PATH ] ; then
+ echo "Could not find adapter $ADAPTER_TO_DISABLE"
+ echo "Usage: $0 [hciX]"
+ exit 1
+fi
+
+USB_DEVICE_PATH=`realpath $SYSFS_PATH/device`
+USB_DEVICE=`basename $USB_DEVICE_PATH`
+echo $USB_DEVICE > $SYSFS_PATH/device/driver/unbind