How to setup Bluetooth
Building from source
Get the source packages from www.bluez.org.
Build each of them with the usual steps:
$ ./configure && make
# make install
Under Gentoo, install the following ebuilds:
If Bluetooth is disabled and you have Ibm-acpi running you could enable/disable bluetooth by entering:
# echo enable > /proc/acpi/ibm/bluetooth
# echo disable > /proc/acpi/ibm/bluetooth
Configuring the kernel
Since the Bluetooth card is connected to the USB subsystem, you will need to enable USB support in your kernel:
- Device Drivers → USB support → <M>Support for Host-side USB (CONFIG_USB)
- Device Drivers → USB support → [*]USB device file system (CONFIG_USB_DEVICEFS)
Choose an appropriate USB host driver, one of:
- Device Drivers → USB support → <M>EHCI HCD (USB 2.0) support (CONFIG_USB_EHCI_HCD)
- Device Drivers → USB support → <M>UHCI HCD support (CONFIG_USB_UHCI)
- Device Drivers → USB support → <M>OHCI HCD support (CONFIG_USB_OHCI)
Enable Bluetooth subsystem and drivers:
- Networking → <*>Bluetooth subsystem support (CONFIG_BT)
- Networking → Bluetooth subsystem support → <*>L2CAP protocol support (CONFIG_BT_L2CAP)
- Networking → Bluetooth subsystem support → <*>SCO links support (CONFIG_BT_SCO)
- Networking → Bluetooth subsystem support → <*>RFCOMM protocol support (CONFIG_BT_RFCOMM)
- Networking → Bluetooth subsystem support → [*]RFCOMM TTY support (CONFIG_BT_RFCOMM_TTY)
- Networking → Bluetooth subsystem support → <*>BNEP protocol support (CONFIG_BT_BNEP)
- Networking → Bluetooth subsystem support → <*>HID protocol support (CONFIG_BT_HID)
- Networking → Bluetooth subsystem support → Bluetooth device drivers → <M>HCI USB driver (CONFIG_BT_HCIUSB)
- Networking → Bluetooth subsystem support → Bluetooth device drivers → [*]SCO (voice) support (CONFIG_BT_HCIUSB_SCO)
Make sure that the according modules are loaded:
# modprobe uhci_hcd ; modprobe ehci_hcd ; modprobe hci_usb
Serial connection over Bluetooth
One common application is to connect your mobile phone and use it as a modem to connect to the internet via GPRS or 3G (UMTS). A lot of phones do this through using AT-commands on a serial over Bluetooth connection.
By configuring /etc/bluetooth/rfcomm.conf correctly, you'll get a device /dev/rfcomm0.
Eventually one could use the command:
# rfcomm bind 0 00:15:A0:7A:90:F2 3
The hardware address should be replaced with that of your phone. If you don't know the hardware address of your phone yet, you can get it by running:
# hcitool scan
The last parameter ('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 for my phone. You will have to experiment to find the right one for your phone setup; for T-Mobile GSM/GPRS carrier in USA this is channel 1.
Alternativly one could use the following to find the right channel:
# sdptool search DUN
Inquiring ... Searching for DUN on 00:11:22:33:44:55 ... Service Name: Dial-up Networking Service RecHandle: 0x10001 Service Class ID List: "Dialup Networking" (0x1103) "Generic Networking" (0x1201) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 4
Now /dev/rfcomm0 exists.
At this point you can use an automatic dialing utility such as wvdial, editing the config file to point to the modem at /dev/rfcomm0, and everything should work just like a land line!
You may directly access the modem (i.e. by using minicom:)
$ minicom -s
set the serial device to be /dev/rfcomm0, choose '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.
To configure pppd create /etc/ppp/peers/nokia with particularly those lines:
/dev/rfcomm0 connect '/usr/sbin/chat -v -f /etc/ppp/chat-nokia' debug 10.0.1.3 crtscts noipdefault ipcp-accept-local defaultroute novj nobsdcomp novjccomp nopcomp noaccomp usepeerdns
Furthermore, you need a simple chat script. Create /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#' '~--'
Run pppd with:
$ pppd call nokia
This should establish the internet connection.
For editing phonebook / ringtones / etc., the gammu utils (http://www.gamu.net) has been reported to work well, but this appears to be primarily for Nokia phones.
File transfers are accomplished through OBEX transfer, which I believe is basically an FTP over bluetooth connection. Once you have bonded with your phone (yes, I know you love your sexy RAZR, but here I mean paired it with your laptop via bluetooth), you can easily use "obexftp" to transfer files. As an example,
- obexftp -b 00:01:02:03:04:05 -l
will list the root directory of the phone with bluetooth address 00:01:02:03:04:05. Refer to the man page for more of the unique commands. What a wonderful interface! Unfortunately there doesn't seem to be a way to get a standard 'ftp' session using familiar commands (e.g. 'mget').
For a more user-friendly experience, you can use the kde tools, just launch
for a file browser. In the Location: option put
to list the files. Note that the brackets *are* necessary. From there, you can list directories easily and batch download files.