Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with Blueman 1.23 an A2DP #64

Closed
sebastian-de opened this issue Jun 10, 2014 · 17 comments
Closed

Issues with Blueman 1.23 an A2DP #64

sebastian-de opened this issue Jun 10, 2014 · 17 comments
Assignees
Labels
Milestone

Comments

@sebastian-de
Copy link

Citing David Henningsson from https://bugs.launchpad.net/ubuntu/+source/gnome-bluetooth/+bug/1283003/comments/72

"Hi Blueman developers,

This is an outreach for help - let me know if this is the right channel
or not. We seem to have a lot of people claiming that pulseaudio's
module-bluetooth-discover is not loaded on startup on 14.04. This causes
problems with bluetooth headsets.

Reading the code I can see that blueman deliberately unloads
module-bluetooth-discover. Do you have a better idea than just removing
those lines of code, which probably are there for a reason?

Here are some related bugs:

https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1274613
https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1283003

David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic"

Another bug i found: https://bugs.launchpad.net/ubuntu/+source/blueman/+bug/1199059 (blueman and pulse's module-bluetooth-discover)

I already reassigned the Launchpad bug to blueman project, but I don't know if the Launchpad or GitHub Bugtracker is the official one.

@cschramm cschramm added the bug label Jun 10, 2014
@cschramm cschramm added this to the 2.0 milestone Jun 10, 2014
@cschramm cschramm self-assigned this Jun 10, 2014
@cschramm
Copy link
Member

Hi, we're working on GitHub, the Launchpad tracker is orphaned. But I just subscribed to the two bug reports.

This could also be related to #57 and #60.

Unfortunately I do not know what the unloading is there for. I'll try to reach the original author on this.

@sebastian-de
Copy link
Author

Thanks!
As you can see from the linked Launchpad bugs, bluetooth in Ubuntu 14.04 seems to be quite messy. A lot of people report that their A2DP hardware stopped working after updating from U12.04 to U14.04. There are also people affected that use unity/gnome-bluetooth, so there are probably regressions in other parts of the Ubuntu bluetooth stack as well.

But hopefully it's possible to narrow things down a bit, if we know what the unloading of module-bluetooth-discover is there for.

@cschramm
Copy link
Member

I got the following information from Valmantas, the original author:

originally when PulseAudio project was young, it did not properly manage bluetooth headsets, so I unloaded the pulseaudio discover module and managed the devices manually inside Blueman. i.e. when a headset connects, blueman automatically detects that, loads Pulseaudio module "bluetooth-device", routes active streams to the headset. Lately I've tested that functionality in KDE and it appears that Pulseaudio now manges everything correctly. So the PulseAudio plugin in Blueman probably needs to be disabled or patched accordingly with the functionality of latest versions of Pulseaudio.

If I get that right, we can actually remove any pulseaudio support in blueman and only provide the ability to connect to the device. Everything else should be done by pulseaudio itself.

cschramm added a commit that referenced this issue Jun 15, 2014
This is a try to fix issues caused by unloading the discover module (see #64 and possibly #57 / #60)

PulseAudio specific code should not be necessary at all
@cschramm
Copy link
Member

The https://github.com/blueman-project/blueman/tree/nopulseaudio branch is a try to fix this once and for all by simply removing all PulseAudio specific code. The rest of the branch's content is the same as in Debian testing and Ubuntu lucid.

@cschramm
Copy link
Member

Looking at the latest comments for #1283003 (zig59 specifically), it seems like removing all pulseaudio related code from blueman is not the way to go, since at least the manager plugin, which allows changing the audio profile, seems to be helpful for users.

The problem is the applet plugin, which basically does two things: Unloading the bluetooth-discover module (that's the main problem) and handling new devices manually instead and redirecting audio sources. I'm neither really sure if the redirection is useful, nor am I sure if it will work reliably if the discovery module is running.

Overall I think removing the applet plugin, but keeping the manager plugin is the best way to go.

I'll try to prepare a Debian package for this and ask the contributors of the bug report to test this over the weekend.

@cschramm
Copy link
Member

cschramm commented Jul 2, 2014

Fixed and distributed to Debian unstable (also see #57 (comment)).

I'm leaving this open to discuss further changes to the applet plugin, but I'll need some input for this (see https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1283003/comments/105), since I do not have any bluetooth audio device (other than my smartphone and tablet; not sure what I could do with them).

@Vdragon
Copy link

Vdragon commented Jul 6, 2014

Hi, I'm the reporter of LP Bug #1199059, I can do some verification of this issue.

@sebastian-de Is LP Bug #1283003 a duplicate of LP Bug #1199059? If yes which report should I set as duplicate?

@sebastian-de
Copy link
Author

Hi Vdragon,
#1199059 and #1283003 aren't exact duplicates. #1199059 seems to be blueman-specific, whereas #1283003 also affects gnome-bluetooth.
You can test the blueman version from cschramm's ppa (see
https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1283003/comments/92). If it works, I recommend to mark #1199059 as fixed, as soon as the package is backported to Trusty.

@sebastian-de
Copy link
Author

@cschramm
Here is the output of blueman-applet-1.23-git201406261335-deb, when connecting.
Seems weird to me - it looks like the device is initialized twice...

_________
on_item_activated (/usr/lib/python2.7/dist-packages/blueman/plugins/applet/RecentConns.py:279)
Connect 00:0D:18:A0:16:50 org.bluez.AudioSink 
_________
init_services (/usr/lib/python2.7/dist-packages/blueman/main/Device.py:73)
Loading services 
_________
__init__ (/usr/lib/python2.7/dist-packages/blueman/main/Device.py:16)
caching initial properties 
_________
notify (/usr/lib/python2.7/dist-packages/blueman/plugins/applet/RecentConns.py:237)
<Device object at 0xb564d3c4 (blueman+main+Device+Device at 0xa30c030)> org.bluez.AudioSink dbus.Array([], signature=None) 
_________
__del__ (/usr/lib/python2.7/dist-packages/blueman/main/Device.py:60)
deleting device /org/bluez/697/hci0/dev_00_0D_18_A0_16_50 
_________
Destroy (/usr/lib/python2.7/dist-packages/blueman/main/Device.py:95)
invalidating device /org/bluez/697/hci0/dev_00_0D_18_A0_16_50 
_________
initialize (/usr/lib/python2.7/dist-packages/blueman/plugins/applet/RecentConns.py:136)
rebuilding menu 
/usr/lib/python2.7/dist-packages/blueman/gui/Notification.py:169: GtkWarning: IA__gdk_window_get_origin: assertion 'GDK_IS_WINDOW (window)' failed
  screen, area, orientation = status_icon.get_geometry()
_________
__event_callback (/usr/lib/python2.7/dist-packages/blueman/main/PulseAudioUtils.py:602)
9 7 
_________
__event_callback (/usr/lib/python2.7/dist-packages/blueman/main/PulseAudioUtils.py:602)
4 29 
_________
__event_callback (/usr/lib/python2.7/dist-packages/blueman/main/PulseAudioUtils.py:602)
25 7 
_________
on_pulse_event (/usr/lib/python2.7/dist-packages/blueman/plugins/applet/PulseAudio.py:208)
25 
_________
card_cb (/usr/lib/python2.7/dist-packages/blueman/plugins/applet/PulseAudio.py:211)
{'index': 7L, 'name': 'bluez_card.00_0D_18_A0_16_50', 'owner_module': 29L, 'driver': 'module-bluetooth-device.c', 'profiles': [{'n_sources': 0L, 'priority': 10L, 'n_sinks': 1L, 'name': 'a2dp', 'description': 'High Fidelity Playback (A2DP)'}, {'n_sources': 0L, 'priority': 0L, 'n_sinks': 0L, 'name': 'off', 'description': 'Aus'}], 'active_profile': 'a2dp', 'proplist': {'device.description': 'BTR-1', 'device.form_factor': 'headset', 'device.icon_name': 'audio-headset-bluetooth', 'bluez.path': '/org/bluez/697/hci0/dev_00_0D_18_A0_16_50', 'device.intended_roles': 'phone', 'device.class': 'sound', 'device.string': '00:0D:18:A0:16:50', 'device.bus': 'bluetooth', 'device.api': 'bluez', 'bluez.name': 'BTR-1', 'bluez.class': '0x240404'}} 
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 314, in 'calling callback function'
  File "/usr/lib/python2.7/dist-packages/blueman/main/PulseAudioUtils.py", line 353, in __list_callback
    info["handler"](entry_info, False)
  File "/usr/lib/python2.7/dist-packages/blueman/main/PulseAudioUtils.py", line 522, in handler
    callback(self.__card_info(entry_info))
  File "/usr/lib/python2.7/dist-packages/blueman/plugins/applet/PulseAudio.py", line 213, in card_cb
    m = self.loaded_modules[c["proplist"]["bluez.path"]]
KeyError: '/org/bluez/697/hci0/dev_00_0D_18_A0_16_50'
_________
__init__ (/usr/lib/python2.7/dist-packages/blueman/main/Device.py:16)
caching initial properties 
_________
load_cb (/usr/lib/python2.7/dist-packages/blueman/plugins/applet/PulseAudio.py:321)
Load result 30 
_________
setup_pa_sinks (/usr/lib/python2.7/dist-packages/blueman/plugins/applet/PulseAudio.py:302)
module 30 
_________
init_services (/usr/lib/python2.7/dist-packages/blueman/main/Device.py:73)
Loading services 
org.bluez.Error.AlreadyConnected: Already Connected
_________
__del__ (/usr/lib/python2.7/dist-packages/blueman/main/Device.py:60)
deleting device /org/bluez/697/hci0/dev_00_0D_18_A0_16_50 
_________
Destroy (/usr/lib/python2.7/dist-packages/blueman/main/Device.py:95)
invalidating device /org/bluez/697/hci0/dev_00_0D_18_A0_16_50 
_________
__event_callback (/usr/lib/python2.7/dist-packages/blueman/main/PulseAudioUtils.py:602)
9 8 
_________
__event_callback (/usr/lib/python2.7/dist-packages/blueman/main/PulseAudioUtils.py:602)
4 30 
_________
__event_callback (/usr/lib/python2.7/dist-packages/blueman/main/PulseAudioUtils.py:602)
25 7 
_________
on_pulse_event (/usr/lib/python2.7/dist-packages/blueman/plugins/applet/PulseAudio.py:208)
25 
_________
__event_callback (/usr/lib/python2.7/dist-packages/blueman/main/PulseAudioUtils.py:602)
25 8 
_________
on_pulse_event (/usr/lib/python2.7/dist-packages/blueman/plugins/applet/PulseAudio.py:208)
25 
_________
card_cb (/usr/lib/python2.7/dist-packages/blueman/plugins/applet/PulseAudio.py:211)
{'index': 7L, 'name': 'bluez_card.00_0D_18_A0_16_50', 'owner_module': 29L, 'driver': 'module-bluetooth-device.c', 'profiles': [{'n_sources': 0L, 'priority': 10L, 'n_sinks': 1L, 'name': 'a2dp', 'description': 'High Fidelity Playback (A2DP)'}, {'n_sources': 0L, 'priority': 0L, 'n_sinks': 0L, 'name': 'off', 'description': 'Aus'}], 'active_profile': 'a2dp', 'proplist': {'device.description': 'BTR-1', 'device.form_factor': 'headset', 'device.icon_name': 'audio-headset-bluetooth', 'bluez.path': '/org/bluez/697/hci0/dev_00_0D_18_A0_16_50', 'device.intended_roles': 'phone', 'device.class': 'sound', 'device.string': '00:0D:18:A0:16:50', 'device.bus': 'bluetooth', 'device.api': 'bluez', 'bluez.name': 'BTR-1', 'bluez.class': '0x240404'}} 
_________
card_cb (/usr/lib/python2.7/dist-packages/blueman/plugins/applet/PulseAudio.py:211)
{'index': 8L, 'name': 'bluez_card.00_0D_18_A0_16_50.2', 'owner_module': 30L, 'driver': 'module-bluetooth-device.c', 'profiles': [{'n_sources': 0L, 'priority': 10L, 'n_sinks': 1L, 'name': 'a2dp', 'description': 'High Fidelity Playback (A2DP)'}, {'n_sources': 0L, 'priority': 0L, 'n_sinks': 0L, 'name': 'off', 'description': 'Aus'}], 'active_profile': 'off', 'proplist': {'device.description': 'BTR-1', 'device.form_factor': 'headset', 'device.icon_name': 'audio-headset-bluetooth', 'bluez.path': '/org/bluez/697/hci0/dev_00_0D_18_A0_16_50', 'device.intended_roles': 'phone', 'device.class': 'sound', 'device.string': '00:0D:18:A0:16:50', 'device.bus': 'bluetooth', 'device.api': 'bluez', 'bluez.name': 'BTR-1', 'bluez.class': '0x240404'}} 

@Vdragon
Copy link

Vdragon commented Jul 6, 2014

Here is the log of testing this issue right after(no reboot) upgrading blueman package from cschramm's PPA on Ubuntu 14.04 i386 KDE

  1. Tried to connect to the A2DP/HSP bluetooth speaker's Audio Sink
    • While the GUI isn't terminated, Apport notified that there's a crash:
      20140707_004
    • PulseAudio device appeared, however audio applications hangs with the error:PulseAudio server connection failure: Connection refused.
  2. I managed to use the speaker normally after several disconnect/reconnect and PulseAudio restarting, here's the blueman-manager's output

@cschramm
Copy link
Member

I've removed the PulseAudio applet plugin completely now in master after reading [1]. This removes the duplicate devices and maybe avoids the crash @Vdragon reports.

The required pulseaudio restart is strange... The only thing I could imagine is that there's a dangling pulseaudio connection for the "Blueman" context and it's not possible to initialize another one.

[1] https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1283003/comments/111

@Plaque-fcc
Copy link

Hi, it's pleasant to know that the developers are aware of the bug, although I never managed to get here looking for a solution.

Don't know when fixes come to Ubuntu. How can I test the current version you develop?

@cschramm
Copy link
Member

The easiest way for Ubuntu users is to download and install the utopic package: http://packages.ubuntu.com/utopic/blueman

It contains a fix.

@Plaque-fcc
Copy link

Hi,

I by the way downloaded and compiled it from source. It works now,
while the utopic-released package didn't work. I got no idea why,
really.

Pre-story: I've come here only when all GNOME-related bluetooth
stuff ceased to work (right after upgrading from Ubuntu 14.04 to
14.10, which is Utopic Unicorn), and Blueman (installed) was all
that's left to use. I was too lazy to inspect the reason why it didn't
work before, and if it was working fine, this message would never
appear here.

Finally, building against current master branch I can confirm it's
likely solved. Thanks.

@cschramm
Copy link
Member

Strange... I can't think of any related difference between the utopic package and the current master branch. Anyway, good to know it works. 😃

@Yanpas
Copy link

Yanpas commented Dec 9, 2015

+1

@divneet
Copy link

divneet commented Jul 21, 2016

the package has been removed and i'm still unable to connect to my speakers !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants