Hooking up Arctic P311 Bluetooth Headset with KDE 4.6.x on openSUSE 11.4 [Update]

Hooking up Arctic P311 Bluetooth Headset with KDE 4.6.x on openSUSE 11.4

I’ve got myself a  Arctic P311 bluetooth headset and am now trying to pair it with my openSUSE 11.4, KDE system. But…:/ But I guess, there’ll be some updates to come to this post, until it

  1. Works, or
  2. I give up:/
Trying to pursue solution „a“ here🙂

Let’s start.

At first, it doesn’t work. Let’s see, how to make it work.

As you can see there (if you click on the image *G*), the Bluedevil Bluetooth stack of KDE 4.6 from openSUSE 11.4 doesn’t seem to properly recognize the headset. I suspect it might be, because openSUSE 11.4 and its software is too old and maybe doesn’t recognize the device class? Resorting to command line tools…

ask@ewzw032:~> /usr/sbin/hciconfig
hci0:   Type: BR/EDR  Bus: USB
        BD Address: 00:1B:DC:04:B4:25  ACL MTU: 310:10  SCO MTU: 64:8
        UP RUNNING PSCAN ISCAN
        RX bytes:380932 acl:341 sco:5615 events:5763 errors:0
        TX bytes:2790922 acl:9311 sco:5677 commands:143 errors:222

ask@ewzw032:~> hcitool scan
Scanning ...
        00:1A:7D:60:67:1F P311

ask@ewzw032:~> hcitool inq
Inquiring ...
        00:1A:7D:60:67:1F       clock offset: 0x4941    class: 0x240404

ask@ewzw032:~> hcitool info 00:1A:7D:60:67:1F
Requesting information ...
        BD Address:  00:1A:7D:60:67:1F
        Device Name: P311
        LMP Version: 2.1 (0x4) LMP Subversion: 0x14fa
        Manufacturer: Cambridge Silicon Radio (10)
        Features page 0: 0xff 0xfe 0x0f 0xc6 0x8b 0xef 0x59 0x83
                <3-slot packets> <5-slot packets> <encryption> <slot offset>
                <timing accuracy> <role switch> <hold mode> <sniff mode>
                <RSSI> <channel quality> <SCO link> <HV2 packets>
                <HV3 packets> <u-law log> <A-law log> <CVSD> <paging scheme>
                <power control> <transparent SCO> <EDR ACL 2 Mbps>
                <EDR ACL 3 Mbps> <inquiry with RSSI> <extended SCO>
                <EV4 packets> <EV5 packets> <AFH cap. slave> <3-slot EDR ACL>
                <5-slot EDR ACL> <sniff subrating> <pause encryption>
                <AFH cap. master> <EDR eSCO 2 Mbps> <EDR eSCO 3 Mbps>
                <3-slot EDR eSCO> <extended inquiry> <simple pairing>
                <encapsulated PDU> <non-flush flag> <LSTO> <inquiry TX power>
                <extended features>
        Features page 1: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00

Is the „class: 0x240404“ maybe not supported? But disregarding this, I think hcitool showed good results.

Googling a bit, I found a blog entry on „Edwards Tech notes„, where the guy shows how setup a (not so…) different BT headset on Gentoo.

I think the KEY was to invoke once the Gnome Bluetooth tool:

ask@ewzw032:~> bluetooth-wizard

Add access to all computer Bluetooth resources for the headset.

After that (at least I assume so…), the „trusts“ file was created/updated with „good“ content:

ask@ewzw032:~> cat "/var/lib/bluetooth/00:1B:DC:04:B4:25"/trusts
67:12:54:28:77:00 [all]
00:1A:7D:60:67:1F [all]

Edward showed, that he had to create this file manually. I did not. For me, the important 2nd line was „automagically“ there. Anyhows — if it weren’t, here’s the logic how to create it:

ask@ewzw032:~> dongle_addr='00:1B:DC:04:B4:25'
ask@ewzw032:~> headset_addr='00:1A:7D:60:67:1F'
ask@ewzw032:~> sudo mkdir -p /var/lib/bluetooth/"$dongle_addr"
ask@ewzw032:~> printf "%s [%s]\n" "$headset_addr" "all" | sudo tee -a /var/lib/bluetooth/"$dongle_addr"/trusts
00:1A:7D:60:67:1F [all]

Get the default adapter path

ask@ewzw032:~> dbus-send --print-reply --system --dest=org.bluez / org.bluez.Manager.DefaultAdapter
method return sender=:1.36883 -> dest=:1.39835 reply_serial=2
 object path "/org/bluez/3587/hci0"
ask@ewzw032:~> adapter_path=$(
 dbus-send --print-reply --system --dest=org.bluez / org.bluez.Manager.DefaultAdapter \
 | grep /org/bluez/ | sed 's,.*"\(.*\)".*,\1,'
 )

Get the path for the headset

ask@ewzw032:~> dbus-send --print-reply --system --dest=org.bluez $adapter_path org.bluez.Adapter.FindDevice string:"$headset_addr"
method return sender=:1.36883 -> dest=:1.40177 reply_serial=2
 object path "/org/bluez/3587/hci0/dev_00_1A_7D_60_67_1F"
ask@ewzw032:~> headset_path=$(
 dbus-send --print-reply --system --dest=org.bluez $adapter_path org.bluez.Adapter.FindDevice string:"$headset_addr" \
 | grep /org/bluez/ | sed 's,.*"\(.*\)".*,\1,'
 )

Open a connection to the headset using A2DP sterio audio

ask@ewzw032:~> cmd="org.bluez.AudioSink.Connect" ; dbus-send --print-reply --system --dest=org.bluez $headset_path $cmd
Error org.bluez.Error.AlreadyConnected: Already Connected
ask@ewzw032:~> cmd="org.bluez.AudioSink.Disconnect" ; dbus-send --print-reply --system --dest=org.bluez $headset_path $cmd
method return sender=:1.36883 -> dest=:1.40219 reply_serial=2
ask@ewzw032:~> cmd="org.bluez.AudioSink.Connect" ; dbus-send --print-reply --system --dest=org.bluez $headset_path $cmd
method return sender=:1.36883 -> dest=:1.40220 reply_serial=2

Test connecting to the headset using Headset Profile HSP / Hands-Free Profile HFP

ask@ewzw032:~> cmd="org.bluez.Headset.Connect" ; dbus-send --print-reply --system --dest=org.bluez $headset_path $cmd
Error org.bluez.Error.AlreadyConnected: Already Connected
ask@ewzw032:~> cmd="org.bluez.Headset.Disconnect" ; dbus-send --print-reply --system --dest=org.bluez $headset_path $cmd
method return sender=:1.36883 -> dest=:1.40226 reply_serial=2
ask@ewzw032:~> cmd="org.bluez.Headset.Connect" ; dbus-send --print-reply --system --dest=org.bluez $headset_path $cmd
method return sender=:1.36883 -> dest=:1.40227 reply_serial=2

Following what Edward did, here’s my PulseAudio setup.

ask@ewzw032:~> pacmd "list-cards"
Welcome to PulseAudio! Use "help" for usage information.
>>> 2 card(s) available.
    index: 0
        name: <alsa_card.pci-0000_00_1b.0>
        driver: <module-alsa-card.c>
        owner module: 4
        properties:
                alsa.card = "0"
                alsa.card_name = "HDA Intel"
                alsa.long_card_name = "HDA Intel at 0xf01a0000 irq 42"
                alsa.driver_name = "snd_hda_intel"
                device.bus_path = "pci-0000:00:1b.0"
                sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"
                device.bus = "pci"
                device.vendor.id = "8086"
                device.vendor.name = "Intel Corporation"
                device.product.id = "293e"
                device.product.name = "82801I (ICH9 Family) HD Audio Controller"
                device.form_factor = "internal"
                device.string = "0"
                device.description = "Internes Audio"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card-pci"
        profiles:
                output:analog-stereo: Analog Stereo Output (priority 6000)
                output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6060)
                output:iec958-stereo: Digital Stereo Duplex (IEC958) (priority 5500)
                output:iec958-stereo+input:analog-stereo: Digital Stereo (IEC958) Output + Analog Stereo Input (priority 5560)
                input:analog-stereo: Analog Stereo Input (priority 60)
                off: Aus (priority 0)
        active profile: <output:analog-stereo+input:analog-stereo>
        sinks:
                alsa_output.pci-0000_00_1b.0.analog-stereo/#0: Internes Audio Analog Stereo
        sources:
                alsa_output.pci-0000_00_1b.0.analog-stereo.monitor/#0: Monitor of Internes Audio Analog Stereo
                alsa_input.pci-0000_00_1b.0.analog-stereo/#1: Internes Audio Analog Stereo
    index: 3
        name: <bluez_card.00_1A_7D_60_67_1F>
        driver: <module-bluetooth-device.c>
        owner module: 25
        properties:
                device.description = "P311"
                device.string = "00:1A:7D:60:67:1F"
                device.api = "bluez"
                device.class = "sound"
                device.bus = "bluetooth"
                device.form_factor = "headset"
                bluez.path = "/org/bluez/3587/hci0/dev_00_1A_7D_60_67_1F"
                bluez.class = "0x240404"
                bluez.name = "P311"
                device.icon_name = "audio-headset-bluetooth"
                device.intended_roles = "phone"
        profiles:
                a2dp: High Fidelity-Wiedergabe (A2DP) (priority 10)
                hsp: Telephony Duplex (HSP/HFP) (priority 20)
                off: Aus (priority 0)
        active profile: <a2dp>
        sinks:
                bluez_sink.00_1A_7D_60_67_1F/#5: P311
        sources:
                bluez_sink.00_1A_7D_60_67_1F.monitor/#9: Monitor of P311

I then set the card to use HSP/HFP profile using the card name from above

ask@ewzw032:~> pacmd "set-card-profile bluez_card.$( echo $headset_addr | tr : _ ) hsp" ; echo
Welcome to PulseAudio! Use "help" for usage information.
>>> >>>

And set the headset as the default source and sink device.

ask@ewzw032:~> pacmd "set-default-sink bluez_sink.$( echo $headset_addr | tr : _ )" ; echo
Welcome to PulseAudio! Use "help" for usage information.
>>> >>>
ask@ewzw032:~> pacmd "set-default-source bluez_source.$( echo $headset_addr | tr : _ )" ; echo
Welcome to PulseAudio! Use "help" for usage information.
>>> >>>

DONE!

That’s all I had to do. After that, I could start  the KDE control center and in Multimedia → Phonon select the P311.

When I now play something in Amarok, sound is sent to the headet. #iLike😉


Update

The Bluetooth connection seems to work fine now, but I’m not really happy with this… I found, that after using Amarok for some time, including completely stopping/starting Amarok multiple times, sound output starts to „stutter“. With that, I mean that it plays for 0.1s, then there’s a pause of sorts for 0.1s and playback starts again.

Bad😦

Is this maybe because of PulseAudio, which is used by openSUSE?

I found that it’s not (strictly) related to Amarok, though. If sound is „choppy“, also other tools have this chopped sound, eg.:

env PULSE_SINK=bluez_sink.00_1A_7D_60_67_1F \
  padsp \
  sox /usr/share/sounds/linphone/rings/oldphone.wav -t ossdsp /dev/dsp

This uses sox to play some .wav file on „/dev/dsp“, which routed by the „padsp“ command to PulseAudio and PulseAudio plays it on the mentioned „sink“, which is my bluetooth headset.

If I, however, disconnect the „Headset Service“ and/or „Audio Sink“ bluetooth connection and connect again, playback is fine. I don’t know what causes the sound to become choppy, though😦

Why can’t it be as simple as under OS X? Is this rocket science?😦

2 thoughts on “Hooking up Arctic P311 Bluetooth Headset with KDE 4.6.x on openSUSE 11.4 [Update]

  1. Hello, i read your blog occasionally and i own a similar one and i was just wondering if you get a lot of spam feedback?
    If so how do you reduce it, any plugin or anything you can advise?
    I get so much lately it’s driving me insane so any support is very much appreciated.

Schreibe einen Kommentar

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s