bluetooth

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

Using a mobile phone as a bluetooth modem for Linux

To get my cellular phone working as a bluetooth modem, I did the following:

First turn bluetooth on both on your computer and you mobile phone. Also make sure that for the first time the phone must be visible to everyone.
Also make sure that the internet already works on the phone, and check the used access point's name in the connection details.

To determine the address of your phone, issue:
$ hcitool scan
Scanning ...
00:16:BC:2E:C2:62 Lucy

Then you have to know the rfcomm channel number for this service:
$ sdptool search dun
Inquiring ...
Searching for dun on 00:16:BC:2E:C2:62 ...
Service Name: Dial-Up Networking
Service RecHandle: 0x10036
Service Class ID List:
"Dialup Networking" (0x1103)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 2
Language Base Attr List:
code_ISO639: 0x454e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100

Now just create a small and executable script, for example ~/bin/net.phone with:

#!/bin/sh
sudo rfcomm release rfcomm0
sudo rfcomm bind 0 00:1F:E4:15:8B:B1 2
sudo /etc/init.d/mldonkey-server stop
sudo pppd /dev/rfcomm0 115200 connect "chat -V -f /home/czigola/bin/net.phone.chat" crtscts modem -detach noccp defaultroute noauth ipcp-accept-remote ipcp-accept-local noipdefault usepeerdns
sudo /etc/init.d/mldonkey-server start

Please note, that I do stop P2P and restart it afterwards.

Also create in the appropriate directory a file containing the chat script (net.phone.chat):

ABORT BUSY
ABORT 'NO CARRIER'
ABORT VOICE
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
'' ATZ
OK-AT-OK AT+CGDCONT=1,"IP","wnw"
OK "ATD*99***1#"
CONNECT ''

Replace wnw with your access point's name. If it does not work, try using the number *99# .

Optionally you can configure /etc/bluetooth/rfcomm.conf to automatically create a rfcomm interface for your phone.

Howto connect with Linux to the internet via a mobile phone using GPRS/EDGA/3G/UMTS/HSDPA

To use your mobile phone as a modem in Linux, edit as root /etc/wvdial.conf on Linux to:

[Dialer Defaults]
Modem = /dev/ttyUSB0
Baud = 460800
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
;Init3 = AT+CGDCONT=1, "IP" , "APN" , ""
;Modem Type = Analog Modem
;ISDN = 0
Phone = *99#
;Phone = *99***1#
Username = foo
Password = bar
Stupid Mode = 1

If it won't work later, try to play with the lines commented out, and replace the word APN with you provider's access point name. The username and password fields are usually ignored.

The file /etc/ppp/peers/wvdial should look like this:
noauth
name wvdial
defaultroute
usepeerdns

Now put yourself in the appropriate group to have the rights to dial out. Connect the phone via USB to the computer, and start the wireless modem application on the phone. Now check the dmesg output, whether it was recognized, and whether the modem device file setting in wvdial.conf correct is. Finally just type wvdial.

You should see something like this:

$ wvdial
--> WvDial: Internet dialer version 1.56
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
OK
--> Sending: ATZ
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
CONNECT
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Thu Oct 18 00:33:14 2007
--> Warning: Could not modify /etc/ppp/pap-secrets: Permission denied
--> --> PAP (Password Authentication Protocol) may be flaky.
--> Warning: Could not modify /etc/ppp/chap-secrets: Permission denied
--> --> CHAP (Challenge Handshake) may be flaky.
--> Pid of pppd: 13821
--> Using interface ppp0
--> local IP address 10.255.46.88
--> remote IP address 10.64.64.64
--> primary DNS address 212.51.115.1
--> secondary DNS address 194.176.224.6

Now you are connected to the internettubes. Just hit Ctrl+C to terminate the connection.

Thanks to: http://lavluda.wordpress.com/2006/03/26/ed...

Syndicate content