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.....................!






1 comment:

Anonymous said...

Hi, I'm v interested in using dial-up networking from my own moto L6. One question though - do you need to have gprs services enabled by your mobile network provider first? I can connect to my L6 fine (from my PC) but get a NO CARRIER message whenever I try to dial using the ATDT command.