lwfinger / rtl8723bs_bt

Bluetooth Code for RTL8723bs
71 stars 35 forks source link

I seem to need a udev rule also to keep bluetooth working - can you review #24

Open sundarnagarajan opened 7 years ago

sundarnagarajan commented 7 years ago

I have a laptop - specifically RDP Thinbook with an Intel Atom X5-Z8300 (Cherry Trail) with a Realtek RTL8723bs chipset that does Wifi and Bluetooth.

Your utility, firmware and systemd startup script work perfectly.

BUT

I find that I need to run the start_bt script every time the Bluetooth interface is brought DOWN. Otherwise, once I turn Bluetooth off, I can never turn it on again, except by rebooting.

I solved the problem by adding a rule in /etc/udev/rules.d that calls a script if SUBSYSTEM=="rfkill" and in this script, I call the start_bt script, but only if the device in question presents itself as the specific platform that needs it.

My udev rule looks like this:

SUBSYSTEM=="rfkill" RUN+="/root/hardware/bluetooth/scripts/bluetooth_udev_rules.sh"

And the script that is called looks like this:

#!/bin/bash

if [ "$RFKILL_TYPE" != "bluetooth" ]; then
    exit 0
fi

EXPECTED_PLATFORM="OBDA8723"
EXPECTED_RFKILL_STATE="0"
PROG=$(basename $0)
BT_START_SCRIPT=/root/hardware/bluetooth/rtl8723bs_bt/start_bt.sh

ACTUAL_PLATFORM=${RFKILL_NAME%:*}

if [ "$ACTUAL_PLATFORM" != "$EXPECTED_PLATFORM" ]; then
  exit 0
fi
if [ "$RFKILL_STATE" != "$EXPECTED_RFKILL_STATE" ]; then
    exit 0
fi
if [ ! -x $BT_START_SCRIPT ]; then
    exit 0
fi

$BT_START_SCRIPT 2>&1 | /usr/bin/logger -t r8723bs_bt_firmware

Have you seen other people complain about this?

Is this the right solution?