Pages

June 5, 2007

Sony Ericsson K600i as bluetooth dialup modem

Hi! In this article I will show you how I connected to the internet using laptop Compaq Evo N1000v & cell phone Sony Ericsson K600i. My mobile operator is Orange Slovensko. I did it under Slackware Linux 11. We will setup bluetooth connection between these devices.

Note: I don't assume high security - password "00" :-)

1. First be sure, you have packages:
bluez (bluez-3.7-i686-2mnr.tgz), you find it on http://www.linuxpackages.net/
dbus (dbus-1.0.2-i486-1mht) again linuxpackages..
ppp (ppp-2.4.4-i486-1.tgz)

2. Second, load (using command modprobe) these kernel modules under Slackware Linux 11 (kernel 2.6.18.8-smp)
ppp_generic, rfcomm, l2cap, hci_usb, cmtp

3. Third, power on your bluetooth (Fn+F2), see if you have bluetooth device enabled using command:
hciconfig
hci0: Type: USB
BD Address: 00:02:C7:0E:AA:66 ACL MTU: 128:8 SCO MTU: 64:8
UP RUNNING PSCAN
RX bytes:10119794 acl:88264 sco:0 events:7484 errors:0
TX bytes:386523 acl:7134 sco:0 commands:341 errors:0

4. setup files /etc/bluetooth/bluepin (executable) & /etc/bluetooth/hcid.conf
cat /etc/bluetooth/bluepin
#!/bin/bash
echo "PIN:00"

cat /etc/bluetooth/hcid.conf
options {
autoinit yes;
security auto;
pairing multi;
passkey "00";
pin_helper /etc/bluetooth/bluepin;
}
device {
name "darkstar";
class 0x3e0100;
iscan enable; pscan enable;
lm accept;
lp rswitch,hold,sniff,park;
}

5. startup dbus and bluetooth processes:
/etc/rc.d/rc.messagebus start
hcid -f /etc/bluetooth/hcid.conf
sdpd

6. NOW TRICKY PART. You will have to find your computer using your mobile phone and make pair. Other way doesn't work! So make your computer bluetooth visible using:
hciconfig hci0 piscan
hciconfig

hci0: Type: USB
BD Address: 00:02:C7:0E:AA:66 ACL MTU: 128:8 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN
RX bytes:10119834 acl:88264 sco:0 events:7492 errors:0
TX bytes:386554 acl:7134 sco:0 commands:346 errors:0

7. On your K600i search for bluetooth devices, it will find computer "darkstar", type password "00". This will make pair mobile-computer and you will see name of your computer in K600i MENU->SETTINGS->CONNECTIVITY->BLUETOOTH->MY DEVICES
8. Lets test. Find your mobile using command "hcitool scan", ping it and find DialUpNetworking service
hcitool scan
Scanning ...
00:16:20:0C:59:E5 K600i.dany

l2ping 00:16:20:0C:59:E5
Ping: 00:16:20:0C:59:E5 from 00:02:C7:0E:AA:66 (data size 44) ...
44 bytes from 00:16:20:0C:59:E5 id 0 time 43.21ms
44 bytes from 00:16:20:0C:59:E5 id 1 time 64.36ms
44 bytes from 00:16:20:0C:59:E5 id 2 time 68.07ms

sdptool search DUN --bdcast 00:16:20:0C:59:E5
Inquiring ...
Searching for DUN on 00:16:20:0C:59:E5 ...
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: 1
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100

11. According previous step, setup /etc/bluetooth/rfcomm.conf file
cat /etc/bluetooth/rfcomm.conf
rfcomm0 {
bind yes;
device 00:16:20:0C:59:E5;
channel 1;
comment "K600i.dany";
}

10. Test connection to this service.
rfcomm release 0
rfcomm connect /dev/rfcomm0 00:16:20:0C:59:E5
Connected /dev/rfcomm0 to 00:16:20:0C:59:E5 on channel 1
Press CTRL-C for hangup

If you NOT see "Press CTRL-C for hangup", THERE IS SOMETHING WRONG! Try everything again, read http://www.artm-friends.at/rm/bluetooth-gprs-rm-HOWTO.txt, drink beer or jump from window, I don't care :-)

11. If you see that message, it is great success! Create permanent /dev/rfcomm0 device link to DUN service (channel 1):

rfcomm release 0
rfcomm bind 0 00:16:20:0C:59:E5 1
ln -s /dev/rfcomm0 /dev/modem

12. Now lets configure ppp, it will dial up first data profile from your mobile. Important is init string AT+CGDCONT=1,"IP","internet" and telephone number *99# I have tested this for ORANGE SLOVENSKO mobile operator.
cat /etc/ppp/options
nodetach
lock
defaultroute
noipdefault
modem
/dev/modem
460800
crtscts
usepeerdns
passive
asyncmap 0
name "wap"

cat /etc/ppp/pppscript
TIMEOUT 60
ABORT ERROR
ABORT BUSY
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
"" ATZ OK AT+CGDCONT=1,"IP","internet" OK ATM1L1 OK
"ATDT*99#"
TIMEOUT 75
CONNECT

11. Connect to the internet :-)

/usr/sbin/pppd connect "/usr/sbin/chat -V -f /etc/ppp/pppscript"

ATZ
OK
AT+CGDCONT=1,"IP","internet"
OK
ATM1L1
OK
ATDT*99#
CONNECTSerial connection established.
Using interface ppp0
Connect: ppp0 /dev/modem
Remote message: Congratulations!
PAP authentication succeeded
Could not determine remote IP address: defaulting to 10.64.64.64
not replacing existing default route via 196.66.66.1
local IP address 10.128.21.43
remote IP address 10.64.64.64
.
.

13. change your default route to your new mobile connection and setup /etc/resolv.conf
ip r d default
ip r a dev ppp0
cat /etc/resolv.conf

nameserver 213.151.200.30
nameserver 213.151.208.161

14. HAVE A FUN!
ping www.google.com
PING www.l.google.com (209.85.129.99) 56(84) bytes of data.
64 bytes from fk-in-f99.google.com (209.85.129.99): icmp_seq=1 ttl=243 time=179 ms
64 bytes from fk-in-f99.google.com (209.85.129.99): icmp_seq=2 ttl=243 time=224 ms

15 (OPTIONAL) You can place these commands to your startup scripts, so when you want to connect to the internet, just issue ppp-on command and surf :-)
cat /etc/rc.d/rc.local
#!/bin/sh
/sbin/modprobe hci_vhci
/sbin/modprobe rfcomm
/sbin/modprobe hci_usb
/sbin/modprobe cmtp
/sbin/modprobe hci_uart
/sbin/modprobe sco

hciconfig hci0 up
# CHANGE MAC ADDRESS TO MATCH YOUR K600i
rfcomm bind 0 00:16:20:0C:59:E5 1
chmod 666 /dev/rfcomm0
ln -s /dev/rfcomm0 /dev/modem
/etc/rc.d/rc.messagebus start
/usr/sbin/hcid -f /etc/bluetooth/hcid.conf
/usr/sbin/sdpd

I am happy that I figured it out, it took me whole day to setup this bluetooth modem. My biggest problem was with step 6 and 7, because I couldn't just connect to mobile from computer. After typing password on mobile, connection was always closed. Trick was to enable visibility on computer (step 6) and making pair from mobile (step 7).

No comments:

Post a Comment