Bluetooth disconnects
|
18th Feb, 2023, 09:18 AM
Post: #16
|
|||
|
|||
RE: Bluetooth disconnects
(18th Feb, 2023 05:28 AM)Nachteule Wrote:(17th Feb, 2023 07:18 PM)grandcanyon Wrote: The problem is that bluetooth creates a new pulseaudio socket every time it connects since I am seeing a Thanks for writing the script. I have tried this and it still makes a second instance of pulseaudio and then drops the headphones and kills the second instance of pulseaudio. I tried it with both dtparam=audio=on commented and uncommented out. I still have RPiOS Lite on my other card and I am not seeing the same behavior so I am not sure what is different between debian and ubuntu since ubuntu is based on debian. |
|||
19th Feb, 2023, 06:43 AM
Post: #17
|
|||
|
|||
RE: Bluetooth disconnects
The problem is that PA is being started by spawning it when Kodi starts. BT needs PA started before it can start so since BT naturally starts before Kodi which starts PA is started , BT is not connected to PA. When you turn on your headphones BT thinks there isn't a PA so it spawns a new one and connects to this which causes the disconnects.
I ended up wrote/found an upstart for pulseaudio and turned off autospawn. The downside is for some reason PA doesn't work with Kodi but once the BT HPs are connected Kodi pipes the audio through the BT HPs without creating a new PA. Since I use PI:HDMI when not using headphones it doesn't matter to me that PA through HDMI has no sound. |
|||
19th Feb, 2023, 06:58 AM
Post: #18
|
|||
|
|||
RE: Bluetooth disconnects
In my opinion, you are mistaken here
At least with all my installations this is not the case. I can switch on my BT speakers whenever I want, there is never a new pulseaudio instance started. That would be totally absurd too Here it works like this: 1) bluez is started long before Kodi and pulseaudio. 2) when Kodi starts, the PA libraries cause the pulseaudio daemon to be loaded 3) at some point I can turn on the BT speakers, they are then properly integrated No respawn of pulseaudio daemon or whatever I have no idea anymore why this should not work for you |
|||
19th Feb, 2023, 12:27 PM
Post: #19
|
|||
|
|||
RE: Bluetooth disconnects
Other people saw multiple instances of PA with xbian
http://forum.xbian.org/thread-3549-post-31969.html#pid31969 I am not sure why we are seeing this and you are not, assuming they didn't find a solution, as in my opinion PA has to be started before bluetooth and I was able to do this in an upstart file by adding wait for a started PA in the bluetooth.conf file. Anyhow, mine is working they way I want it to. For unknown reasons, it wouldn't load the module-bluetooth-discover module so I ended up loading it with a sleep and pactl command in the rc.local. |
|||
19th Feb, 2023, 11:00 PM
Post: #20
|
|||
|
|||
RE: Bluetooth disconnects
Well, I cannot and do not have to understand everything.
Anyway, it's nice that you have found a functional solution for you. Purely out of interest, it would certainly be interesting to publish your (modified) scripts here. Maybe you can learn something from it and adopt it if necessary. |
|||
20th Feb, 2023, 06:04 AM
Post: #21
|
|||
|
|||
RE: Bluetooth disconnects
/etc/init/pulseaudio.conf
Code: start on runlevel [2345] line 4 of /etc/init/bluetooth.conf Code: start on (started rpi-bluetooth or started imx-bluetooth or bluetooth) and started pulseaudio added to /etc/rc.local for this xbian has to be in the sudoers file and xbian has to be added to the pulse group Code: bash -c "sleep 30; sudo -u xbian /usr/bin/pactl load-module module-bluetooth-discover" Please note, only headphones work with PA no PA itself. I switch back to PI:HDMI. Sometimes PA works as it must be some boot sequence issue. Anyhow, PA hasn't been stable with xbian nor RpiOS Lite as I end up with no sound after about 10 channel changes. I just use the BT HP when I want to and then switch back to PI:HDMI to avoid this. Also in $HOME/.config/pulse/default.pa I changed autospawn to no 2/20/23 Update: I had to comment out #dtparam=audio=on in the /boot/config.txt |
|||
21st Feb, 2023, 05:16 AM
Post: #22
|
|||
|
|||
RE: Bluetooth disconnects
Oops, I don't have to understand all that now, do I?
But the main thing for you it does what it should, no matter how it works. and that is the most important Thanks for that. When I have time I'll try to configure it like this to see how it behaves here. according to my current understanding it can't really work at all, but we'll see... |
|||
21st Feb, 2023, 06:09 AM
Post: #23
|
|||
|
|||
RE: Bluetooth disconnects
It's a bit of a hack. When you have to add stuff to the rc.local with sleep commands you know it's a hack.
I thought that I was running BT through on board BT but I was running through the dongle since it was turned to the back. I unplugged the dongle and reconnected and the on board BT wouldn't work until I commented out dtparam=audio=on. It worked for awhile with dtparam=audio=on with the dongle so keeping this on could have caused my PA issues in general. There are some boot timing issues since load-module module-bluetooth-discover won't load on boot plus sometimes PA works and doesn't work through HDMI. It works for me so I just posted it in case someone else runs into the same issue and wants to give it a try. Xbian is the best if you like something that is open (can add packages) but also is a complete Kodi package (don't have to compile addons for kodi). |
|||
27th Feb, 2023, 04:25 AM
Post: #24
|
|||
|
|||
RE: Bluetooth disconnects
In the day, this is for me a hack of the worst kind
For me there is the problem that I just do not understand what all this is supposed to have a meaning If I run PA in system mode - which the man-page already advises against - the only consequence for me is that no user instance is started and therefore Kodi does not offer any PA devices. Only if I manual before Kodi start PA as user xbian, Kodi sees again the PA Devices Also the sentence Quote:Please note, only headphones work with PA no PA itself. I switch back to PI:HDMI. Sometimes PA works as it must be some boot sequence issue. Anyhow, PA hasn't been stable with xbian nor RpiOS Lite as I end up with no sound after about 10 channel changes. I just use the BT HP when I want to and then switch back to PI:HDMI to avoid this. sounds completely confused to me and is totally incomprehensible to me The command Code: sudo -u xbian /usr/bin/pactl load-module module-bluetooth-discover does not work at any time, because PA is not available for the user xbian. By the way, rc.local is run as root, so a sudo is not required, a su -c xbian would be quite enough Also it is not a good idea to modify the bluetooth.conf file, because it might be overwritten. It would make much more sense to create an override file bluetooth.override with the following content Code: start on (started rpi-bluetooth or started imx-bluetooth or bluetooth) and started pulseaudio But these are basically only minor details I'm sorry I can't help you with this problem, as I obviously don't understand it somehow and understand the hack even less |
|||
1st Mar, 2023, 06:19 AM
Post: #25
|
|||
|
|||
RE: Bluetooth disconnects
I know it's a hack in the worst way but it works for me.
You can't run pactl as root and since rc.local runs as root pactl won't work hence the reason I had to add sudo -u xbian. I tried su -c xbian but it didn't work. My problem all along could have been #dtparam=audio=on so I may ty to back out my hack and see if this solves it to make my system cleaner. |
|||
« Next Oldest | Next Newest »
|