Posts Tagged ‘bluetooth’

Hi all,

today may be sound old and boring configure a directly using a command line a dialup connection. This is may be true in many cases an a little bit unuseful.. but I love command line 🙂 so I’m going to show how configure pppd to make a dial up throu a UMTS phone or a HSDPA pen.

In my case, I use a HSDPA phone with bluetooh link, but it is the same with any kind of serial port. This is a short list of used devices:

  • bluetooth: /dev/rfcommX
  • phone with data cable: /dev/ttyUSBX
  • HSDPA phone: /dev/ttyUSBX

Some times, HSDPA pen are recognized like a cdrom but do not fear about it, there are utilities to change the pen interface. If you have no idea, look in dmesg when you plug the phone/pen.

What we need: ppp daemon usually called…. (suspance)…….(a little more suspance)…. ppp :).

What we are going to do: write two files, a chat script and a ppp configuration.

This is my chat script

5. “” \rAT
6. OK ‘AT+CGDCONT=1,”IP”,””‘
7. OK ATD*99***1#

Lines 1, 2, 3, 4 test the physical connection, necessary but not so interesting.

Line 5 checks for AT command

Line 6 is the trick: +CGDCONT=1 is the magical command who enable the UMTS protocol or HSDPA, without this you may get only a GPRS connection. Others parameter are necessary and says respectly the kind of connection (by ip) and the APN of your phone provider. If you do not know it, easy looking for that on your phone.

Line 7 is the call command. Call *99***1# or call *99# is the same, today I do not find any difference. If someone knows that…

Line 8 is the answer we expect.

Usually (I think on Debian and Ubuntu) this file may be placed in /etc/chatscripts, where we can find others like that.

The second file is placed in peers folder of ppp. In Debian that folder is /etc/ppp/peers. We could call hsdpa-provider.

1. /dev/rfcomm0
2. 115200
3. crtscts
4. local
5. noipdefault
6. defaultroute
7. usepeerdns
8. noauth
9. passive
10. connect “/usr/sbin/chat -v -f /etc/chatscripts/tre”
11. user pippo
12. ipcp-accept-remote
13. ipcp-accept-local

Explain it line by line is not so useful, for details look at man pppd. What we want to know is about lines 1, 10 and 11. Line 1 is the device, look the introduction if you do not find it. Line 10 says “use my chat script”, the one we have written. Line 11 is the user for dialup authentication: I think no provider asks about it so I put an uninteresting name.

We have finished.

To test it the simple way is plug your device or power on bluetooth and then call

pon hsdpa-provider

Using ifconfig we could see a new pppX interface.

To shutdown the connection, you can use poff command, or kill directly the ppp daemon.

That’s all folks!