Thursday, February 22, 2007

Linux, Bluetooth & GPRS

Hey guyz..! after a long time .. howzi going? yep I was bussy with ma studies and work. Dudring the past dayz I tried to be connected with the internet using GPRS and Bluetooth. Has anyone tried to be connected with the internet using yer mobile phone as a dial up modem? Dassa and Anu have experiences in that and I got lots of advice from those guyz. Lots of googling and after a few dayz hacking I could do that successfully. I found a few scripts and I edited those scripts as neceasary.

I have Motorola L6 mobile phone with bluetooth. My system Is Debian GNU/linux, kernel 2.6.x. And I have a box with Intel Pentium IV 2.6 GHz and 256 MB RAM. I'll show how I could manipulate the script for better work.


Step 1: Make sure the Bluetooth connection between system and phone is working well.

* Switch on the bluetooth of the phone and run 'hcitool scan' on root terminal to ensure that the Bluetooth system is up and running. This should find the Bluetooth address of the phone. The address of my phone is 00:16:75:50:DE:1F

* Run 'sdptool browse ' to find which channels are being used for each of the services. The important entry for using the phone as modem is the one labelled 'Service Name: Dial-up Networking, For me, Channel 1.

debian:~# sdptool browse 00:16:75:50:DE:1F

"Service Name: Dial-up Networking Gateway
Service Description: Dial-up Networking Gateway
Service Provider: Motorola
Service RecHandle: 0x10001
Service Class ID List:
"Dialup Networking" (0x1103)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1"



* Set up RFCOMM device. /dev/rfcomm0 is the default bluetooth modem device. So I edited /etc/bluetooth/rfcomm.conf to ensure that /dev/rfcomm0 connects Channel 1. I edited the /etc/bluetooth/rfcomm.conf as follows.

vim /etc/bluetooth/rfcomm.confg


rfcomm0 {
bind yes ;
device 00:16:75:50:DE:1F ;
channel 1 ;
comment "mot Dial-up Networking Service -- for PPP" ;

}



Tip : Whenever u change the configuration file restart the bluetooth survice each time.

/etc/bluez-utils restart

Step 2 : Make the PPP (Point-tp-Point Protocol) sub-system. for that first I made the peer specification. and I named it mot. "vim /etc/ppp/peers/mot" ma peer specification as follws.

connect "/usr/sbin/chat -v -f /etc/chatscripts/mot"
/dev/rfcomm0 115200
defaultroute
crtscts
lcp-echo-failure 0
#=======
/dev/rfcomm0 115200
connect '/usr/sbin/chat -v -f /etc/ppp/chat-gprs'
crtscts
modem -detach
noccp
defaultroute
usepeerdns
noauth
ipcp-accept-remote
ipcp-accept-local
noipdefault

Then I created a chatscript mentioned in the peer specification and I named in the same way as peer specification (mot) "vim /etc/chatscript/mot. thats script like this.

# This chatfile was generated by pppconfig 2.3.10.
# Please do not delete any of the comments. pppconfig needs them.
#
# ispauth chat
# abortstring

ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE' ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT DELAYED
# modeminit
'' ATZ
# ispnumber
OK-AT-OK "ATDT*99***1#"

# ispconnect
CONNECT ''
# prelogin

# ispname
#login: xxxxxx
# isppassword
#password: yyyyyy
# postlogin

'' \d\c
# end of pppconfig stuff

" *99***1# " is the dial up number which is provided by the survice provider

Finally I wrote a script what I called chat-gprs which is also mentioned in the peer specification. "vim /etc/ppp/chat-gprs

'' ATZ OK

#AT+CGDCONT=1,"IP","www.plusgsm.pl"
AT+CGDCONT=1,"IP","wap"
OK "ATD*99***1#"
CONNECT ''



Now I finished ma Scripts. So lets check out those scripts are weather working or not.???

Okay... I gonna check ma connection. First I had to make a bluetooth connection with phone and system. here the commands.

debian:~# hcitool cc 00:16:75:50:DE:1F
debian:~# hcitool auth 00:16:75:50:DE:1F


When authenticate the connection it ask PIN. Most probably the default PIN is 1234.

Then run the comand "pon mot" to up the dialup connection. If you want to disconnect just run the command "poff mot". It is almost certainly a wise move to monitor /var/log/syslog run "tail -f /var/log/syslog" in a separate terminal to check that all the right things are happening.

Yeahhhhh......! Its working.....................!






AR got married...!


Today is rather a special day for our LUGers coz one of our old members AR got married. Early in the morning I reached Linux Center at about 0500. Dassa and his wife came to LC and we drove our selves to Suchetha's place. we reached there at about 0800. Took a shower and got ready to go to the wedding.

It was already started when we reached there. He was on the Poruwa and Poruwa ceremony was going on. Ahh what a nice couple. The wedding was rather traditional. You know guyzz, Anuradha is a person who appreciate the Sinhalese culture all the time. Couple was wearing National dress. We had a nice time there.

The most outstanding moment is their going away. they were wearing a traditional dresses and gone away in a bullock cart. I wish them all the success and bright future....!



(Pics by Suchetha and Anuradha D)