Monday, April 27, 2009

More Bluetooth Woes in Jaunty Jackalope

I'm adding this to my list of bugs I hope they fix soon.

Easiest way to get Bluetooth Audio I've found so far:

1. Follow these instructions up to step 9.
2. Follow these instructions after that.

Here's the text (sort of) for each:


  1. First we need to add the Blueman Project’s PPA to your Ubuntu Jaunty installation. Open a terminal and type in:
    $ sudo gedit /etc/apt/sources.list.d/blueman.list
  2. You will be presented with a blank text editor. Type or copy & paste the following lines in:
    deb jaunty main
    deb-src jaunty main
  3. Save your changes and exit the editor.

  4. Now update your package lists with:
    $ sudo apt-get update
  5. At the end you will see a NO_PUBKEY error because your setup does not yet have the GPG key for the Blueman repository to authenticate the packages with. To fix this, import the key with:
    $ sudo apt-key adv --keyserver --recv-keys 6B15AB91951DC1E2
  6. Update your package lists again as per Step 4 and you should find the NO_PUBKEY error is gone now.

  7. By now your system is probably prompting you that there are updates to the Bluetooth stack available to install. We may as well stay at the terminal and do the updates there:
    $ sudo apt-get upgrade
  8. Once that completes, the Bluetooth stack is now up to date, but we now need to install the Blueman applet to replace the Gnome version of it:
    $ sudo apt-get install blueman

    (this will automatically uninstall the bluez-gnome package as we don’t want it anymore)

  9. Once that completes, logout and log back in again so that the new applet loads up to replace the old one.


  1. Fire up/install Ubuntu as normal.
  2. Plug in or enable your Bluetooth adapter. Your Bluetooth adapter will be automatically detected and drivers loaded - there is nothing for you to do manually here.
  3. Turn on your Bluetooth headset.
  4. Switch your headset into pairing mode (refer to your headset's manual).
  5. While the headset is in pairing mode, left click the Bluetooth icon in your system tray and choose "Setup new device" from the menu. Follow the wizard prompts to seek out and pair your headset.
  6. Once paried, open a terminal, and type in the following:
    $ hcitool scan
    Your PC will now scan for local Bluetooth devices and your headset should appear in the resulting list after a few seconds (along with anyone's Bluetooth-enabled mobile phones that are in range). The output will look something like:
    $ hcitool scan
    Scanning ...
    00:11:22:AA:BB:CC Nokia N95
    00:33:44:DD:EE:FF BT81
    In this example, my PC has found my Nokia mobile phone and my Bluetooth headset and shown me the MAC addresses for both of them.

  7. Highlight and copy the MAC address of the headset to the clipboard using your mouse and CTRL + SHIFT + C. In this example my headset's MAC address is "00 : 33 : 44 : DD : EE : FF". Yours will be different - copy YOUR address, not this example's address.
  8. Now type in:
    sudo gedit ~/.asoundrc
    Note the period before "asoundrc". This will create a new hidden text file called .asoundrc in the root of your Home directory and open GEdit so you can add to it. The file is hidden because of the leading period.

  9. In the text editor, type in the following, replacing the MAC address in the example with the one you copied earlier from YOUR output (paste with CTRL + V):
    pcm.btheadset {
    type bluetooth
    device 00:33:44:DD:EE:FF
    profile "auto"
  10. Save and exit.
  11. Now type in:
    $ sudo hciconfig hci0 voice 0x0060
    This will enable your Bluetooth adapter to carry Bluetooth audio.

  12. Now we need to tell PulseAudio that your Bluetooth headset exists:
    $ pactl load-module module-alsa-sink device=btheadset
    $ pactl load-module module-alsa-source device=btheadset
    Note that this enables your Bluetooth headset for PulseAudio only temporarily. When you reboot, the PulseAudio configuration for Bluetooth will be lost. For future convenience, create a bash script with the above commands in it and create a launcher on your desktop to run the commands when you double-click on the launcher icon. Due to needing to have the headset paired BEFORE you run these commands, you cannot have these commands run automatically during system startup. It will cause PulseAudio to fail.

  13. Once pairing has completed, we can now test to see if we can send audio to the headset. In your terminal, type in the following:
    $ aplay -D btheadset -f s16_le /usr/share/sounds/ubuntu/stereo/dialog-question.wav
    This will attempt direct communication with your headset, and within a second or so, you should suddenly hear the familiar Ubuntu "login ready" drum sound play through your headset! If you didn't head it first time, try the command a second time as there may be a delay between "activating" your headset and playing sound.

    Unfortunately only aplay will play anything through your headset. All other sounds are still coming through your speakers. Unless the application in question can redirect audio to another detected device, it will always play through the standard-out, so applications such as Totem and Rhythmbox will still output via your speakers and not give a hoot about your Bluetooth headset. To fix this, we need to make use of the PulseAudio Server which can redirect output to another device.

  14. The PulseAudio Server is already installed by default in Ubuntu Jaunty, so we just need to install some tools to manipulate it. Go back to your terminal and type in the following:
    $ sudo apt-get install paprefs paman padevchooser
    This will install the PulseAudio Preferences app, the PulseAudio Manager app and the PulseAudio Device Chooser app.

  15. Once installed, go to Applications->Sound & Video->PulseAudio Device Chooser. This will add a black microphone jack icon to your system tray.
  16. Do a left-click on the jack icon and a menu appears. In this menu, choose "Manager". A new window appears.
  17. If it's not already connected, click on the "Connect" button to connect to your local PulseAudio server. When connected, you will see details about it listed.
  18. Click on the Devices tab. Under "Sinks" you should see an entry for "alsa_output.btheadset". This is picked up directly from your .asoundrc file.
  19. Now go to the Sample Cache tab. You are shown a list of sounds. Choose a WAV file from this list (it won't play any other format). At the bottom is a "Playback on" drop-down. Choose "alsa_output.btheadset" from this list and click on the Play button. You should hear the Ubuntu "login ready" sound through your speakers. This proves to us that PulseAudio can play through your Bluetooth headset (but this is NOT the redirection - this is just a test).
  20. Close the PulseAudio Manager.
  21. Do another left-click on the mic jack icon in your system tray.
  22. Go to "Default Sink" and then choose "Other" from the sub-menu. A window appears.
  23. In this window, type in "alsa_output.btheadset" and click OK.
  24. Play a sound from somewhere, eg: MP3 or movie in Totem. You should now hear your audio coming through your Bluetooth headset! NOTE: Existing audio streams at the time of changing the sink will continue to play through whatever they were playing through until stopped and started again.
  25. To switch back to your speakers, simply click on the mic jack icon again, choose "Default Sink" and choose "Default" from the sub-menu. The next audio stream played will go back through your speakers.
  26. To make the PulseAudio Device Chooser start automatically on startup, click on the mic jack icon again, choose Preferences from the menu and then click on "Start applet on Session Login" in the window.
  27. Enjoy!

  • This does not work with Skype. Despite the "btheadset" device being listed as a Sound Device option within Skype, you will get errors when it tries to playback or record audio via the headset and it will in fact kill the PulseAudio server forcing you to restart PulseAudio or your PC to get it running again. I have not figured this one out yet.
  • You cannot have your headset auto-pair and be auto-configured with PulseAudio upon startup (yet?). You will need to pair first, then run the two "pactl" commands in step 10 manually or via a script launcher. Before you say "can't I put those commands in startup?", you cannot have these commands auto-run on startup or PulseAudio will hang or crash (because the pairing with your headset has not been established yet).
  • The Sound Recorder is unable to lock onto the headset for recording audio (in fact, it goes nuts when trying to record).
  • The second "pactl" command in Step 12 may cause unusual undesired system behaviour. Since the second command only exists to setup the microphone on your headset, if you do not have one or don't intend to use the microphone, you may omit this line.

Saturday, April 25, 2009

Connecting to LG env2 with Bluetooth not working...

Just tried sending some pics to my laptop from the phone and couldn't get the connection to work. Will investigate and post the results as soon as possible.

*EDIT: I can now send/receive pictures/video from my phone but I can't browse files on the phone.

To get it working, I installed gnome-user-share, then open System -> Preferences -> Personal File Sharing and set the option to receive files over bluetooth.
This information was found here.

The browsing thing seems to have something to do with lack of support of OBEX, either by jaunty or the phone. Enabling obexftp should solve it, but I've installed the following without any improvement:

Will keep searching...

Friday, April 24, 2009

RDP Using rdesktop

Since switching to Ubuntu, I've been using the Terminal Services Client program (Applications->Internet->Terminal Services Client) to connect to my work VM which is hosted on a VMware ESX 3.5 u3 server. I used that VM prior to upgrading to Ubuntu (yes, it is an upgrade) and essentially used my laptop, as far as work was concerned, as a thin client.

One thing that always annoyed me was that the "full screen" option was just that - complete and total full screen! Ubuntu was washed completely from view and I was stuck in the land of dual-monitored ultra-Windows. If I hadn't installed an app on my remote VM called MaxTo, I would have had serious problems effectively using both monitors (hitting maximize would expand the windows to fill the entire desktop area of both monitors). However, at least with MaxTo installed, I could get my work done.

Even so, I still found hitting CTRL-ALT-ENTER each time I wanted to go back to my real desktop a bit annoying. I mean, in Windows, i had the option of defaulting to one monitor or using a switch to fill both montiors as was happening now (I can't remember that switch for windows but I'm sure I could find it if anyone is interested).

So, as usual, I turned to Google and the extensive Ubuntu forums. For just about everything I've investigated in Linux, there's an easier way to do something than in Windows. Turns out, I'd been using the easiest of easiest ways to connect (the GUI app) but the command line version had all kinds of goodies I could use! I quickly discovered how to create a new launcher with all my command line needs using:
man rdesktop
Here's my resulting launcher command line:
rdesktop -u kkeyser -d VMWAREM -x m -D -P -z -a 16 -g 1600x1200 -r clipboard:PRIMARYCLIPBOARD -r sound:remote
The only problem I've had is that I can't seem to get it as fast as connecting using the default rdesktop settings found through the GUI. There must be a switch I'm missing...

UPDATE: The switch I was missing was -b. Adding that to the command produced blazing fast RDP sessions with exactly what I needed! Give it a shot!

If anyone has any tips on getting the remote connection faster, I'd be happy to have the input!

Upgrading from Intrepid (8.10) to Jaunty (9.04)

This is kind of funny. I decided to let my machine upgrade from Intrepid Ibex (8.10) to Jaunty Jackalope (9.04) while I was in meetings all morning on Thursday. Great idea, I thought - let my machine toil away while I was away. And I was right (for the most part). I came back to a fresh, shiny new OS with better support for my machine than previously.

At work, it was an awesome new user experience with all kinds of improvements over Intrepid and since I've only been using Intrepid for a couple of weeks, THOUSANDS of improvements over my previous installation of Windows XP.

However, I had driven to work yesterday and hadn't had the normal 2 hours of bus riding to test out all the multimedia stuff. Today I did and ran into a serious problem. No support for playing back mkv, avi, mp4 or other video formats in Totem or VLC! When I went to launch the video, the program would crash with something similar to this error (reposted from another user with the same issue since I've resolved it on mine and can't reproduce the exact error):
Binary package hint: xserver-xorg-video-intel

xine, mplayer, or totem all crash when attempting to play any video file with an error like this one from xine:
This is xine (X11 gui) - a free video player v0.99.6cvs.
(c) 2000-2007 The xine Team.
X Error of failed request: BadAlloc (insufficient resources for operation)
Major opcode of failed request: 132 (XVideo)
Minor opcode of failed request: 19 ()
Serial number of failed request: 4731
Current serial number in output stream: 4732

This worked in Intrepid and does not work since updating to the Jaunty
As he said, this worked perfectly in Intrepid and stopped working in the newly released Jaunty. I did a bit more digging on why this was and found that they had upgraded some things such that DRI2 no longer worked with the newer version of the Intel graphics driver needed for the D430 (specifically, the Intel 945).

DOH! Now I was certain I'd either have to switch my virtual desktop size down to only allow monitor mirroring in order to get videos to work, or I'd have to downgrade to Intrepid again. Big doh. I haven't done a downgrade in Linux before and I wasn't sure what, if anything could go wrong... Then I stumbled across a possible solution. Downgrade the graphics driver to an older version than ships with Jaunty. 3D effects on the desktop would likely not work very well, if at all, but they never did (let's face it, the D430 isn't exactly a gaming machine!). Worth a shot, especially if I was considering downgrading anyway.

After following the instructions here, I rebooted and found that I could now set my virtual desktop back to normal size AND still watch my videos! Sweet success...

For anyone else out there wondering if they should upgrade their D430 or any laptop with an Intel 945 graphics card, fear not. There is a viable solution that doesn't severly hamper your experience. Why they shipped with this craptastic driver is beyond me. But they did. And because it's Linux, we can deal with it anyway. :)

Please post if a patch comes out for this. Thanks muchly!

UPDATE: With the old driver, I am noticing some lag when scrolling large pages such as full-screen Firefox... It looks like there are some issues even with this driver. :(

UPDATE2: I've leapfrogged to the xserver-xorg-video-intel 2.7.1 version driver. It seems to be working as good as 2.4 but there is still a noticable lag when scrolling pages of text (Firefox). :(

Helpful Ubuntu Links for Dell D430 Owners

Getting the Hardware Working (was valid for 8.10, may need updated for 9.04):

BluetoothAudio - Community Ubuntu Documentation
Installing Workstation on Ubuntu
Multi touch for any,all synaptics touchpad | ubuntu snippets
*OFFICIAL* Broadcom Linux driver BCM4312 | You’re Special, Just Like Everybody Else.
Ubuntu on dell d430
BluetoothHeadset - PulseAudio Fixes & System-Wide Equalizer Support...
Setup this before attempting to connect your bluetooth headset.
BluetoothHeadset - Community Ubuntu Documentation
Combine these instructions with the info for getting the Pulse Audio Server working. Once you do this, everything except VLC works perfectly with Bluetooth Headphones. Very cool.
BluetoothHeadset - Troubleshooting
Play and Rip DVDs with Ubuntu Linux
KVM on Ubuntu: Install with mouse, keyboard directly attached, reboot, hookup KVM
HOWTO: setup all 12 buttons on your Logitech MX1000 - Ubuntu Forums
Installing Windows Application Under Wine - Make Tech Easier
Touchpad - 2nd option works best
Knowliz: 20 Things to do after installing Ubuntu Linux
50 amazing Ubuntu time-saving tips | News | TechRadar UK
Installing VMware Workstation 6.5 in Ubuntu… » Yellow Bricks
Nautilus Scripts for GNOME
CompilingEasyHowTo - Community Ubuntu Documentation
25 killer Linux apps | News | TechRadar UK
Lifehacker - Five Tweaks for Your New Ubuntu Desktop - Ubuntu
20 Linux apps you can't live without | News | TechRadar UK - Linux Blog of Ideas
Typing Break and WorkRave: Keep RSI at Bay « Ubuntu Blog | community for sharing dotfiles like .bashrc, .vimrc, and .bash_profile
ubuntu snippets | Ubuntu Jaunty, Intrepid, Hardy, Gutsy, Tips & Tricks, News, Fixes, Tutors.