lukasjapan / bt-speaker

A simple Bluetooth Speaker Daemon for the Raspberry Pi 3
GNU General Public License v3.0
493 stars 94 forks source link

Broken under Raspbian / Raspberry Pi OS #83

Closed patrickjquinn closed 4 years ago

patrickjquinn commented 4 years ago

So I've just updated my Pi via the apt repos on buster and the bluez packages + the kernel and firmware have all been updated.

Seems to have broken this project. Goes into a restart loop with the service status as:

● bt_speaker.service - "Simple bluetooth speaker for the Raspberry Pi"
   Loaded: loaded (/opt/bt-speaker/bt_speaker.service; enabled; vendor preset: enabled)
   Active: failed (Result: start-limit-hit) since Wed 2020-06-03 15:38:35 IST; 1min 45s ago
  Process: 905 ExecStart=/opt/bt-speaker/bt_speaker.py (code=exited, status=0/SUCCESS)
 Main PID: 905 (code=exited, status=0/SUCCESS)

Jun 03 15:38:35 raspberrypi systemd[1]: bt_speaker.service: Service RestartSec=100ms expired, scheduling restart.
Jun 03 15:38:35 raspberrypi systemd[1]: bt_speaker.service: Scheduled restart job, restart counter is at 5.
Jun 03 15:38:35 raspberrypi systemd[1]: Stopped "Simple bluetooth speaker for the Raspberry Pi".
Jun 03 15:38:35 raspberrypi systemd[1]: bt_speaker.service: Start request repeated too quickly.
Jun 03 15:38:35 raspberrypi systemd[1]: bt_speaker.service: Failed with result 'start-limit-hit'.
Jun 03 15:38:35 raspberrypi systemd[1]: Failed to start "Simple bluetooth speaker for the Raspberry Pi".
JonasStankevicius commented 4 years ago

Hi, I have a fresh install of Raspberry Pi OS (2020-06-03) and latest BT-Speaker install. After running bt_speaker.service I get this message:

pi@raspberrypi:/opt/bt-speaker $ ./bt_speaker.service ./bt_speaker.service: line 1: [Unit]: command not found ./bt_speaker.service: line 4: [Service]: command not foun ./bt_speaker.service: line 11: [Install]: command not found

Am I running the service wrong or it is not working properly? Running bt_spearker.py does not work either.

pi@raspberrypi:/opt/bt-speaker $ ./bt_speaker.py Unable to find mixer control PCM,0 [hw:0] aplay: read_header:2834: read error

I am running Raspberry Pi 3 B+

bonapart commented 4 years ago

try change in /opt/bt_speaker/config.ini line mixer = PCM to something else (use alsamixer or amixer for example) on armbian\orangepipc i set mixer=Line Out and it works fine(case sensitive)

alexonpeace commented 4 years ago

So I've just updated my Pi via the apt repos on buster and the bluez packages + the kernel and firmware have all been updated.

Seems to have broken this project. Goes into a restart loop with the service status as:

● bt_speaker.service - "Simple bluetooth speaker for the Raspberry Pi"
   Loaded: loaded (/opt/bt-speaker/bt_speaker.service; enabled; vendor preset: enabled)
   Active: failed (Result: start-limit-hit) since Wed 2020-06-03 15:38:35 IST; 1min 45s ago
  Process: 905 ExecStart=/opt/bt-speaker/bt_speaker.py (code=exited, status=0/SUCCESS)
 Main PID: 905 (code=exited, status=0/SUCCESS)

Jun 03 15:38:35 raspberrypi systemd[1]: bt_speaker.service: Service RestartSec=100ms expired, scheduling restart.
Jun 03 15:38:35 raspberrypi systemd[1]: bt_speaker.service: Scheduled restart job, restart counter is at 5.
Jun 03 15:38:35 raspberrypi systemd[1]: Stopped "Simple bluetooth speaker for the Raspberry Pi".
Jun 03 15:38:35 raspberrypi systemd[1]: bt_speaker.service: Start request repeated too quickly.
Jun 03 15:38:35 raspberrypi systemd[1]: bt_speaker.service: Failed with result 'start-limit-hit'.
Jun 03 15:38:35 raspberrypi systemd[1]: Failed to start "Simple bluetooth speaker for the Raspberry Pi".

i have the exact same problem with raspbian

bonapart commented 4 years ago

in case of any errors try start application without systemctl(to see whats wrong)

systemctl stop bt_speaker
/opt/bt-speaker/bt_speaker.py
alexonpeace commented 4 years ago

in case of any errors try start application without systemctl(to see whats wrong)

systemctl stop bt_speaker
/opt/bt-speaker/bt_speaker.py

tried it got the error what Jonas got tried your solution again yet it still reads out that error

Unable to find mixer control PCM,0 [hw:0] aplay: read_header:2834: read error

also the config.ini was named config.ini.default but whatever tried after renaming to config.ini still the same and this is my config file

[bt_speaker]

play_command = aplay -f cd - connect_command = /etc/bt_speaker/hooks/connect disconnect_command = /etc/bt_speaker/hooks/disconnect startup_command = /etc/bt_speaker/hooks/startup track_command = /etc/bt_speaker/hooks/track

[bluez] device_path = /org/bluez/hci0 discoverable = yes pin_code = 0000

[alsa] enabled = yes mixer = alsamixer id = 0 cardindex = 0

bonapart commented 4 years ago

run amixer|grep control for example mine output is

Simple mixer control 'Master',0
Simple mixer control 'Headphone',0
Simple mixer control 'Speaker',0
Simple mixer control 'PCM',0
Simple mixer control 'Mic',0
Simple mixer control 'Mic Boost',0
Simple mixer control 'Capture',0
Simple mixer control 'Auto-Mute Mode',0
Simple mixer control 'Internal Mic',0
Simple mixer control 'Internal Mic Boost',0
Simple mixer control 'Loopback Mixing',0

so in [alsa] section i can write that mixer=Master, or mixer=PCM, or mixer=Speaker

file location is '/etc/bt_speaker/config.ini' default file you edit location is '/opt/bt_speaker/config.ini.default'

alexonpeace commented 4 years ago

I tried amixer|grep control and got

Simple mixer control 'Headphone',0

so i edited the file in /etc/bt_speaker/config.ini and tried but got a different error

root@raspberry:/opt/bt-speaker# sudo /opt/bt-speaker/bt_speaker.py Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. aplay: read_header:2834: read error

or this

pi@raspberry:~ $ /opt/bt-speaker/bt_speaker.py Failed to activate service 'org.bluez': timed out (service_start_timeout=25000ms) aplay: read_header:2834: read error

alexonpeace commented 4 years ago

NVM bro got it working after 2 hours of research and later found my Bluetooth service was broken and had to fix that its working now Thanks for your replys

patrickjquinn commented 4 years ago

Unable to find mixer control PCM,0 [hw:0] I've tried a combo of different devices and the default alsa device is configured correctly (it works fine with other Alsa dependant services).

schlimmchen commented 4 years ago

Unable to find mixer control PCM,0 [hw:0] I've tried a combo of different devices and the default alsa device is configured correctly (it works fine with other Alsa dependant services).

You were asking about Raspberry Pi 4. I had to do two things: Make sure that no HDMI is connected, as I found no way of enabling the analog audio output otherwise. There is some automatic switching ongoing by I don't know what.

When no HDMI is in use, amixer tells me that the mixer name is Headphone, so put that into /etc/bt_speaker/config.ini:

[alsa]
mixer = Headphone
lukasjapan commented 4 years ago

Finally got around to have a look at this. Can confirm this as broken.

lukasjapan commented 4 years ago

Fixed by https://github.com/lukasjapan/bt-speaker/pull/87

It is now possible to set no mixer value to make bt-speaker use the first mixer available.

lukasjapan commented 4 years ago

Thanks to everybody for feedback. It really helped to pinpoint the issue quickly and come up with a solution.