linux

Connect a bluetooth headset to linux

Finally I could connect a bluetooth headset to linux. First I upgraded from Ubuntu 8.04 (Hardy Heron) to Ubuntu 8.10 (Intrepid Ibex). Make sure both your bluetooth interface and your headset is on.
Then find your device's mac address:

$ sudo hcitool scan
Scanning ...
        00:15:A0:B4:BE:E6       Nokia BH-200

Load the necessary modules snd-bt-sco and sco.

Enable the bluetooth audio stack with

$ sudo hciconfig hci0 voice 0x0060

(or Autostart=true in /etc/bluetooth/audio.service

Create ~/.asoundrc:

pcm.bt {
        type plug
        slave {
                pcm "bt_hw"
        }
}

pcm.bt_hw {
        type bluetooth
        device 00:15:A0:B4:BE:E6
        profile "auto"
}

And tada, it woks. Supposed you have a daemon that handles the pairing. And the program you would like to use supports the selection of a device. (Some programs work with bt, some with bt_hw.)

How to test:

$ arecord -D bt -f S16_LE /tmp/lol.wav
$ aplay -D bt -f S16_LE /tmp/lol.wav

Some programs like Ekiga will not work, as they rely on an outdated infrastructure realized by the deprecated btsco daemon.

http://wiki.bluez.org/wiki/HOWTO/AudioDevices

How to detach from the parent process?

Ever wondered how does screen realize it's persistence, i.e. even when killing it's parent process (e.g. you detach screen and logout afterwards), you can restore the state in the moment of detachment by reattaching the screen session.

The magic is done by setsid(2) by creating a new session with the current process as the only member.

Using GMail as the default e-mail application in linux

Many Linux distributions allow you to select a default e-mail application to use. You should have the option to specify a custom one.
For GMail users it is convenient that clicking on an e-mail field, GMail and not, say Evolution pops up.

This small script can be used to achieve this:

#!/bin/sh
 
if [ "$#" -eq 1 ]; then
    suffix="/mail?view=cm&tf=0&to="`echo $1 | sed 's/mailto://'`
fi
 
firefox -remote "openurl(https://mail.google.com$suffix,new-tab)"

If an argument is present, (after trimming mailto:) it treats it as an addressee, and opens a compose page. Otherwise it opens the default inbox page. Pages are opened in a new tab and the script returns immediately.

Syndicate content