#532098 bluez-alsa is silent, but mplayer complains loudly

#532098#5
Date:
2009-06-06 12:25:44 UTC
From:
To:
Hi folks,

I would like to make the a2dp headset the default audio device on my
laptop (the built-in speakers are just too awful). /etc/asound.conf
says

	pcm.!bluetooth {
		type bluetooth
		device 000:19:7F:6B:9A:04
		profile "hifi"
	}

	pcm.!default {
		type plug
		slave.pcm "bluetooth"
	}

But when I try to play a song using

	mplayer -ao alsa:device=bluetooth mix/Genesis\ -\ Carpet\ Crawlers.ogg

then it complains:

Playing mix/Genesis - Carpet Crawlers.ogg.
[Ogg] stream 0: audio (Vorbis), -aid 0
Ogg file format detected.
Clip info:
 Title: Carpet Crawlers
 Artist: Genesis
 Album: The Lamb Lies Down On Broadway
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, s16le, 320.0 kbit/22.68% (ratio: 40000->176400)
Selected audio codec: [ffvorbis] afm: ffmpeg (FFmpeg Vorbis)
==========================================================================
[AO_ALSA] alsa-lib: pcm_bluetooth.c:1607:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
[AO_ALSA] Playback open error: Input/output error
Failed to initialize audio driver 'alsa:device=bluetooth'
Could not open/initialize audio device -> no sound.
Audio: no sound
Video: no video


Exiting... (End of file)


There is no indication of any I/O error in /var/log messages.


Regards

Harri

#532098#10
Date:
2009-06-30 19:33:00 UTC
From:
To:
I'm getting this too:

$ mpg123 *
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2, and 3.
Version 0.59q (2002/03/23). Written and copyrights by Joe Drew.
Uses code from various people. See 'README' for more!

Playing MPEG stream from ...
MPEG 1.0 layer III, 128 kbit/s, 44100 Hz joint-stereo
ALSA lib pcm_bluetooth.c:1607:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA snd_pcm_open error: Input/output error

asoundrc config:

pcm.bluetooth {
  type bluetooth
  device "00:11:22:33:44:55"
}

pcm.default pcm.bluetooth

packages:

ii  bluez                   4.42-1                  Bluetooth tools and daemons
ii  bluez-alsa              4.42-1                  Bluetooth ALSA support
ii  bluez-audio             4.42-1                  Transitional package
ii  bluez-compat            4.42-1                  BlueZ 3.x compatibility binaries
ii  bluez-gnome             0.27-1                  Bluetooth utilities for GNOME
ii  bluez-gstreamer         4.42-1                  Bluetooth GStreamer support
ii  alsa-base               1.0.20+dfsg-1           ALSA driver configuration files
ii  alsa-oss                1.0.17-1                ALSA wrapper for OSS applications
ii  alsa-utils              1.0.20-1                ALSA utilities

dmesg:

[    6.515796] Bluetooth: Core ver 2.15
[    6.516244] Bluetooth: HCI device and connection manager initialized
[    6.516308] Bluetooth: HCI socket layer initialized
[    6.763757] Bluetooth: Generic Bluetooth USB driver ver 0.5
[    6.763876] usbcore: registered new interface driver btusb
...
[  532.228714] Bluetooth: L2CAP ver 2.13
[  532.228781] Bluetooth: L2CAP socket layer initialized
[  532.246398] Bluetooth: RFCOMM socket layer initialized
[  532.246467] Bluetooth: RFCOMM TTY layer initialized
[  532.246530] Bluetooth: RFCOMM ver 1.11
[  532.680644] Bluetooth: SCO (Voice Link) ver 0.6
[  532.680704] Bluetooth: SCO socket layer initialized
[  532.755583] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[  532.755644] Bluetooth: BNEP filters: protocol multicast

modules:

bluetooth              54900  9 bnep,sco,rfcomm,l2cap,btusb

#532098#15
Date:
2009-08-05 13:34:14 UTC
From:
To:
Hi -

I see the same thing, but only when I add ``profile "hifi"'' to my
.asoundrc.  If I omit the profile line, it works fine, but sounds
terrible (like it's using the handsfree profile..by default?):

neodymium% cat ~/.asoundrc
pcm.bluetooth {
        type bluetooth
        # Altec Lansing
        device "00:1C:EF:4B:33:C4"
        profile "hifi"
}

neodymium% mplayer -nojoystick -nolirc -ao alsa:device=bluetooth 15\ Monsun.mp3
MPlayer dev-SVN-r29417
Playing 15 Monsun.mp3.
Audio only file format detected.
Clip info:
 Title: Monsun
 Artist: 3rd Moon
 Album: A State of Trance 2009 (Mixed
 Year: 2009
 Comment:
 Track: 15
 Genre: Trance
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
[AO_ALSA] alsa-lib: pcm_bluetooth.c:1607:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
[AO_ALSA] Playback open error: Input/output error
Failed to initialize audio driver 'alsa:device=bluetooth'
Could not open/initialize audio device -> no sound.
Audio: no sound
Video: no video


Exiting... (End of file)

neodymium%

But, I do see a message in my /var/log/daemon.log, right when I run
MPlayer:

Aug  5 09:21:29 neodymium bluetoothd[27847]: Unable to find a matching device

I'm not sure exactly what that's referring to.  According to hcidump, bluez
doesn't try to connect to my device at all.  Here's the bluez package versions
I have installed:

ii  bluez                      4.42-2 Bluetooth tools and daemons
ii  bluez-alsa                 4.42-2 Bluetooth ALSA support
ii  bluez-audio                4.42-2 Transitional package
ii  bluez-gstreamer            4.42-2 Bluetooth GStreamer support
ii  bluez-hcidump              1.42-1 Analyses Bluetooth HCI packets
ii  bluez-utils                4.42-2 Transitional package
ii  alsa-base                  1.0.20+dfsg-1 ALSA driver configuration files
ii  alsa-oss                   1.0.17-1      ALSA wrapper for OSS applications
ii  alsa-source                1.0.20+dfsg-1 ALSA driver sources
ii  alsa-utils                 1.0.20-2      ALSA utilities

Let me know if I should try/send anything else.  This same setup worked
fine with the 3.3x versions of bluez-audio, etc.

Thanks!

- Mark

#532098#20
Date:
2009-10-13 12:32:24 UTC
From:
To:
is this still reproducible with latest 4.56 release?

Andrea

#532098#25
Date:
2009-10-21 19:21:06 UTC
From:
To:
Hi Andrea -

Unfortunately, this is still reproducible with the 4.56-2 packages from
sid.

- Mark

#532098#30
Date:
2009-11-01 04:30:35 UTC
From:
To:
Hi all,

Just to confirm the same issue here in both i386 and amd64 systems. I'm using
a Jabra BT200 headset which used to work well in previous bluez versions.


tiago@thinkpad:~$ mplayer -ao alsa:device=bluetooth 04.\ Bubuia.mp3
[...]
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
[AO_ALSA] alsa-lib: audio/pcm_bluetooth.c:1607:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
[AO_ALSA] Playback open error: Input/output error
Failed to initialize audio driver 'alsa:device=bluetooth'
[...]

tiago@thinkpad:~$ dpkg -l |grep blue
ii  bluetooth                            4.56-2                       Bluetooth support
ii  bluez                                4.56-2                       Bluetooth tools and daemons
ii  bluez-alsa                           4.56-2                       Bluetooth ALSA support
rc  bluez-audio                          3.36-3                       Bluetooth audio support
ii  bluez-cups                           4.56-2                       Bluetooth printer driver for CUPS
ii  bluez-gnome                          0.27-1                       Bluetooth utilities for GNOME
ii  bluez-gstreamer                      4.56-2                       Bluetooth GStreamer support
ii  bluez-utils                          4.56-2                       Transitional package
ii  gnome-bluetooth                      0.9.1-1                      GNOME Bluetooth tools
ii  libbluetooth-dev                     3.36-1                       Development files for using the BlueZ Linux Blueto
ii  libbluetooth2                        3.36-1                       Library to use the BlueZ Linux Bluetooth stack
ii  libbluetooth3                        4.56-2                       Library to use the BlueZ Linux Bluetooth stack
rc  libkbluetooth0                       1.0~beta8-6                  Bluetooth library for KDE

tiago@thinkpad:~$ cat .asoundrc
pcm.a2dpd {
            type a2dpd
      }

pcm.bluetooth {
   type bluetooth
   device 00:07:A4:07:7B:8A
}

Regards,

#532098#35
Date:
2010-02-10 16:04:45 UTC
From:
To:
I ran into the same issue.

# dpkg -l | egrep 'bluetooth|bluez'
ii  bluetooth                                   4.60-1                                          Bluetooth support
ii  bluez                                       4.60-1                                          Bluetooth tools and daemons
ii  bluez-alsa                                  4.60-1                                          Bluetooth ALSA support
ii  bluez-cups                                  4.60-1                                          Bluetooth printer driver for CUPS
rc  bluez-gnome                                 0.27-1                                          Bluetooth utilities for GNOME
ii  bluez-gstreamer                             4.60-1                                          Bluetooth GStreamer support
ii  bluez-hcidump                               1.42-1+b1                                       Analyses Bluetooth HCI packets
ii  bluez-utils                                 4.60-1                                          Transitional package
ii  gnome-bluetooth                             2.28.6-2                                        GNOME Bluetooth tools
rc  libbluetooth2                               3.36-1                                          Library to use the BlueZ Linux Bluetooth stack
ii  libbluetooth3                               4.60-1                                          Library to use the BlueZ Linux Bluetooth stack
rc  libgnome-bluetooth2                         2.27.5-1                                        GNOME Bluetooth tools - support library
ii  libgnome-bluetooth7                         2.28.6-2                                        GNOME Bluetooth tools - support library
ii  pulseaudio-module-bluetooth                 0.9.21-1                                        Bluetooth module for PulseAudio sound server

$ head -n 5 .asoundrc
pcm.Justus {
	   type bluetooth
	   device 00:1A:7D:21:97:EE
	   profile "voice"
}
# hcitool cc 00:1A:7D:21:97:EE
# hcitool con
Connections:
	< ACL 00:1A:7D:21:97:EE handle 11 state 1 lm MASTER

... master is dropped soon due to some timeout, but that's okay afaik...

$ mplayer -ao alsa:device=Justus ...
[...]
[AO_ALSA] alsa-lib: audio/pcm_bluetooth.c:1607:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
[AO_ALSA] Playback open error: Input/output error

some logs from the bluetoothd:

# pkill bluetoothd
# bluetoothd -nd
[... skipping to the mplayer invokation... ]
bluetoothd[8851]: Accepted new client connection on unix socket (fd=4)
bluetoothd[8851]: Audio API: BT_REQUEST <- BT_GET_CAPABILITIES
bluetoothd[8851]: sending error Input/output error(5)
bluetoothd[8851]: Audio API: BT_ERROR -> BT_GET_CAPABILITIES
bluetoothd[8851]: Unix client disconnected (fd=4)
bluetoothd[8851]: client_free(0x7fd5bf3f91f0)

The device is a cheap headset from logilab. I could actually use it with Ubuntu 9.04, so the device works and worked fine with linuz/bluez/alsa *at some point* in time. Oh, and I am running a kernel that I build on my own, but I also tested this with the stock debian kernel (linux-image-2.6.30-1-amd64):

# uname -a
Linux thinkbox 2.6.32.2 #16 SMP PREEMPT Thu Feb 4 16:36:21 CET 2010 x86_64 GNU/Linux
# fgrep _BT /boot/config-`uname -r`
CONFIG_BT=y
CONFIG_BT_L2CAP=m
CONFIG_BT_SCO=m
CONFIG_BT_RFCOMM=m
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=m
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_HIDP=m
CONFIG_BT_HCIBTUSB=m
CONFIG_BT_HCIBTSDIO=m
CONFIG_BT_HCIUART=m
CONFIG_BT_HCIUART_H4=y
CONFIG_BT_HCIUART_BCSP=y
CONFIG_BT_HCIUART_LL=y
CONFIG_BT_HCIBCM203X=m
CONFIG_BT_HCIBPA10X=m
CONFIG_BT_HCIBFUSB=m
CONFIG_BT_HCIDTL1=m
CONFIG_BT_HCIBT3C=m
CONFIG_BT_HCIBLUECARD=m
CONFIG_BT_HCIBTUART=m
CONFIG_BT_HCIVHCI=m
# CONFIG_BT_MRVL is not set
CONFIG_INPUT_ATLAS_BTNS=m
# CONFIG_VIDEO_BT848 is not set
# CONFIG_SND_BT87X is not set
CONFIG_BTRFS_FS=m
CONFIG_BTRFS_FS_POSIX_ACL=y

If you need any more information, please let me know.
Justus

#532098#40
Date:
2010-04-17 22:20:31 UTC
From:
To:
Hi!

I get into the same problem. I would like to stress the fact that
there is not try to contact the remote device. Running hcidump shows
that nothing happens when we try to use the bluetooth device. Maybe it
uses only cached information. I have this in /var/lib/bluetooth about
my remote device:

classes:00:0F:59:11:XX:XX 0x240404
features:00:0F:59:11:XX:XX FFFF8F7818180080
lastseen:00:0F:59:11:XX:XX 2010-04-17 20:20:46 GMT
lastused:00:0F:59:11:XX:XX 2010-04-17 22:04:21 GMT
manufacturers:00:0F:59:11:XX:XX 10 4 4866
names:00:0F:59:11:XX:XX iCom
pincodes:00:0F:59:11:XX:XX 0000

I have also tried 4.63 without any luck.

- -- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages bluez-alsa depends on:
ii  bluez                         4.60-1     Bluetooth tools and daemons
ii  libasound2                    1.0.22-2   shared library for ALSA applicatio
ii  libbluetooth3                 4.60-1     Library to use the BlueZ Linux Blu
ii  libc6                         2.10.2-6   Embedded GNU C Library: Shared lib

bluez-alsa recommends no packages.

bluez-alsa suggests no packages.

- -- no debconf information
iEYEARECAAYFAkvKNCkACgkQKFvXofIqeU5XeQCdF5k59VpZzskOH4SgkAEHJqy6
JAgAnikqnTx8aceu76lb7knMuLgmgXLU
=hk4r
-----END PGP SIGNATURE-----

#532098#45
Date:
2010-04-17 23:40:45 UTC
From:
To:
Hi!

Using bluetooth-applet from gnome-bluetooth package enables me to skip
this bug. I have then another problem, but I will investigate a bit
about this.

- -- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages bluez-alsa depends on:
ii  bluez                         4.60-1     Bluetooth tools and daemons
ii  libasound2                    1.0.22-2   shared library for ALSA applicatio
ii  libbluetooth3                 4.60-1     Library to use the BlueZ Linux Blu
ii  libc6                         2.10.2-6   Embedded GNU C Library: Shared lib

bluez-alsa recommends no packages.

bluez-alsa suggests no packages.

- -- no debconf information
iEYEARECAAYFAkvKRvoACgkQKFvXofIqeU5c5gCfZq0F3asO3CSZbk/lJ4KuSZM6
J30AoMEbsE0MuIZTIB5rlm1H1BvDk/iL
=6CaO
-----END PGP SIGNATURE-----

#532098#50
Date:
2010-04-18 00:17:07 UTC
From:
To:
OoO En  cette nuit nuageuse  du dimanche 18  avril 2010, vers  00:20, je
disais:

For the record,  using Gnome Bluetooth applet solves  my problem (like I
said in  another mail). It seems  that bonding correctly  to a bluetooth
device is  far more  complex than I  though using command  line. Despite
having used hcitool {cc,con,auth,link,key}, I did not get the files that
I get  when using  Gnome Bluetooth applet:  linkkeys, profiles,  sdp and
trusts.

Also  note that  the  error 'BT_GET_CAPABILITIES  failed :  Input/output
error(5)'  is really  misleading.  When getting  capabilities, it  first
tries to find a device and if it does not find one, it outputs the above
error. There is  nothing sent. I have not looked the  whole logic, but I
suspect that if  your remote device is not in  linkkeys and in profiles,
it will just be ignored.

I encourage  all reporters  (except Mark because  I think that  it tries
with a remote device that does not support A2DP) to check the content of
/var/lib/bluetooth and  to try  to do the  pairing with  Gnome Bluetooth
applet.

But maybe there was a but which is fixed in 4.60.

Moreover, I tried  to test my headset with  alsaplayer. alsaplayer seems
to try  to open the  device twice which  is rejected with an  error like
this:

bluetoothd[7968]: open a2dp - object=ANY source=ANY destination=00:0F:59:11:XX:XX lock=write
bluetoothd[7968]: Client already has an opened session

I have used mpg321 which does not have this problem.

I use this asoundrc:

pcm.bluetooth {
  type bluetooth
  device 00:0F:59:11:XX:XX
}

pcm.!default {
 type plug
 slave {
   pcm bluetooth
 }
}

#532098#55
Date:
2011-03-31 08:38:23 UTC
From:
To:
Sorry, but some Gnome or Kde applets are no option. Making A2DP depend
upon unrelated and highly complex functionality like Gnome or KDE just
to enter 0000 is just asking for troubles. On the next update some
internal XML crap (please excuse the expression) might get changed, and
its broken again. I saw this happen several times before.

Looking at your example I would like to write in my .asoundrc something
like

pcm.bluetooth {
  type bluetooth
  device 00:0F:59:11:XX:XX
  pin 0000			<<<<<<<
}

pcm.!default {
 type plug
 slave {
   pcm bluetooth
 }
}

That gives you all information needed for pairing: The device and the
pin. 0000 should be the default pin, of course.

This change could help _alot_ to improve A2DP support on Linux.

BTW, I was never asked to enter 0000 on my Belkin A2DP receiver.
It doesn't even have a single key to press. _Thats_ ease of use.


Regards

Harri