Showing posts with label wvdial. Show all posts
Showing posts with label wvdial. Show all posts

3 October 2008

Dialup with Ubuntu, Bluetooth, Blackberry Bold and Maxis 3G.


Since the E61, I have used the iPhone, and Blackberry 8820 both of which didn't support blue tooth Dialup networking features. Now that Im testing out the Blackberry 9000 Bold, I had to make sure that it can be turned into a mobile modem. Im happy to report that it does!

I followed the same setup sequence as the Nokia E61, which I described here "Ubuntu dialup via bluetooth" The modifications are as follows:

The device address would obviously be different, so you will need to do
# hcitool scan
Scanning ...
00:1E:37:E5:FB:xx n/a
00:21:06:FD:5C:AB yky phone
00:1A:6B:87:EE:xx HP-IMD-10042A
00:1E:37:0B:85:xx HP-RSM-10046A
Test that the phone has the required features, and find out the Channel number:
# sdptool browse 00:21:06:FD:5C:AB

Browsing 00:21:06:FD:5C:AB ...
Service Name: Dialup Networking
Service RecHandle: 0x10000
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
Edit the /etc/bluetooth/rfcomm.conf file with the appropriate values
rfcomm0 {
bind yes;
device 00:21:06:FD:5C:AB;
channel 1;
comment "yky phone";
}
Resetting the /etc/init.d/bluetooth restart may or may not have rfcomm0 registered. To manually do so, use this command:
rfcomm bind 0 00:21:06:FD:5C:AB 1
This will create the /dev/rfcomm0 modem file.

Now here comes the part which took me a while to figure out. I just ran wvdial BB with the same settings as with e61, but ran into this error:
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATZ
ATZ
OK
--> Sending: ATM0
ATM0 <-- here is the error: No "OK" received
--> Sending: ATQ0
ATQ0
--> Re-Sending: ATM0
ATM0
OK
--> Cannot get information for serial port.
--> Cannot open /dev/rfcomm0: Transport endpoint is not connected
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
I noticed that whenever a command is at Init3 in the /etc/wvdial.conf file, the dialer will fail, and the modem will never return a "OK". So remove all Init commands except for the single most crucial one, which is the AT+CGDCONT one at Init2:
[Dialer Defaults]
Phone = *99#
Username = maxis
Password = wap
New PPPD = yes
Dial Command = ATDT

[Dialer BB]
Modem = /dev/rfcomm0
Baud = 115200
Dial Command = ATDT
Init2 = AT+CGDCONT=1,"IP","unet"
FlowControl = crtscts
Modem Type = Analog Modem
Stupid Mode = 1
New PPPD = yes
I have added two more lines in the config file. "Stupid Mode" is required. Otherwise for some strange reason, the authentication process will not start. "New PPPD" is optional, it starts a new PPP Daemon on connection.

Now, it should run without a problem:
# wvdial BB
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: AT+CGDCONT=1,"IP","unet"
AT+CGDCONT=1,"IP","unet"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Fri Oct 3 19:14:00 2008
--> 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: 31565
--> Using interface ppp0
--> local IP address 121.123.102.115
--> remote IP address 169.254.1.1
--> primary DNS address 10.213.17.1
Whoopedoo.
Dialup works via the command line. Ctrl-C kills the connection.

Now that Im trying out KDE, I wanted to see if KDE's dialer would make things easier. So I ran "kppp"

Click on "Configure", and "Add" a new Account. Skip the Wizard. In the "Dial" tab, enter in
Connection name: maxis
Phone number: *99#
Authentication: PAP/CHAP
Check the "Store Password" checkbox
You dont have to modify anything else, so click OK.

Then in the "Modems" tab, click "New...". In the "Device" tab, enter in these details:
Modem name: BB
Modem device: /dev/rfcomm0
Flow control: Hardware [CRTSCTS]
Line Termination: CR
Connection speed: 115200
Use lock file: checked
Modem timeout: 60 sec
In the Modem tab, click on "Modem Commands ..."
Just add in Initialization string 2: AT+CGDCONT=1,"IP","unet"
The other default values should be OK. Click "OK"
You can try out the modem by clicking on "Query Modem..." but I just got blank fields for AT1 ... AT7.

Now that you've defined the Account and Modem device, you can try to connect. Use
Login ID: maxis
Password: wap
and click on "Connect"
It should work, sometimes it hangs at setting the modem volume, but a quick reconnect knocks it into order. You should then be rewarded with a screen like this:

So a nice GUI dialer also works too!

yk

24 May 2007

Ubuntu dialup via bluetooth

After using Feisty Fawn, Ubuntu v7.04 for close to a month now, Im happy to report that things are going extremly well. Latest task was to get my e61 to work with my computer so that I can dial up to the internet whenever I dont have access to a wifi spot or wired connectivity.

I have been using a CNet CBD-021 device for over a year now, and it has some nifty tools for Windows XP, with a nice UI "BlueSoleil" which displays connected and available bluetooth devices around the computer. It also provides point and clicky access to file transfers and dial up networking.

However in the Linux world, no such niceities are provided. We have to do things ourselves, unfortunately. So heres what I had to do to get Laptop -> Bluetooth dongle -> Nokia E61 -> Maxis internet connectivity going.

First step is to get bluetooth working. Plug the Bluetooth dongle into your machine. The dmesg should read something like this:
# dmesg
[ 9383.380000] usb 3-1: new full speed USB device using uhci_hcd and address 2
[ 9383.548000] usb 3-1: configuration #1 chosen from 1 choice
[ 9384.356000] Bluetooth: HCI USB driver ver 2.9


This wiki entry for Ubuntu is extremely useful: "Bluetooth Setup" Basically make sure that bluetooth tools are installed:
# apt-get install bluez-utils ppp
# hcitool scan
[Update: 080211 yky: bluez-pin is not required anymore ]

The output I get from this is: 00:12:D1:6C:8F:10 Yk's phone

I set the computer bluetooth key using the bluez-pin utility

I then paired up my phone with my laptop via the e61 interface. Menu / Connectivity / Bluetooth / Paired Devices, exchanging a numeric key to complete the step.

To make your phone a modem, you will need to define it as a rfcomm device. To do so;

# sdptool browse 00:12:D1:6C:8F:11

of which a whole list of services will be displayed. The one of importance is

Service Name: Dial-Up Networking
Service RecHandle: 0x10013
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

Highlighted is the Channel number, and for my case, its #2. So edit the /etc/bluetooth/rfcomm.conf file

rfcomm0 {
bind yes;
device 00:12:D1:6C:8F:10;
channel 2;
comment "Yk's phone";
}

This means that everytime bluetooth is enabled and your phone is detected, a modem device will be created and accessible as /dev/rfcomm0

[Update: 080211 yky: You will now need to restart the bluetooth service with a /etc/init.d/bluetooth restart for the rfcomm0 device file to appear]

The next step is to configure wvdial. This blogpost has some information "pairing bluetooth modem di feisty fawn" Fortunately I can read Indonesian. To configure wvdial to dialup to maxis, the configuration for /etc/wvdial.conf is:


[Dialer Defaults]
Phone = *99#

Username = maxis

Password = wap

New PPPD = yes
Dial Command = ATDT
[Dialer E61]
Modem = /dev/rfcomm0
Baud = 460800

Dial Command = ATDT

Init2 = ATZ

Init3 = ATM0

Init4 = AT+CGDCONT=1,"IP","unet"

FlowControl = crtscts
Modem Type = Analog Modem


Note the Init4, username, password and phone number have been modified, as described in "Using a phone as a modem" from maxis themselves.

You should now be able to dial into maxis by typing:

# wvdial E61
--> WvDial: Internet dialer version 1.56
--> Cannot get information for serial port.

--> Initializing modem.

--> Sending: ATZ ATZ OK
--> Sending: ATM0
ATM0 OK
--> Sending: AT+CGDCONT=1,"IP","unet"
AT+CGDCONT=1,"IP","unet" OK
--> Modem initialized.

--> Sending: ATDT*99#

--> Waiting for carrier.
ATDT*99# CONNECT
~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~
--> Carrier detected. Waiting for prompt.

~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~
--> PPP negotiation detected.
--> Starting pppd at Thu May 24 16:37:43 2007

--> Pid of pppd: 30491
--> Using interface ppp0
--> local IP address 58.71.246.115

--> remote IP address 10.6.6.6
--> primary DNS address 10.213.17.1

--> secondary DNS address 10.213.17.2


Unplug your cables, shutdown your Wifi, check your route tables. Confirm to yourself that your internet access is being provided by your phone. Rejoice.


yk.