Merge pull request #1057 from Staars/master

BT-support for z28pro
This commit is contained in:
Igor Pečovnik 2018-07-22 16:20:53 +02:00 committed by GitHub
commit 1c4171a958
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 0 deletions

View file

@ -108,5 +108,18 @@ family_tweaks()
echo "ttyFIQ0" >> $SDCARD/etc/securetty
if [[ $BOARD == z28pro ]]; then
echo "fdtfile=rockchip/rk3328-z28pro.dtb" >> $SDCARD/boot/armbianEnv.txt
chroot $SDCARD /bin/bash -c "systemctl --no-reload enable z28pro-bluetooth.service >/dev/null 2>&1"
fi
}
family_tweaks_bsp()
{
if [[ $BOARD == z28pro ]]; then
mkdir -p $destination/usr/local/bin
# Bluetooth
install -m 755 $SRC/packages/bsp/rk3328/z28pro/8822b_hciattach $destination/usr/bin
install -m 755 $SRC/packages/bsp/rk3328/z28pro/start_bt.sh $destination/usr/local/bin
cp $SRC/packages/bsp/rk3328/z28pro/z28pro-bluetooth.service $destination/lib/systemd/system/
fi
}

Binary file not shown.

View file

@ -0,0 +1,26 @@
#!/bin/bash
function die_on_error {
if [ ! $? = 0 ]; then
echo $1
exit 1
fi
}
# Kill any rtk_hciattach actually running.
# Do not complain if we didn't kill anything.
killall -q -SIGTERM 8822b_hciattach
echo "We must stop getty now, You must physically disconnect your USB-UART-Adapter!"
systemctl stop serial-getty@ttyS2 || die_on_error "Could not stop getty"
echo "Using /dev/ttyS2 for Bluetooth"
echo "Power cycle 8822BS BT-section"
rfkill block bluetooth
sleep 2
rfkill unblock bluetooth
echo "Start attaching"
/usr/bin/8822b_hciattach -n -s 115200 /dev/ttyS2 rtk_h5 || die_on_error "Could not create hci0 through rtk_hciattach. Did you remove your USB-UART-Adapter?"

View file

@ -0,0 +1,11 @@
[Unit]
Description=Realtek H5 bluetooth support
Before=bluetooth.service
[Service]
Type=oneshot
ExecStart=/bin/bash /usr/local/bin/start_bt.sh
Restart=no
[Install]
WantedBy=multi-user.target