Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bluetooth support for RuneAudio on the Raspberry Pi 3
# Set bluetooth power up
ACTION=="add", SUBSYSTEM=="bluetooth", KERNEL=="hci[0-9]*", RUN+="/bin/hciconfig %k up"
# arg 1: the new package version
post_install() {
echo "Enabling the rpi hci-uart service..."
systemctl enable pi-bluetooth.hciuart.service
}
# arg 1: the old package version
pre_remove() {
systemctl disable pi-bluetooth.hciuart.service
}
# Maintainer: SimonDechain <mobius.delkron@gmail.com>
pkgname=pi-bluetooth
pkgver=0.1.0
pkgrel=1
pkgdesc="HCI service for the raspberry pi 3 bluetooth module"
arch=('any')
#url="https://www.gnu.org/software/patch/patch.html"
license=('BSD')
makedepends=('systemd')
source=("http://archive.raspberrypi.org/debian/pool/main/p/pi-bluetooth/${pkgname}_${pkgver}.tar.xz"
https://gist.githubusercontent.com/laszloh/3c25466ebf2935f5cfce2d1a6e62e7f6/raw/4952f792e01bd6f1ab732734b56e254e8ce36d54/50-bluetooth-hci-auto-poweron.rules
https://gist.githubusercontent.com/laszloh/3c25466ebf2935f5cfce2d1a6e62e7f6/raw/4952f792e01bd6f1ab732734b56e254e8ce36d54/pi-bluetooth.install
)
sha256sums=('2a705d89b177c57c56145516ac94b728148355a9bddfaced102a73b642703060'
'bfe71a9ae871d6cab7426bd0713b04d30eb05d8255ae69706e2d09e541895c4c'
'52b6f1f4e8dd22f3528f9b0b8e59fd08aa4266e6d05b4a93ecd3c0c7b716a436')
install=${pkgname}.install
package() {
cd "$srcdir/$pkgname/debian"
# install the BSD license
install -Dm644 ./copyright "${pkgdir}/usr/share/licenses/${pkgname}/COPYING" || return 1
# and now the service
install -m755 -d ${pkgdir}/usr/lib/systemd/system || return 1
install -m644 ./pi-bluetooth.hciuart.service ${pkgdir}/usr/lib/systemd/system || return 1
# and the udev rule
install -m755 -d ${pkgdir}/usr/lib/udev/rules.d || return 1
install -m644 ${srcdir}/50-bluetooth-hci-auto-poweron.rules ${pkgdir}/usr/lib/udev/rules.d || return 1
}
# Maintainer: Tom Gundersen <teg@jklm.no>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Geoffroy Carrier <geoffroy@archlinux.org>
#
# !!MODIFIED by SimonDechain !!
#
pkgbase=bluez
pkgname=('bluez' 'bluez-utils' 'bluez-libs' 'bluez-cups' 'bluez-hid2hci' 'bluez-plugins')
pkgver=5.39
pkgrel=1
url="http://www.bluez.org/"
arch=('i686' 'x86_64' 'armv6h' 'armv7h')
license=('GPL2')
makedepends=('dbus' 'libical' 'systemd')
source=(http://www.kernel.org/pub/linux/bluetooth/${pkgname}-${pkgver}.tar.xz
bluetooth.modprobe::https://projects.archlinux.org/svntogit/packages.git/plain/trunk/bluetooth.modprobe?h=packages/bluez
https://gist.githubusercontent.com/pelwell/c8230c48ea24698527cd/raw/3b07a1eb296862da889609a84f8e10b299b7442d/0001-bcm43xx-Add-bcm43xx-3wire-variant.patch
https://gist.githubusercontent.com/pelwell/c8230c48ea24698527cd/raw/3b07a1eb296862da889609a84f8e10b299b7442d/0002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch
https://gist.githubusercontent.com/pelwell/c8230c48ea24698527cd/raw/3b07a1eb296862da889609a84f8e10b299b7442d/0003-Increase-firmware-load-timeout-to-30s.patch
https://gist.githubusercontent.com/pelwell/c8230c48ea24698527cd/raw/3b07a1eb296862da889609a84f8e10b299b7442d/0004-Move-the-43xx-firmware-into-lib-firmware.patch
)
prepare() {
cd $pkgname-$pkgver
patch -Np1 <${startdir}/0001-bcm43xx-Add-bcm43xx-3wire-variant.patch
patch -Np1 <${startdir}/0002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch
patch -Np1 <${startdir}/0003-Increase-firmware-load-timeout-to-30s.patch
patch -Np1 <${startdir}/0004-Move-the-43xx-firmware-into-lib-firmware.patch
# autoreconf -vfi
}
build() {
cd ${pkgname}-${pkgver}
./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--sysconfdir=/etc \
--localstatedir=/var \
--libexecdir=/usr/lib \
--enable-sixaxis \
--enable-experimental \
--enable-library # this is deprecated
make
}
check() {
cd $pkgname-$pkgver
make check
}
package_bluez() {
pkgdesc="Daemons for the bluetooth protocol stack"
depends=('libical' 'dbus' 'glib2')
backup=('etc/dbus-1/system.d/bluetooth.conf'
'etc/bluetooth/main.conf')
conflicts=('obexd-client' 'obexd-server')
cd ${pkgbase}-${pkgver}
make DESTDIR=${pkgdir} \
install-libexecPROGRAMS \
install-dbussessionbusDATA \
install-systemdsystemunitDATA \
install-systemduserunitDATA \
install-dbussystembusDATA \
install-dbusDATA \
install-man8
# ship upstream main config file
install -dm755 ${pkgdir}/etc/bluetooth
install -Dm644 ${srcdir}/${pkgbase}-${pkgver}/src/main.conf ${pkgdir}/etc/bluetooth/main.conf
# add basic documention
install -dm755 ${pkgdir}/usr/share/doc/${pkgbase}/dbus-apis
cp -a doc/*.txt ${pkgdir}/usr/share/doc/${pkgbase}/dbus-apis/
# fix module loading errors
install -dm755 ${pkgdir}/usr/lib/modprobe.d
install -Dm644 ${srcdir}/bluetooth.modprobe ${pkgdir}/usr/lib/modprobe.d/bluetooth-usb.conf
# fix obex file transfer - https://bugs.archlinux.org/task/45816
ln -fs /usr/lib/systemd/user/obex.service ${pkgdir}/usr/lib/systemd/user/dbus-org.bluez.obex.service
}
package_bluez-utils() {
pkgdesc="Development and debugging utilities for the bluetooth protocol stack"
depends=('dbus' 'systemd' 'glib2')
conflicts=('bluez-hcidump')
provides=('bluez-hcidump')
replaces=('bluez-hcidump' 'bluez<=4.101')
cd ${pkgbase}-${pkgver}
make DESTDIR=${pkgdir} \
install-binPROGRAMS \
install-man1
# add missing tools FS#41132, FS#41687, FS#42716
for files in `find tools/ -type f -perm -755`; do
filename=$(basename $files)
install -Dm755 ${srcdir}/${pkgbase}-${pkgver}/tools/$filename ${pkgdir}/usr/bin/$filename
done
# add gatttool usefulbdaddr with Bluetooth 4.0LE
install -Dm755 ${srcdir}/${pkgbase}-${pkgver}/attrib/gatttool ${pkgdir}/usr/bin/gatttool
# libbluetooth.so* are part of libLTLIBRARIES and binPROGRAMS targets
#make DESTDIR=${pkgdir} uninstall-libLTLIBRARIES
#rmdir ${pkgdir}/usr/lib
rm -rf ${pkgdir}/usr/lib
# move the hid2hci man page out
mv ${pkgdir}/usr/share/man/man1/hid2hci.1 ${srcdir}/
}
package_bluez-libs() {
pkgdesc="Deprecated libraries for the bluetooth protocol stack"
depends=('glibc')
license=('LGPL2.1')
cd ${pkgbase}-${pkgver}
make DESTDIR=${pkgdir} \
install-includeHEADERS \
install-libLTLIBRARIES \
install-pkgconfigDATA
}
package_bluez-cups() {
pkgdesc="CUPS printer backend for Bluetooth printers"
depends=('cups')
cd ${pkgbase}-${pkgver}
make DESTDIR=${pkgdir} install-cupsPROGRAMS
}
package_bluez-hid2hci() {
pkgdesc="Put HID proxying bluetooth HCI's into HCI mode"
depends=('systemd')
cd ${pkgbase}-${pkgver}
make DESTDIR=${pkgdir} \
install-udevPROGRAMS \
install-rulesDATA
install -dm755 ${pkgdir}/usr/share/man/man1
mv ${srcdir}/hid2hci.1 ${pkgdir}/usr/share/man/man1/hid2hci.1
}
package_bluez-plugins() {
pkgdesc="bluez plugins (PS3 Sixaxis controller)"
depends=('systemd')
cd ${pkgbase}-${pkgver}
make DESTDIR=${pkgdir} \
install-pluginLTLIBRARIES
}
sha256sums=('21d1bc9150d3576296595217efb98a746b592389d25d5637e8bee5da7272593b'
'SKIP'
'cc6a60cb5789c1d9f878cb2821757be6bd802fbebe5933e64f9e67fb43f78896'
'24bbfacdffe0b5c63b77d8d213719ba59de8939b06cef513ae89b4b82bcb83a7'
'90d34de9263ca1064544eeab16d217d459b0f85574ad0b40017f4f663d6b0b78'
'f7837a573307fae46b093a3f4eee6a89435109c47b8a1cea80f98ef5c33d1c64')
@pstout7

This comment has been minimized.

Copy link

pstout7 commented Oct 3, 2017

Hi laszloh,
I am a total noob with this type of stuff, but I want to enable bluetooth to work with my RPi3 running rune audio. I would really appreciate any help that you could provide. How do I use this code? I have SSH running with my RPi but dont know how to put this all in.
Thanks,
Perry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment