diff -Nru pi-bluetooth-0.1.10ubuntu6/debian/changelog pi-bluetooth-0.1.15ubuntu2~20.04.1/debian/changelog --- pi-bluetooth-0.1.10ubuntu6/debian/changelog 2019-04-15 10:48:28.000000000 -0500 +++ pi-bluetooth-0.1.15ubuntu2~20.04.1/debian/changelog 2021-04-27 18:27:36.000000000 -0500 @@ -1,3 +1,59 @@ +pi-bluetooth (0.1.15ubuntu2~20.04.1) focal; urgency=medium + + * SRU pi-bluetooth from hirsute to focal. This fixes bluetooth issues on + the Raspberry Pi 4, 400, and CM4. (LP: #1926378) + + -- William 'jawn-smith' Wilson Tue, 27 Apr 2021 18:27:36 -0500 + +pi-bluetooth (0.1.15ubuntu2) hirsute; urgency=medium + + * Merged upstream fixes for CM4 and Pi 400 (LP: #1921915) + + -- Dave Jones Tue, 30 Mar 2021 15:35:28 +0100 + +pi-bluetooth (0.1.15ubuntu1) groovy; urgency=medium + + * Merged new upstream version (LP: #1897920) + + -- Dave Jones Thu, 15 Oct 2020 01:29:19 +0100 + +pi-bluetooth (0.1.15) buster; urgency=medium + + [ Phil Elwell ] + * bthelper: Change BT address with hcitool instead + * bthelper: FIX: Only run for onboard BT modems + + + -- Serge Schneider Wed, 19 Aug 2020 15:45:46 +0100 + +pi-bluetooth (0.1.14) buster; urgency=medium + + [ Phil Elwell ] + * bthelper: Add the ability to set the Pi BDADDR + + -- Serge Schneider Wed, 29 Jul 2020 09:24:14 +0100 + +pi-bluetooth (0.1.13) buster; urgency=medium + + [ Phil Elwell ] + * bthelper: Force reinitialisation to allow Secure Simple Pairing + + -- Serge Schneider Tue, 26 May 2020 07:13:54 +0100 + +pi-bluetooth (0.1.12) buster; urgency=medium + + [ Phil Elwell ] + * bthelper: Recognise Pi 4 OUI (#10) + + -- Serge Schneider Tue, 05 Nov 2019 13:00:15 +0000 + +pi-bluetooth (0.1.11) buster; urgency=medium + + * Don't override the BT address on Pi 4 + * Update control file for Buster + + -- Serge Schneider Tue, 18 Jun 2019 12:04:46 +0100 + pi-bluetooth (0.1.10ubuntu6) disco; urgency=medium * d/control: switch from arch: all to arch: armhf arm64 since even though diff -Nru pi-bluetooth-0.1.10ubuntu6/debian/control pi-bluetooth-0.1.15ubuntu2~20.04.1/debian/control --- pi-bluetooth-0.1.10ubuntu6/debian/control 2019-04-15 10:48:21.000000000 -0500 +++ pi-bluetooth-0.1.15ubuntu2~20.04.1/debian/control 2020-10-14 18:51:57.000000000 -0500 @@ -2,12 +2,15 @@ Section: multiverse/misc Priority: optional Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Serge Schneider Build-Depends: debhelper (>= 10) -Standards-Version: 3.9.7 +Standards-Version: 4.3.0 Homepage: https://github.com/RPi-Distro/pi-bluetooth Package: pi-bluetooth Architecture: armhf arm64 -Depends: ${shlibs:Depends}, ${misc:Depends}, bluez, linux-firmware-raspi2 (>= 1.20190215-0ubuntu2) +Depends: ${shlibs:Depends}, ${misc:Depends}, + bluez (>= 5.50-1.2~deb10u1+rpt1), + linux-firmware-raspi2 (>= 1.20190215-0ubuntu2) Description: Raspberry Pi 3 bluetooth Loads BCM43430A1 firmware on boot diff -Nru pi-bluetooth-0.1.10ubuntu6/debian/pi-bluetooth.bthelper@.service pi-bluetooth-0.1.15ubuntu2~20.04.1/debian/pi-bluetooth.bthelper@.service --- pi-bluetooth-0.1.10ubuntu6/debian/pi-bluetooth.bthelper@.service 2019-04-11 06:20:37.000000000 -0500 +++ pi-bluetooth-0.1.15ubuntu2~20.04.1/debian/pi-bluetooth.bthelper@.service 2021-03-30 09:34:52.000000000 -0500 @@ -4,5 +4,6 @@ After=bluetooth.service [Service] -Type=simple +Type=oneshot ExecStart=/usr/bin/bthelper %I +RemainAfterExit=yes diff -Nru pi-bluetooth-0.1.10ubuntu6/debian/rules pi-bluetooth-0.1.15ubuntu2~20.04.1/debian/rules --- pi-bluetooth-0.1.10ubuntu6/debian/rules 2019-04-12 10:50:08.000000000 -0500 +++ pi-bluetooth-0.1.15ubuntu2~20.04.1/debian/rules 2020-10-14 19:29:19.000000000 -0500 @@ -3,7 +3,7 @@ DPKG_EXPORT_BUILDFLAGS = 1 %: - dh $@ --with systemd + dh $@ override_dh_systemd_enable: dh_systemd_enable --name=hciuart diff -Nru pi-bluetooth-0.1.10ubuntu6/lib/udev/rules.d/90-pi-bluetooth.rules pi-bluetooth-0.1.15ubuntu2~20.04.1/lib/udev/rules.d/90-pi-bluetooth.rules --- pi-bluetooth-0.1.10ubuntu6/lib/udev/rules.d/90-pi-bluetooth.rules 2019-04-11 06:29:14.000000000 -0500 +++ pi-bluetooth-0.1.15ubuntu2~20.04.1/lib/udev/rules.d/90-pi-bluetooth.rules 2020-10-14 18:58:48.000000000 -0500 @@ -2,7 +2,7 @@ # logic below deals with the different serial UARTs on different models of Pi # and ensures that /dev/serial1 (which hciuart.service relies upon) points to # the correct UART device -KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\ +KERNEL=="ttyAMA0", PROGRAM="/bin/sh -c '\ ALIASES=/proc/device-tree/aliases; \ if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \ echo 0;\ @@ -13,8 +13,24 @@ fi\ '", SYMLINK+="serial%c" +KERNEL=="ttyAMA1", PROGRAM="/bin/sh -c '\ + ALIASES=/proc/device-tree/aliases; \ + if [ -e /dev/ttyAMA0 ]; then \ + exit 1; \ + elif cmp -s $ALIASES/uart0 $ALIASES/serial0; then \ + echo 0;\ + elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \ + echo 1; \ + else \ + exit 1; \ + fi\ +'", SYMLINK+="serial%c" + KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\ - ALIASES=/proc/device-tree/aliases; \ if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \ echo 0; \ elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \ + ALIASES=/proc/device-tree/aliases; \ + if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \ + echo 0; \ + elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \ echo 1; \ else \ exit 1; \ diff -Nru pi-bluetooth-0.1.10ubuntu6/usr/bin/bthelper pi-bluetooth-0.1.15ubuntu2~20.04.1/usr/bin/bthelper --- pi-bluetooth-0.1.10ubuntu6/usr/bin/bthelper 2019-04-11 06:20:37.000000000 -0500 +++ pi-bluetooth-0.1.15ubuntu2~20.04.1/usr/bin/bthelper 2021-03-30 09:34:52.000000000 -0500 @@ -1,16 +1,40 @@ #!/bin/sh -# For on-board BT, route SCO packets to the HCI interface (enables HFP/HSP) +# For on-board BT, configure the BDADDR if necessary and route SCO packets +# to the HCI interface (enables HFP/HSP) set -e if [ "$#" -ne 1 ]; then - echo "Usage: $0 " - exit 0 + echo "Usage: $0 " + exit 0 fi -dev="$1" +dev=$1 + # Need to bring hci up before looking at MAC as it can be all zeros during init -/bin/hciconfig "$dev" up -/bin/hciconfig "$dev" |grep -q "BD Address: B8:27:EB:" || exit 0 -/usr/bin/hcitool -i "$dev" cmd 0x3f 0x1c 0x01 0x02 0x00 0x01 0x01 > /dev/null +/bin/hciconfig $dev up +if ! /bin/hciconfig $dev | grep -q "Bus: UART"; then + echo Not a UART-attached BT Modem + exit 0 +fi + +if ( /usr/bin/hcitool -i $dev dev | grep -q -E '\s43:4[35]:' ); then + SERIAL=`cat /proc/device-tree/serial-number | cut -c9-` + B1=`echo $SERIAL | cut -c3-4` + B2=`echo $SERIAL | cut -c5-6` + B3=`echo $SERIAL | cut -c7-8` + BDADDR=`printf '0x%02x 0x%02x 0x%02x 0xeb 0x27 0xb8' $((0x$B3 ^ 0xaa)) $((0x$B2 ^ 0xaa)) $((0x$B1 ^ 0xaa))` + + /usr/bin/hcitool -i $dev cmd 0x3f 0x001 $BDADDR + /bin/hciconfig $dev reset +else + echo Raspberry Pi BDADDR already set +fi + +# Force reinitialisation to allow extra features such as Secure Simple Pairing +# to be enabled +/usr/bin/bluetoothctl power off +/usr/bin/bluetoothctl power on +# Route SCO packets to the HCI interface (enables HFP/HSP) +/usr/bin/hcitool -i $dev cmd 0x3f 0x1c 0x01 0x02 0x00 0x01 0x01 > /dev/null diff -Nru pi-bluetooth-0.1.10ubuntu6/usr/bin/btuart pi-bluetooth-0.1.15ubuntu2~20.04.1/usr/bin/btuart --- pi-bluetooth-0.1.10ubuntu6/usr/bin/btuart 2019-04-11 06:20:37.000000000 -0500 +++ pi-bluetooth-0.1.15ubuntu2~20.04.1/usr/bin/btuart 2021-03-30 09:34:52.000000000 -0500 @@ -1,11 +1,20 @@ #!/bin/sh HCIATTACH=/usr/bin/hciattach -SERIAL=`cat /proc/device-tree/serial-number | cut -c9-` -B1=`echo $SERIAL | cut -c3-4` -B2=`echo $SERIAL | cut -c5-6` -B3=`echo $SERIAL | cut -c7-8` -BDADDR=`printf b8:27:eb:%02x:%02x:%02x $((0x$B1 ^ 0xaa)) $((0x$B2 ^ 0xaa)) $((0x$B3 ^ 0xaa))` +if grep -q "raspberrypi,4" /proc/device-tree/compatible; then + BDADDR= +else + SERIAL=`cat /proc/device-tree/serial-number | cut -c9-` + B1=`echo $SERIAL | cut -c3-4` + B2=`echo $SERIAL | cut -c5-6` + B3=`echo $SERIAL | cut -c7-8` + BDADDR=`printf b8:27:eb:%02x:%02x:%02x $((0x$B1 ^ 0xaa)) $((0x$B2 ^ 0xaa)) $((0x$B3 ^ 0xaa))` +fi + +if ( /usr/bin/hcitool dev | grep -q -E '\s(B8:27:EB:|DC:A6:32:)' ); then + # On-board bluetooth is already enabled + exit 0 +fi uart0="`cat /proc/device-tree/aliases/uart0`" serial1="`cat /proc/device-tree/aliases/serial1`"