How to setup a GPRS internet connection in Linux via bluetooth …

Often I hear questions like this “How do I connect to the internet from linux via my bluetooth mobile phone GPRS?”

Yes, there are ways to do that, but telling a newbie to go to the terminal and do hcitool scan, rfcomm, etc. spooks him out. And also The system-config-network, while setting up a Modem Connection through it, one has to com across port numbers, baud rate, etc. and a user not used to Linux, most of the time finds these things weird, especially the users. These issues need to be looked into and some actions are required to come up with a more user friendly interface in this regard. That’s another topic of discussion though …

Let’s see how to connect to the internet via GPRS over a phone with a Bluetooth Modem :

1. Use the bluetooth-applet to setup your phone if it is not yet paired with your PC. Alternatively you can do this via the terminal

$ bluetooth-applet

and then follow the on – screen instructions.

2. Once done setting up your phone, do the following in the terminal to know your mobile phone’s bluetooth address

$ hcitool scan

In my system, it shows something like this

Scanning …
00:1D:98:78:A2:A1    Nokia 5310 XpressMusic
00:1D:98:78:A2:A1 is the bluetooth address of my mobile phone. Yours will be of similar type.

3. Now as root, do the following

#rfcomm connect rfcomm0 <bluetooth address> 1

Keep this process running

4. Open System->Administration->Network, select New, then select Modem Connection, and enter the following values for the respective field

Modem Device:    /dev/rfcomm0

Baud Rate: 460800

this is the safe limit for most Nokia phones, may vary for different phones.

Then click Forward. Then fill in the requisite details, then click Forward, and accept the default settings, like automatically obtaining IP Address and DNS Information from provider. Then select Apply. And then click on File-> Save to save your new settings.

Then click the Activate button for the modem connection just set up, and enjoy.

4. Every time, you want to connect to the Internet, before activating the connection via Network, you have to connect your phone as a bluetooth modem as in step 3 .

Hope to see a new GUI dedicated to setting up bluetooth internet connection in Linux soon.

Fiasco trying to upgrade fs from ext3 to ext4

It was afternoon when I tried my hands on trying to upgrade my filesysten from ext3 to ext4. I referred to :

http://ext4.wiki.kernel.org/index.php/Ext4_Howto#Converting_an_ext3_filesystem_to_ext4

As mentioned… I did the following :

# tune2fs -O extents,uninit_bg,dir_index /dev/VolGroup00/LogVol00

# e2fsck -fD /dev/VolGroup00/LogVol00

After quite some time, the procedure finally completed. I was so delighted that I did a sytem reboot to find that my system won’t boot. The reason, I didn’t update my kernel ramdisk image, and it tried to mount the / partition as ext3 and failed as the partition has already become ext4. What I forgot to do was :

#mv /boot/initrd-‘uname -r’.img /boot/initrd-‘uname -r’.img.bak

// this is to keep a backup of the existing initrd image

#mkinitrd -v –with=ext4 /boot/initrd-‘uname -r’.img ‘uname -r’

Also the following line in /etc/fstab :

UUID=fd296dfc-e7b3-4dc9-adf9-0038631d9c1f /                       ext3    defaults        1 1

needed to be updated as :

UUID=fd296dfc-e7b3-4dc9-adf9-0038631d9c1f /                       ext4    defaults        1 1

But, I was a bit hasty. I tried to correct this issue. I booted my system from the F11-Beta installed in my pocket hard drive. I learnt how to mount an LVM partition:

#vgchange -ay

#mount /dev/VolGroup00/LogVol00 <mount point>

I tried updating the initrd images in the mounted LVM partition to find that the kernel modules for the particular kernel version of the initrd image was not found. As F11-Beta was running on a newer kernel. Tried to update the initrd images on other similar system as mine, copied the respective files in /boot and pasted it in my /boot folder and I tried to boot. It didn’t boot and gave an error message saying :

cannot mount /dev/root to /sysroot

Any suggestions?

Really inspiring!!!

Everyone makes mistakes…
It’s nothing to be ashamed of
Don’t let this mistake go to waste
Be able to smile as you walk

Yes, I breathe in the quiet air,
And raise my face toward the sky and jump in
If it rains, I’ll take a break
And let the wind decide where I go
I carry along many regrets
But letting these wounds go to waste is stupid
Carve a medal into your chest and set sail
Your life becomes a “showtime” from there

Everyone makes mistakes…
It’s nothing to be ashamed of
Don’t let this mistake go to waste
Be able to smile as you walk

Turn your sadness into wind
And just be able to keep moving forward
And just be able to keep moving forward

This is the end title of an anime – Naruto

rtnpro starts his blueZ journey…

Just now … I wrote my first ever blueZ code, a simple one though, that too, from an online  tutorial at

http://people.csail.mit.edu/albert/bluez-intro/c404.html

Its a nice tutorial for newbies like me to get started with blueZ.

First of all, I needed to setup my blueZ development environment. Since I use Fedora 10, I did the following

yum install -y bluez-libs bluez-libs-devel libgdbus libgdbus-devel

Also, one can manually install it from the source packages available at

http://www.bluez.org

The first code that I wrote is a simplescan.c which scans for bluetooth devices in proximity and displays its bluetooth address ( a 48-bit address unique for all bluetooth devices managed by IEEE). Here’s the following code :

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>

int main(int argc, char **argv)
{
inquiry_info *ii = NULL;
int max_rsp, num_rsp;
int dev_id, sock, len, flags;
int i;
char addr[19] = {0};
char name[248] = {0};

dev_id = hci_get_route(NULL);
sock = hci_open_dev( dev_id);
if (dev_id < 0 || sock < 0){
perror(“opening socket”);
exit(1);
}

len = 8;
max_rsp = 255;
flags = IREQ_CACHE_FLUSH;
ii = (inquiry_info*)malloc(max_rsp * sizeof(inquiry_info));

num_rsp = hci_inquiry(dev_id, len, max_rsp, NULL, &ii, flags);
if( num_rsp < 0 ) perror(“hci_inquiry”);

for (i = 0; i < num_rsp; i++) {
ba2str(&(ii+i)->bdaddr, addr);
memset(name, 0, sizeof(name));
if (hci_read_remote_name(sock, &(ii+i)->bdaddr, sizeof(name), name, 0) < 0)
strcpy(name, “[unknown]”);
printf(“%s %s\n”, addr, name);
}
free(ii);
close( sock );
return 0;
}

Then to compile the code :

[rtnpro@xps blueZ]$ gcc -o simplescan simplescan.c -lbluetooth

Then to execute it :

[rtnpro@xps blueZ]$ ./simplescan

00:1D:98:78:A2:A1 Nokia 5310 XpressMusic

See the output, its my Nokia mobile phone.