-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- a2dp as bluetooth speaker - disable discovery while connected - bt-agent service accepts connections without authorization - OSMC and Dietpi clients
- Loading branch information
Showing
6 changed files
with
59 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ HOME_ASSISTANT_CONFIG := ~/network/home-assistant/config | |
DEV_SYSTEMD_CONFIG_DIR := ~/.config/systemd/user | ||
LIVE_SYSTEMD_CONFIG_DIR := /etc/systemd/system | ||
LIVE_NGINX_CONFIG_DIR := /etc/nginx/sites-available | ||
LIVE_BLUETOOTH_CONFIG_DIR := /etc/bluetooth | ||
|
||
VENV := .venv | ||
SYSTEMCTL_USER ?= | ||
|
@@ -197,14 +198,28 @@ live-install: debian $(DEBIAN_UNITS) | |
|
||
# Player install | ||
# | ||
debian-%-install: debian iris.%.conf debian/nginx.override.conf | ||
install-bluetooth: | ||
install -t $(LIVE_SYSTEMD_CONFIG_DIR) bluetooth/[email protected] | ||
install -t $(LIVE_BLUETOOTH_CONFIG_DIR) bluetooth/main.conf | ||
install -m 0775 -t /usr/local/bin/ bluetooth/bluetooth-udev | ||
install -t /etc/udev/rules.d/ bluetooth/99-bluetooth-udev.rules | ||
|
||
debian-%-install: iris.%.conf debian/nginx.override.conf install-bluetooth | ||
install -t $(LIVE_NGINX_CONFIG_DIR) iris.$*.conf | ||
install -T -D debian/nginx.override.conf $(LIVE_SYSTEMD_CONFIG_DIR)/nginx.service.d/override.conf | ||
|
||
dietpi-%-install: dietpi iris.%.conf dietpi/nginx.override.conf | ||
# osmc 2022.09+ already has some of these | ||
debian-install-bluetooth: | ||
apt-get install -y --no-install-recommends bluetooth bluez-tools armv7-bluezalsa-osmc | ||
|
||
dietpi-%-install: iris.%.conf dietpi/nginx.override.conf install-bluetooth | ||
install -t $(LIVE_NGINX_CONFIG_DIR) iris.$*.conf | ||
install -T -D dietpi/nginx.override.conf $(LIVE_SYSTEMD_CONFIG_DIR)/nginx.service.d/override.conf | ||
|
||
# bluez-alsa is in: Raspbian 10 (but not installable) and Raspbian 12+ | ||
dietpi-install-bluetooth: | ||
apt-get install -y --no-install-recommends bluetooth bluez-tools bluez-alsa | ||
|
||
clean: | ||
-rm $(ALL_CONFIGS) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
SUBSYSTEM=="input", GROUP="input", MODE="0660" | ||
KERNEL=="input[0-9]*", RUN+="/usr/local/bin/bluetooth-udev" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
# | ||
# From rpi-audio-receiver by nicokaiser | ||
# https://github.com/nicokaiser/rpi-audio-receiver/blob/main/install-bluetooth.sh | ||
# | ||
# | ||
if [[ ! $NAME =~ ^\"([0-9A-F]{2}[:-]){5}([0-9A-F]{2})\"$ ]]; then exit 0; fi | ||
action=$(expr "$ACTION" : "\([a-zA-Z]\+\).*") | ||
if [ "$action" = "add" ]; then | ||
bluetoothctl discoverable off | ||
# disconnect wifi to prevent dropouts | ||
#ifconfig wlan0 down & | ||
fi | ||
if [ "$action" = "remove" ]; then | ||
# reenable wifi | ||
#ifconfig wlan0 up & | ||
bluetoothctl discoverable on | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
Description=Bluetooth Agent | ||
Requires=bluetooth.service | ||
After=bluetooth.service | ||
|
||
[Service] | ||
ExecStartPre=/usr/bin/bluetoothctl discoverable on | ||
ExecStartPre=/usr/bin/hciconfig %I piscan | ||
ExecStartPre=/usr/bin/hciconfig %I sspmode 1 | ||
ExecStart=/usr/bin/bt-agent --capability=NoInputNoOutput | ||
RestartSec=5 | ||
Restart=always | ||
KillSignal=SIGUSR1 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[General] | ||
# bluetooth speaker | ||
Class = 0x200414 |