107 lines
2.9 KiB
Bash
107 lines
2.9 KiB
Bash
set -x
|
|
sudo apt-get install libasound2-dev dh-autoreconf libortp-dev bluez bluetooth bluez-tools libbluetooth-dev libusb-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev libsbc1 libsbc-dev libfdk-aac-dev dh-make check
|
|
|
|
USER=Arkq
|
|
PROJECT=bluez-alsa
|
|
LICENSE=mit
|
|
BUILD_HOME=/var/tmp/bluez-alsa-git_build
|
|
VERSION=1.4.0
|
|
|
|
DEBEMAIL="person@company.tld"
|
|
DEBFULLNAME="Testy McTester"
|
|
|
|
# Disable discoverable timeout
|
|
sed -i 's,^\(DiscoverableTimeout =\).*,\1'\"0"',' /etc/default/bluetooth/main.conf
|
|
|
|
mkdir -p ${BUILD_HOME}
|
|
cd ${BUILD_HOME}
|
|
|
|
git clone https://github.com/${USER}/${PROJECT}.git
|
|
|
|
mv bluez-alsa bluez-alsa-git-${VERSION}
|
|
cd bluez-alsa-git-${VERSION}
|
|
pwd
|
|
ls -lh
|
|
|
|
cat <<EOF > .git/gbp.conf
|
|
[DEFAULT]
|
|
# this is the upstream-branch:
|
|
upstream-branch=master
|
|
EOF
|
|
|
|
dh_make \
|
|
--createorig \
|
|
--single \
|
|
--native \
|
|
--copyright ${LICENSE} \
|
|
--packagename ${PROJECT}-git \
|
|
--yes
|
|
BUILD_OPTIONS="--enable-aac --enable-ofono --enable-debug"
|
|
|
|
cat <<EOF > debian/rules
|
|
%:
|
|
dh \$@
|
|
|
|
override_dh_auto_configure:
|
|
dh_auto_configure -- ${BUILD_OPTIONS}
|
|
EOF
|
|
|
|
cat <<EOF > debian/watch
|
|
version=4
|
|
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/${PROJECT}-$1\.tar\.gz/ \
|
|
https://github.com/${USER}/${PROJECT}/tags .*/v?(\d\S+)\.tar\.gz
|
|
EOF
|
|
|
|
pwd
|
|
dpkg-buildpackage -us -uc -b
|
|
sudo dpkg -i ../bluez-alsa-git_1.4.0_amd64.deb
|
|
## When BlueALSA has been created, then you can start BlueALSA as background task:
|
|
#bluealsa --disable-hfp &
|
|
|
|
# Now - for using your bluetooth-speaker/headset - with BlueALSA you have to intoduce the device to the bluetooth-stack using bluetoothctl:
|
|
# bluetoothctl >
|
|
# scan on
|
|
# [NEW] Device 30:23:23:F4:48:2C TH-S10U
|
|
# scan off
|
|
# pair 30:23:23:F4:48:2C
|
|
# trust 30:23:23:F4:48:2C
|
|
# exit
|
|
|
|
# After that power off&on the bt-speaker device and the device will connect automatically as a trusted device.
|
|
|
|
# Before we try our first audio-command we had to export one thing to make BlueALSA mor system-friendly:
|
|
export LIBASOUND_THREAD_SAFE=0
|
|
|
|
# autostart bluealsa
|
|
#cat <<EOF > /etc/rc.local
|
|
## Start bluealsa as root <https://github.com/Arkq/bluez-alsa>
|
|
#export LIBASOUND_THREAD_SAFE=0
|
|
#/usr/bin/bluealsa -S &
|
|
#EOF
|
|
|
|
# Text to speech:
|
|
|
|
# espeak "Hello, how are you?" -w /home/guido/espeak.wav -s145
|
|
# aplay -D bluealsa:HCI=hci0,DEV=30:23:23:F4:48:2C,PROFILE=a2dp /home/guido/espeak.wav
|
|
|
|
# Internetradio:
|
|
|
|
# mpg123 -a bluealsa:HCI=hci0,DEV=30:23:23:F4:48:2C,PROFILE=a2dp -@ /home/guido/ffh80s.pls
|
|
|
|
# For shorting the command you could create a ~/.asoundrc with the following content:
|
|
|
|
# defaults.bluealsa.interface "hci0"
|
|
# defaults.bluealsa.device "30:23:23:F4:48:2C"
|
|
# defaults.bluealsa.profile "a2dp"
|
|
# defaults.bluealsa.delay 10000
|
|
|
|
# Now you can the shorter version of the command:
|
|
|
|
# mpg123 -a bluealsa -@ /home/guido/ffh80s.pls
|
|
|
|
# For set the volume of such a device you have to know the "real" name of the device out of the bluetoothctl and the name of the used protocol:
|
|
|
|
# Device: 30:23:23:F4:48:2C TH-S10U
|
|
# Protocol: A2DP
|
|
# amixer -D bluealsa sset 'TH-S10U - A2DP ' 70%
|