How to setup Bluetooth
This is a subjective story about my experiences connecting a Thinkpad T43 running Gentoo and a Nokia N70 using Bluetooth, but I suppose most of the stuff here is generic stuff about how to connect laptops with linux with cellphones using bluetooth.
The kernel used was 2.6.14-gentoo, patched up to get the SATA working after suspend-to-memory.
First of all, installation of Bluez; the following gentoo ebuilds was installed:
net-wireless/bluez-kernel was also installed, but later I read it should not be needed when running 2.6-kernel - it could even be harmful.
The first blocker I met was that I failed to realize the bluetooth adapter is connected to the laptop through the USB interface. I could not turn on/off the bluetooth LED using Fn-F5 nor by enabling it through /proc/acpi/ibm/bluetooth. After loading USB modules it worked as a charm:
- modprobe uhci_hcd ; modprobe ehci_hcd
In the kernel configuration, I turned most of the bluetooth stuff to <M>; it can be found in the Networking section of the linux configuration. However, I found out that "RFCOMM protocols support" and "RFCOMM TTY support" (CONFIG_BT_RFCOMM and CONFIG_BT_RFCOMM_TTY) has to be built into the kernel (and not as a module), and to get that right, Bluetooth (CONFIG_BT) and L2CAP (CONFIG_BT_L2CAP) also has to be configured as built-in.
I found an explaination at http://www.gentoo.org/doc/en/bluetooth-guide.xml about how to set up Bluetooth in Gentoo. I followed most of the steps, but be particularly aware of the notes above on kernel configuration.
One of the reasons for getting that bluetooth connection up was to be able to use GPRS or 3G (UMTS) for connecting my laptop to internet. I was googling a bit on it, and I was pretty surprised to learn that one should communicate with the modem using AT-commands - that's stuff we did in the previous millenium, causing our modems to make lots of fancy sounds. By configuring /etc/bluetooth/rfcomm.conf correctly, I got a device /dev/rfcomm0 - eventually one could use the command:
- rfcomm bind 0 00:15:A0:7A:90:F2 3
Where the HW address should be replaced with that of your phone - if you don't know the hardware address of your phone yet, you can find it running:
- hcitool scan
and '3' is the channel to use. I spent quite some time fighting before I found out of that one; I didn't find it documented anywhere, but by running
- sdptool records 00:15:A0:7A:90:F2
I found channel 3 to be the right one.
Now that /dev/rfcomm0 exists, one can try to access it i.e. by using minicom:
- minicom -s
set the serial device to be '/dev/rfcomm0', chose 'exit' and then the AT-commands can be typed in. With my operator (Telenor, Norway) it seemed simple enough, I just entered
- ATDT *99#
and lots of cryptic letters started dancing across the screen, indicating a ppp session startup.
Then, to run pppd - I created /etc/ppp/peers/nokia with particularly those lines:
- connect '/usr/sbin/chat -v -f /etc/ppp/chat-nokia'
and a simple /etc/ppp/chat-nokia 'TIMEOUT' '5' 'ABORT' 'BUSY' 'ABORT' 'ERROR' 'ABORT' 'NO ANSWER' 'ABORT' 'NO CARRIER' 'ABORT' 'NO DIALTONE' 'ABORT' 'Invalid Login' 'ABORT' 'Login incorrect' 'ATZ' 'OK' 'ATDT*99#' '~--'
and then I entered
- pppd call nokia
and I got Internet.
For doing anything else, I think gammu is the best option, though I didn't get it to communicate with my phone yet.