Much ado about scripting, Linux & Eclipse: card subject to change

Showing posts with label bluez. Show all posts
Showing posts with label bluez. Show all posts

2008-11-15

HOWTO: Bluetooth for Linux (2)

Connecting a Thinkpad X200 to a Sony DR-BT30Q Headset

10 months ago, I went through this exercise on my old T60p. Almost a year later, now running Fedora 10 on an X200, it was still a pain to set up. Really, this should Just Work. It's too bad that some things in Linux are still overly complex.

Anyway, after much ado with outdated walkthroughs, I finally found useful advice for setting up my Sony DR-BT30Q Bluetooth headset to work with my Fedora 10 X200 Thinkpad.

First off, here's what I installed along the way before I finally got things working (/var/log/yum.log):

Nov 15 15:08:03 Installed: pidgin-rhythmbox-2.0-3.fc9.i386
Nov 15 15:15:42 Installed: autoconf-2.63-1.fc10.noarch
Nov 15 15:15:43 Installed: bluez-hcidump-1.42-2.fc10.i386
Nov 15 15:15:44 Installed: alsa-tools-1.0.17-1.fc10.i386
Nov 15 15:15:46 Installed: automake-1.10.1-2.noarch
Nov 15 15:15:48 Installed: alsa-utils-1.0.18-3.rc3.fc10.i386
Nov 15 15:15:51 Installed: alsa-lib-devel-1.0.18-6.rc3.fc10.i386
Nov 15 15:23:01 Installed: bluez-gnome-analyzer-1.8-8.fc10.i386
Nov 15 15:23:01 Installed: obexd-0.6-1.fc10.i386
Nov 15 15:23:01 Installed: bluez-gstreamer-4.17-2.fc10.i386
Nov 15 15:23:01 Installed: bluez-libs-devel-4.17-2.fc10.i386
Nov 15 15:23:02 Installed: pybluez-0.15-2.fc10.i386
Nov 15 15:23:03 Installed: bluez-alsa-4.17-2.fc10.i386
Nov 15 15:30:42 Installed: libbtctl-0.10.0-5.fc10.i386
Nov 15 15:30:42 Installed: gnome-bluetooth-libs-0.11.0-5.fc10.i386
Nov 15 15:30:44 Installed: gnome-bluetooth-0.11.0-5.fc10.i386
Nov 15 15:38:42 Installed: libtool-1.5.26-4.fc10.i386
Nov 15 15:53:49 Installed: 1:glib-1.2.10-30.fc10.i386
Nov 15 15:55:27 Installed: glib2-devel-2.18.2-3.fc10.i386
Nov 15 15:56:45 Installed: dbus-devel-1.2.4-1.fc10.i386
Nov 15 15:56:46 Installed: dbus-glib-devel-0.76-2.fc10.i386
Nov 15 16:43:17 Installed: python-alsa-1.0.17-1.fc10.i386
Nov 15 16:43:19 Installed: alsa-firmware-1.0.17-1.fc10.noarch
Nov 15 16:43:19 Installed: alsa-tools-firmware-1.0.17-1.fc10.i386
Nov 15 16:49:27 Installed: 8:arts-1.5.10-1.fc10.i386
Nov 15 16:49:28 Installed: libgadu-1.8.2-1.fc10.i386
Nov 15 16:49:30 Installed: kadu-0.6.0.1-1.fc10.i386
Nov 15 16:49:30 Installed: kadu-mediaplayer-0.6.0.1-1.fc10.i386
Nov 15 16:49:35 Installed: lash-0.5.4-2.fc9.i386
Nov 15 16:49:35 Installed: fluidsynth-libs-1.0.8-2.fc10.i386
Nov 15 16:49:36 Installed: libbinio-1.4-9.fc9.i386
Nov 15 16:49:36 Installed: lirc-libs-0.8.4a-1.fc10.i386
Nov 15 16:49:36 Installed: libsidplay-1.36.57-17.i386
Nov 15 16:49:36 Installed: kadu-audacious_mediaplayer-0.6.0.1-1.fc10.i386
Nov 15 16:49:38 Installed: audacious-plugins-1.5.1-2.fc10.i386
Nov 15 16:49:41 Installed: audacious-1.5.1-4.fc10.i386
Nov 15 16:49:41 Installed: audacious-plugins-arts-1.5.1-2.fc10.i386

I didn't end up needing to compile btsco from source (which is good since it wouldn't compile!), but I'm sure some of the stuff installed above is required or will be useful eventually.

What did work was this:

  1. Put device into pairing mode. Use Gnome's Bluetooth Applet to connect to new device.
  2. Use hcitool to verify bluetooth radio is working, then discover the headset's MAC address.
    # hcitool dev
    Devices:
     hci0 00:22:44:66:88:00
    
    # hcitool scan
    Scanning ...
     00:11:22:33:44:55 DR-BT30Q
  3. Create ~/.asoundrc file:
    pcm.bluetooth {
       type bluetooth
       device 00:11:22:33:44:55
       profile "auto"
    }
    
    pcm.bluetoothraw {
       type bluetooth
       device 00:11:22:33:44:55
    }
    pcm.bluetooth {
        type plug
        slave {
            pcm bluetoothraw
        }
    }
  4. Install audacious.
  5. Start up audacious. Right-click and select Preferences > Audio > Current Output Plugin > ALSA Output Plugin.
  6. Click Output Plugin Preferences, then under Device settings > Audio device enter "bluetoothraw".
  7. Turn on headset if not already on.
  8. Start playing!

2008-01-29

HOWTO: Bluetooth for Linux

Connecting a Thinkpad T60p to a Sony DR-BT30Q Headset

A month or so ago, I scored a Sony Wireless Stereo Headset (DR-BT30Q) with my accumulated Aeroplan miles. Then, when they arrived, I discovered to my dismay that while my SonyEricsson W810i supports Bluetooth 2.0, is DOES NOT support A2DP (Advanced Audio Distribution Profile) or AVRCP (Audio Video Remote Control Profile). So, while I can use 'em to answer the phone, I can't use them to listen to music on my Walkman-branded MP3-playing phone. Last I checked, SE had no intention of publishing updated firmware or any other way of installing these profiles onto existing phones. Way to go, SE.

Anyway, tonight, in a burst of insomnia, I decided to try to install the BlueZ stack on my Thinkpad and try to get these things working. To my pleasant surprise, it worked! Here's the process:

  1. Install bluez & utils
    apt-get install bluez bluez-utils bluez-firmware bluez-hcidump bluetooth bluez-audio kdebluetooth python-bluez
  2. Install a bluez-friendly audio player, like audacious.
    apt-get install audacious
  3. Install Thinkpad button support.
    apt-get install tpb
  4. (Re)start the bluetooth radio -- I tried /etc/init.d/bluetooth restart but it was Fn-F5 that actually turned on the radio. (This is why I needed tpb.)
  5. I ran a2dp.sh a few times, but it never managed to find my device's MAC address.
  6. I then tried to play with hcitool and dbus-send to manually connect to the headset, but that failed miserably. I did however, find the headset's MAC address.
  7. I manually added my device's bluetooth address into ~/.asoundrc, but that also didn't help.
  8. I noticed that the ~/.a2dp/a2dp.py script (created in step 5) was missing the MAC address, so I added it by hand.
  9. I started up K-Menu > System > Settings > kbluetooth and played around with that a little -- no luck.
  10. I started up audacious (and configured it to use bluetooth).
  11. I loaded up the latest episode of Real Synthetic Audio and started it playing.
  12. NOW, finally, I was prompted to authenticate my bluetooth radio with the headset. I entered the standard code, 0000, and voom -- wireless audio! Now all I need is a spiritual awakening, I suppose. :D