Skip to content

Instantly share code, notes, and snippets.

@amuramatsu
Created December 30, 2016 19:01
Show Gist options
  • Save amuramatsu/f813af16a9e079e1c14f3ee696255c16 to your computer and use it in GitHub Desktop.
Save amuramatsu/f813af16a9e079e1c14f3ee696255c16 to your computer and use it in GitHub Desktop.
#! /bin/sh
#
# Shell script to install Bluetooth firmware and attach BT part of
# RTL8723BS
#
RFKILL_BT=`/usr/sbin/rfkill list | awk 'BEGIN{FS=":"} /OBDA8723/{ print $1 }'`
if [ x"$RFKILL_BT" != x"" ]; then
/usr/sbin/rfkill block "$RFKILL_BT"
/usr/sbin/rfkill unblock "$RFKILL_BT"
fi
if [ x"$1" = x"" ]; then
# Find the TTY attached to the BT device
TTYSTRING=`dmesg -t | grep tty | grep MMIO | cut -b 14-18`
TTY=`expr substr "$TTYSTRING" 1 5`
if [ x"$TTYSTRING" = x"" ]; then
echo
echo "No BT TTY device has been found"
echo "Either this computer has no BT device that uses hciattach, or"
echo "Your kernel does not have module 8250_dw configured."
echo "Note: The configuration variable is CONFIG_SERIAL_8250_DW."
echo
exit 1
fi
else
# Use the TTY device mentioned oi the call
TTY="$1"
fi
TTY="/dev/$TTY"
echo "Using device $TTY for Bluetooth"
dirname=`dirname "$0"`
"$dirname/rtk_hciattach" -n -s 115200 $TTY rtk_h5 \
> /var/log/hciattach.txt 2>&1 &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment