[gnome-bluetooth/wip/hadess/default-adapter-work: 13/17] contrib: Add script to unbind an adapter from its driver




commit 88290b760c2fb7a32559435d8de3a33d1519963b
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Dec 15 11:08:27 2021 +0100

    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.

 contrib/unbind-bluetooth-driver.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]