Bluetooth headset play/pause key not fully effective in various media players

Bug #1397142 reported by Ben Harris
126
This bug affects 27 people
Affects Status Importance Assigned to Milestone
GNOME Shell
New
Undecided
Unassigned
Unity
Invalid
Undecided
Unassigned
gnome-settings-daemon (Ubuntu)
Confirmed
Low
Unassigned
unity-settings-daemon (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

UPDATE:
Function GnomeGrabber::Impl::ActivateDBusAction dont emit dbus signal "AcceleratorActivated" if be pressed key with keycodes 208 or 215 (its XF86AudioPlay).

Can be reproduce:
run in one terminal 'dbus-monitor "path=/org/gnome/Shell"'
and in other run 'xdotool key NUMBER'
where NUMBER - keycodes. Can be check 172, 172, 209, bugged 208 and 215 and other.

-------------------------------------------------------------------------
I have a Sony SRS-BTM8 Bluetooth speaker, and its audio side works fairly well with Ubuntu. It also has a play/pause button and that doesn't work so well. I think the problem lies in unity-settings-daemon.

To demonstrate that the Bluetooth side is working, if I switch to a text console and run "evtest /dev/input/event9", then when pressing the button I get events for KEY_PLAYCD if the speaker is not playing anything, and alternating KEY_PAUSECD and KEY_PLAYCD if it is playing something.

However, within the Unity desktop I find that if I'm running Banshee or Rhythmbox then pressing the button successfully pauses the music, but doesn't start it playing again. If I run "xev" and give it the keyboard focus while testing this (so xev sees all ungrabbed keystrokes) then it sees only a KeyRelease event for XF86AudioPause, but both KeyPress and KeyRelease events for XF86AudioPlay. I've attached the full output from xev.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: unity-settings-daemon 14.04.0+14.04.20140606-0ubuntu1
ProcVersionSignature: Ubuntu 3.16.0-25.33~14.04.2-generic 3.16.7
Uname: Linux 3.16.0-25-generic i686
ApportVersion: 2.14.1-0ubuntu3.5
Architecture: i386
CurrentDesktop: Unity
Date: Thu Nov 27 23:43:01 2014
DistributionChannelDescriptor:
 # This is a distribution channel descriptor
 # For more information see http://wiki.ubuntu.com/DistributionChannelDescriptor
 canonical-oem-motts-20100121-3
EcryptfsInUse: Yes
InstallationDate: Installed on 2010-06-09 (1632 days ago)
InstallationMedia: Ubuntu GNU/Linux 9.10 "Karmic" - Build i386 LIVE Binary 20100121-21:52
SourcePackage: unity-settings-daemon
UpgradeStatus: Upgraded to trusty on 2014-08-15 (104 days ago)

Revision history for this message
Ben Harris (bjh21.me.uk) wrote :
Revision history for this message
Ben Harris (bjh21.me.uk) wrote :

A quick additional not: using "xdotool key XF86AudioPlay" and "xdotool key XF86AudioPause" works correctly, so maybe it's not all media keys that are broken and there's something odd about my Bluetooth one.

Ben Harris (bjh21.me.uk)
summary: - Sony SRS-BTM8 play/pause key not fully effective in Banshee
+ Sony SRS-BTM8 play/pause key not fully effective in Rhythmbox or Banshee
Revision history for this message
Ben Harris (bjh21.me.uk) wrote : Re: Sony SRS-BTM8 play/pause key not fully effective in Rhythmbox or Banshee

I've made a small program out of parts of bluetoothd that demonstrates this problem without the need for any special hardware. Simply compile it and run it (as root) and it will create a virtual keyboard that generates "play" and "pause" keypresses at 5.1-second intervals. If you have Rhythmbox or Banshee playing when you start the test program, the first "pause" will pause the media player, but the subsequent "play" will not re-start it.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in unity-settings-daemon (Ubuntu):
status: New → Confirmed
Revision history for this message
jesus gumaro rendon suzuki (gumaro-rendon) wrote :

Tested the program with 14.04 up to date and it is confirmed. Can't resume music with my bluetooth headset.

Revision history for this message
jesus gumaro rendon suzuki (gumaro-rendon) wrote :

I'm using gnome desktop, though. I don't know if that makes a difference.

Revision history for this message
Jean-Pol Landrain (jplandrain) wrote :

I can confirm the problem with Ubuntu 14.10 and a Plantronics Backbeat Pro bluetooth headset.

Revision history for this message
Yura (ykuchinskiy) wrote :
Download full text (6.2 KiB)

I think I have the same problem with Sony SBH20, Ubuntu 15.04, kernel 4.0.4

Device is paired and bluetooth buttons detectable in "System Setings" -> "Keyboard" -> "Shortcuts" -> "Sound and Media"

* Previous Track detected as "Audio previous" and working as expected in all apps
* Next track detectable as "Audio next" and working as expected in all apps

* Play (or play/pause) detectable as "Audio play", but does not stop resume playback in all apps

Working apps:
1. Totem Movie Player
2. Spotify, but only if you click twice

Not working apps:
1. Pithos (pandora app for linux)
2. Chrome or FireFox (this is maybe app specific problem)
3. Rhythmbox

I would like to add that all apps (except chrome and firefox) are working with the keyboard pause/resume media key.
Question: who knows the flow of key events, please suggest how to debug this problem?

Here is output from "xev" for bluetooth pause/resume key

KeyPress event, serial 47, synthetic NO, window 0x5000001,
    root 0xaf, subw 0x0, time 73921661, (212,2196), root:(1500,2856),
    state 0x0, keycode 209 (keysym 0x1008ff31, XF86AudioPause), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 48, synthetic NO, window 0x5000001,
    root 0xaf, subw 0x0, time 73921858, (212,2196), root:(1500,2856),
    state 0x0, keycode 209 (keysym 0x1008ff31, XF86AudioPause), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 48, synthetic NO, window 0x5000001,
    root 0xaf, subw 0x0, time 73928594, (212,2196), root:(1500,2856),
    state 0x0, keycode 208 (keysym 0x1008ff14, XF86AudioPlay), same_screen YES,
    XKeysymToKeycode returns keycode: 172
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 48, synthetic NO, window 0x5000001,
    root 0xaf, subw 0x0, time 73928618, (212,2196), root:(1500,2856),
    state 0x0, keycode 208 (keysym 0x1008ff14, XF86AudioPlay), same_screen YES,
    XKeysymToKeycode returns keycode: 172
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 48, synthetic NO, window 0x5000001,
    root 0xaf, subw 0x0, time 73965210, (212,2196), root:(1500,2856),
    state 0x0, keycode 209 (keysym 0x1008ff31, XF86AudioPause), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 48, synthetic NO, window 0x5000001,
    root 0xaf, subw 0x0, time 73965728, (212,2196), root:(1500,2856),
    state 0x0, keycode 209 (keysym 0x1008ff31, XF86AudioPause), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 48, synthetic NO, window 0x5000001,
    root 0xaf, subw 0x0, time 73971740, (212,2196), root:(1500,2856),
    state 0x0, keycode 208 (keysym 0x1008ff14, XF86AudioPlay), same_screen YES,
    XKeysymToKeycode returns keycode: 172
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 48, synthetic NO, window 0x5000001,
    ro...

Read more...

Revision history for this message
Yura (ykuchinskiy) wrote :

VLC is working too, but you have to triple click quickly or double click slowly on bluetooth play/pause key...

Revision history for this message
Lalo Martins (lalo.martins) wrote :

+1 here, mine is a Philips SHB7150, and the problem was already present at least in 14.10, maybe earlier.

Reason I'm commenting though: playing around with xev, it seems to take some black magic to predict whether I'll get XF86AudioPlay or XF86AudioPause.

- If no app is playing, it's always XF86AudioPlay, regardless what combination of apps is running.
- If rhythmbox is playing, it's XF86AudioPause.
- If gmusicbrowser, mpv, or vlc is playing, it alternates between the two (but neither app responds to it regardless of state and event).
- And mplayer probably doesn't register itself with whatever it is, since it always gets XF86AudioPlay.

I also found that if vlc or mpv is focused, it does play when it's paused and I press the button; when it's playing, it will only pause every other press (thinking of the xev experiment above, I guess when the generated keysym is XF86AudioPause). The same is not true of gmusicbrowser. As for mplayer, if it's focused it responds exactly right.

summary: - Sony SRS-BTM8 play/pause key not fully effective in Rhythmbox or Banshee
+ Bluetooth play/pause key not fully effective in various media players
summary: - Bluetooth play/pause key not fully effective in various media players
+ Bluetooth headset play/pause key not fully effective in various media
+ players
tags: added: amd64 wily
description: updated
description: updated
Changed in unity:
status: New → Invalid
Changed in gnome-settings-daemon (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Changed in unity-settings-daemon (Ubuntu):
importance: Undecided → Medium
Changed in gnome-settings-daemon (Ubuntu):
importance: Medium → Low
Changed in unity-settings-daemon (Ubuntu):
importance: Medium → Low
Revision history for this message
nebuchar (nebuchar) wrote :

I have the same problem with a Plantronics Backbeat pro and 14.04 up to date.

Revision history for this message
levineds (levineds) wrote :

This bug persists in 16.04.

Revision history for this message
Miroslav Slavik (stream-mis) wrote :

Hi, is there any way to work around this issue? I confirm that the bug is persistent in 16.04.

Revision history for this message
Franchesko Salias Hudro Pedros (fshp) wrote :

You can replace this setting-daemon by mate-system-daemon. But this solution can reproduce other bugs :-)

Revision history for this message
Artyom (vagran) wrote :

> Hi, is there any way to work around this issue? I confirm that the bug is persistent in 16.04.

Global application shortcuts still work correctly with bluetooth media buttons. So for me I worked around this problem particularly with rhythmbox by adding global application shortcut to command "rhythmbox-client --play-pause".

Revision history for this message
levineds (levineds) wrote :

>Global application shortcuts still work correctly with bluetooth media buttons. So for me I worked >around this problem particularly with rhythmbox by adding global application shortcut to command >"rhythmbox-client --play-pause".

This is a good suggestion. A general workaround for all programs (at least in 16.04) is to, in the "Keyboards" utility, under the "Shortcuts" tab, in the "Sound and Media" section, change "Play (or play/pause)" to the the Bluetooth event. On mine, this changed it from "Audio play" to "Audio pause". Now, in Spotify, my bluetooth headphones can both pause and play the music (although I have to hit it twice for each).

Revision history for this message
Robin Sheat (eythian) wrote :

For my case, with Bose QC35 bluetooth headphones, skip forward and backward worked with no configuration, but play/pause didn't at all.

The workaround I found was to use xbindkeys with the help of xbindkeys-config to set the following:

"xdotool key XF86AudioPlay"
    c:208

in my ~/.xbindkeysrc. This is strange, as pretty much everything else sees the button as XF86AudioPlay, but it wasn't being seen as a media key by the player. But it works now.

Revision history for this message
Franchesko Salias Hudro Pedros (fshp) wrote :

Because have 2 ways for listing keys:

1) native (as VLC). Application get keycodes self. It always work fine.
2) over dbus observer from gnome/unity/etc-settings-daemon.

unity/gnome-settings-daemon have been rewritten. Now they listen only first XF86AudioPlay key. Bluetooth key not work if keyboard (or other early connected device) have this key.

mate-settings-daemon have legacy code from gnome2, but work fine too.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.