wordgroupz development news

For some time now, I have been working on wordgroupz. Since version 0.2, I have added some new features.

The new features include dictionary support: online webster dictionary from dict.org and offline wordnet. For implementing the online dictionary support, I used the server interface of dict.org. For offline, I used the dictionary databases of the wordnet application and the python-nltk library.

I also included wiktionary support this time. I used to find it tedious opening a notebook, browser to search wikipedia/wiktionary, copy-paste notes. That’s why I decided to get them all together under one hood – wordgroupz. I include a gtkNotebook : 1st page for showing, editing details of the selected word and the 2nd page for browsing through wiktionary and downloading pronunciations if available. I had to study urllib2, BeautifulStone, pywebkitgtk for the purpose.

I also worked on the new interface, added some custom buttons to the interface. I studied gtkNotebook, gtkToolbar, gtkStockImage, etc. I also improved some logic for the interface. Now, wordgroupz allows to add words without any groups and such words are put in an “no-category” group. Now, there is a “details” field for group-words. Groups can be deleted. I have to write the code to move the words to the ‘no-category’ group once its parent group is deleted.

I released wordgroupz version 0.3b today. I have to work on machine generated pronunciation for words whose wiktionary pronunciation are not available. I have to design the games and quizzes for wordgroupz. Lots of stuff to do.

Please feel free to try wordgroupz and suggest any improvements to be done.

Details of how to get wordgroupz was given on my previous post.

An introduction to Linux Device Drivers – #1

Today we’ll be discussing a basic c code, the famous hello.c, which will be loaded as a kernel module and discuss some of the basic aspects related to it.

#include <linux/init.h>

#include <linux/module.h>

MODULE_LICENSE (“GPL”); // included in module.h, tells about the license the code is having.

static int __init hello_init (void)


printk (KERN_ALERT “Hello, world\n”);

return 0;


static void __exit hello_exit (void)


printk (KERN_ALERT “Goodbye\n”);


module_init (hello_init);     // hello_init is the initialization function

module_exit (hello_exit);     //hello_exit is the exit function

The header <linux/init.h> contain various declarations and definitions related to the loading and cleaning up of modules. The macros module_init and module_exit are declared in the <linux/init.h>. The argument functions passed to module_init( ) and module_exit( ) are executed at the loading and unloading times respectively of a module. The initialization function, basically, sets up the device to be used later. The exit function cleans up the device ( opposite to initialization).

Now coming to the __init and __exit terms used in the code. The __init in static int __init hello_init (void) specifies that the hello_init function is executed only at module load time. The module loader drops the initialization function for other uses once the module is loaded. The initialization function better be static since they are not meant to be visible outside the specific file ( not mandatory though). Similar explanation goes for __exit. This makes the exit function executed only at exit time.

The printk function, at a first glance, might look identical to printf of <stdio.h>, but printk lets you set priority levels for the message, like KERN_ALERT, KERN_INFO, etc. We’ll discuss about them later.

How to compile the code and execute it. Let us assume that you named the source file above as hello.c. Use any suitable text editor to write a Makefile as below :

obj-m    += hello.o

make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
rm -f *~

I hope you have the kernel source in your system. If not you can get the kernel source from kernel.org. If you are using Fedora, you can do:

# yum install kernel-devel

To compile, in the current directory ( where there is hello.c and the Makefile) do :

$ make

Then change to super user by : $su <enter>

and do : # insmod ./hello.ko

If you do : # tail -f /var/log/messages (You can open this in a separate terminal to view the system logs)

then you will be able to see a line saying “Hello, world”. This is what your hello_init( ) was supposed to do at module load time. You can also see the module name “hello” among the list of loaded modules doing lsmod. Now you can unload the module do :

# rmmod hello

Now in /var/log/messages, you will see “Goodbye”. This is due to hello_exit( ).

continued …

An introduction to Linux Device Drivers – #0

I’ll be honest, I am neither a kernel hacker nor a device driver writer, but I want to be one. I am studying the Linux Device Drivers 3, the LDD 3. It is an effort from my end to document what I have understood from reading the LDD 3. There might be some errors or misinterpretation on my part and I will be glad if anyone corrects me. I will be trying to keep the things as correct as possible.

First visit to West Bengal State University, Barasat …

Today, 13th July, 2009, we ( me , i.e., Ratnadeep Debnath aka rtnpro, Kishan Goyal, Meejanur Rahaman, Harsh Verma, Chandana Boral) led by Indranil Das Gupta and Stephanie Das Gupta, went to West Bengal State University at Barasat, Kolkata. We started at around 10:30 AM from Ruby Hospital, and after a long journey ( changing two buses, then riding on a van, with  a few drizzles  on the way), we finally reached Barasat University at around 12:30 PM.

We were then taken to the server room of Barasat University. Indradg got us introduced to the wiring and connections in the server room,  the big UPS, the batteries being charged by the UPS, the mechanism for providing back up during power cuts, switching between the two ACs periodically and finally the HP Blade Server.

The UPS is a Liebert GXT-MT 6KVA UPS with a OpenComms Web Card. The OpenComms Web Card delivers SNMP (Simple Network Management Protocol) and Web support to the UPS in which it is installed. Then we were acquainted with the network configuration of the University Network ( wifi + lined connection).

Next job was to download the Fedora 11 repository. We brought in another computer, placed it in place of the server and installed Fedora 10 in it and started working. We were given the required bandwidth and my job was to start the rsync. But it didn’t go well with me. I was confused with how and where to start. I did rsync locally in earlier instances and not over the internet. I started with the man page. Then googled about “rsync”. Found some good documentation at http://fedoraproject.org/wiki/Infrastructure/Mirroring. It mainly dealt with setting up Fedora mirrors and how to enable rsync in them. But what I needed was just use rsync to pull Fedora 11 repository. It was quite some time, I was still stuck. Got some suggestions on configuring rsyncd.conf file, I was again redirected to the above link. Then we had some lunch and break.

I again sat working on it. Again went through the rsync man page. I found that,

$rsync [options]

gives a directory listing of the source directory. Chose rsync://ftp.riken.jp/fedora as the source. Found its directory structure using

$rsync -auvr rsync://ftp.riken.jp/fedora

I created the directory structure in my current folder ( here it was /home/$USER/f11_repo/). Now I started pulling Fedora 11 i386 release packages in the following way

$rsync -auvr rsync://ftp.riken.jp/linux/fedora/releases/11/Everything/i386/os/ /home/$USER/f11_repo/linux/fedora/releases/11/Everything/i386/os/

and it started syncing the source and destination directories.

Then we also started downloading the rpmfusion_free repositories for Fedora 11 using wget. Indradg wrote a shell script to automate the download of rpmfusion/free repository using wget. We also used screen to run the two processes in different screens so that they can be monitored remotely.

$screen -R [screen name]

In the mean time, others prepared some “Do not disturb, work in progress” labels and put them on the running computer, the server room door, etc. to make sure that no one messes with the running computer.

It was around 5:30 PM that we finally packed up. We got into the University Bus and reached Ruby Hospital at around 7:30 PM.

It was a long long day :).

Install Windows Games in Linux with PlayOnLinux …

Hi all… I have a Dell XPS M1530 running on Fedora 10. It has got a 2 GHz Intel Centrino Duo processor, 2GB RAM, 256 MB Nvidia GeForce 8600M GT, quite a configuration for decent gaming. But till today I had to boot in Windows Vista to play games. So I have been trying to install and run Windows games in Fedora. There are a few tools for this purpose. The famous and proprietory and non-free Transgaming Cedega, Codeweavers Crossover Games and the all free PlayOnLinux. All these use wine which is a free software for running Windows applications in Linux. Though paid, Cedega and Crossover Games don’t support as many applications as PlayOnLinux. And when you are not sure that whether your games are going to run or not in Linux, wine and PlayOnLinux is the free and good option to stick to.

PlayOnLinux has got a lot of .pol scripts to automate the installation of games, but they require that the game’s installation source is in a cd/DVD ROM. I tried installing from the game ISO mounted or from any local folder, but failed till yesterday. I did a bit google and tried to read the .pol file and found that games can be installed from a source folder of the game without it being on a cdrom. Here’s how to do it:

1. Open playonlinux, its better if you open it from the terminal, it gives many useful information :


2. Select Install.

3. Then select “Install a .pol package or an unsupported application“.

4. If you don’t have any custom .pol package select “Manual installation” and click “Next” .

5. Do as directed, then under “What do you want to do?” select “Install a program in a new prefix”  in case you are installing the application for the first time. Select “Edit an application already installed” if you have to update your installed application like patching it to a newer version, or installing mods, or other packs, or may be other support softwares like DirectX, etc.

Select “Delete a prefix” if you want to delete an already installed application (wineprefix)

6. Do as directed.

7. “Do you want to confiure your prefix before installing your application?”

If you want to configure wine before installtion, select “Yes”, otherwise “No”

8. “Browse the file to execute”

Browse the setup.exe (or whatever for your game) in the game source folder, and select Forward.

9. Then follow the onscree instructions and finish the installation, and allow creating shortcuts (if you want…)

10. Now you will be able to see the installed game in Playonlinux window. Select the game, and choose “Configure this application“. Use the “Use advanced wine configuration plugin” to do some wine tweaks. You get the options of configuring

  • DirectDrawRenderer
  • UseGLSL
  • VideoMemorySize
  • OffscreenRenderingMode
  • RenderTargetLockMode
  • Multisampling
  • MouseWarpOverride

After configuring these based on the hardware abilities on your system, you are almost done.

11. But still we don’t have DirectX installed and without these, the DirectX requiring games will fail to run. You can either Install DirectX manually via PlayOnLinux and choose the concerned prefix of the game which you want to update.

Or you can just copy some dll files from the Windows/System32 folder if you have Windows installed in your system, or you can get from your friend’s computer running Windows and having DirectX 9.

Playonlinux has got a lot of supported games, and you always have the option of adding new games to the list.

DGPLUG Fedora Activity Day … Day 1, 14 May 2009

The Linux Users’ Group of Durgapur, i.e, DGPLUG conducted a Fedora Activity Day in Dr. B. C. Roy Engineering College, Durgapur. Though it was planned to be a 1 day FAD, it got extended to one more day, i.e, 15th May 2009. The people working for this FAD to happen are Harsh Verma, Kishan Goyal, me , i.e, Ratnadeep Debnath (rtnpro), Subhodip Biswas, Arindam Ghosh, Meejanur Rahaman, Dibyanshu Jaiswal. Also, we had Rangeen Basu Roy Chowdhury with us. And also Arpita, Amrita, Debashree were there to talk on Inkscape. There was also with us Sunny Sharma, another FOSS enthusiast.

The event began at 12:00 PM in the Computer Science Department Lab No. 207 of BCREC. Projector and other necessary things were arranged beforehand by the DGPLUG volunteers working for the event. The Lab computers ran on Live Fedora Electronic Lab DVD, and a few ran on FEL Live USB. Around 25 students from various Departments like CSE, IT and ECE participated in the event. The event began with Arindam Ghosh talking on the Fedora Project. It was followed by Kishan Goyal speaking on “Myths about Linux busted with Fedora”. In between, whenever needed, Subhodip Biswas elucidated some of the topics being discussed. This was followed by a presentation on Inkscape by Amrita, Arpita and Debashree and a hands-on session on Inkscape. This was followed by me, Rangeen and Sunny giving a demo of KDE to the participants. It was around 2:10 that the 1st session ended. Then there was a break.

It was around 3:00 PM that we resumed the session. Rangeen then started with the introduction of IRC to the participants and soon Arindam and Subhodip joined the discussion. An Airtel Mobile Office Connection was arranged for the purpose. Since Airtel does not allow IRC clients like ChatZilla, X-Chat, etc. we had to use http://www.mibbit.com for the purpose. The participants were shown how to use the IRC. Shrink (Shreyank Gupta), Roshan08, mbuf (Shakthi Kannan) were online that time and took part in the live demo of IRC. The particiapnts were told about IRC ettiquetes.

It was followed by Rangeen’s session on Fedora Electronic Lab. Rangeen prepared some cool slides for the purpose which made the students interested in the topic. He showed them various cool FEL tools and did some small exercises on them with the students. The session was great except for the unepected power cuts that disturbed the session. Finally the FAD Day 1 was wrapped up at 4:30 PM. The participants were very enthusiastic. It was announced that the 15th May is going to be a day long session on Programming ( c, java, etc.) using FOSS tools.

After the session enden, Rangeen left for Bankura. We went back to our mess happy and exhausted.

Pictures of today’s eventw will be uploaded soon.

How to make a custom Fedora Linux Distribution

The following is a nice tutorial on how to create a custom Linux Distribution .

IconPCPlus has a tutorial on building your own Linux distribution with the customizations you want, derived from Fedora, using the graphical interface called Revisor. “We’re used to thinking of Linux distributions being set in stone. They’re either KDE or Gnome, use a certain kernel and bundle certain applications. But this doesn’t have to be the case. If you find yourself making the same adjustments each time you install a new distribution, it’s worth creating your own customised version. Revisor is a tool that lets you do just this, and in this tutorial, we’ll show you how.”

Working with some bluetooth coding :)

It’s been quite some time since I started poking with bluetooth coding, but didn’t understand it much. But it was quite some moment this afternoon. I was trying to study the rfcomm source code, and finally could able to find out the part of the code responsible for the “bind” option for rfcomm. Had a code already for scanning for nearby bluetooth devices. Edited some of theirs codes, added some lines, and came up with a code in c which scans for nearby bluetooth devices, displays them, asks the users to choose one of the devices to bind, and accordingly binds that device. But for that, the device must be already paired up with the host computer. Here’s the code:

#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/wait.h>

#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
#include <bluetooth/rfcomm.h>

int bt_scan (char baddr_list[][19], char name_list[][248] )
inquiry_info *ii = NULL;
int max_rsp, num_rsp;
int dev_id, sock, len, flags;
int i, j;
char addr[19] = {0};
char name[248] = {0};

struct sockaddr_rc loc_addr = { 0 }, rem_addr = { 0 };
char buf[1024] = {0};
int s, client, bytes_read;
socklen_t opt = sizeof (rem_addr);

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

len = 8;
max_rsp = 255;
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]”);
strcpy(name_list[i], name); strcpy(baddr_list[i], addr);
printf(“%d. %s %s\n”, i+1, addr, name);

close( sock );
return i;


static int create_dev(int ctl, int dev, uint32_t flags, bdaddr_t *bdaddr, char *strba)
struct rfcomm_dev_req req;
int err;

memset(&req, 0, sizeof(req));
req.dev_id = dev;
req.flags = flags;
bacpy(&req.src, bdaddr);

str2ba(strba, &req.dst);

req.channel = 1;

err = ioctl(ctl, RFCOMMCREATEDEV, &req);
if (err == EOPNOTSUPP)
fprintf(stderr, “RFCOMM TTY support not available\n”);
else if (err < 0)
perror(“Can’t create device”);

return err;

int bind_bt(char *strba)
bdaddr_t bdaddr;
int i, opt, ctl, dev_id, show_all = 0, err;

bacpy(&bdaddr, BDADDR_ANY);
if (ctl < 0) {
perror(“Can’t open RFCOMM control socket”);

dev_id = atoi (“/dev/rfcomm0”);

err = create_dev(ctl, dev_id, 0, &bdaddr, strba);

return err;

int main (int argc, char *argv[])
int count, choice, err;
char name_list[10][248], baddr_list [10][19], strba[19];

count = bt_scan(baddr_list, name_list);
if (count > 0){
printf(“Enter the serial number of the device that you want to connect to : “);
scanf (“%d”, &choice);

if (choice > count){
printf (“Enter proper choice…\n”);
goto x;
strcpy(strba, baddr_list[choice-1]);
err = bind_bt(strba);
if (err < 0) printf (“Might be you don’t have sufficient privileges, try running it as root\n”);
return 0;

To compile this code :

gcc foo.c -lbluetooth

Run the a.out file as root because the rfcomm binding operation needs root privileges.

Any suggestions or ways to improve the code are welcome.

DGPLUG Fedora Activity Day, 2009

A Fedora Activity Day is going to be conducted by the Linux Users’ Group of Durgapur, DGPLUG in Dr. B. C. Roy Engneering College, Durgapur on 14 May, 2009.

The agenda of this FAD is to increase FOSS awareness among the students of BCREC and to introduce them to the wide spectrum of things that they can do in Linux in their day to day life.

Fedora is not just an operating system, it is a community comprised of people coming from different walks of life, yet all believing in the foundations of Fedora

Freedom Friends Features First

There is a place for anyone in Fedora, for anyone who wants to contribute, irrespective of their technical skill level. We will be trying to convey this message with the help of a talk on Fedora Project. Then, there will be a session on “Fedora in your day to day life”.

This will be followed by workshops on :

  • Introduction to Vim text editor
  • Coding in c and c++ in Linux, introduction to gcc and gdb, an Introduction to Anjuta IDE.
  • Basic shell commands
  • Programming in Java in Linux
  • An introduction to FEL

Rangeen Basu Roy Chowdhury has consented to take the session on FEL. Programming in Java in Linux will be taken by Arindam Ghosh and Subhodip Biswas, Introduction to gcc and gdb and coding in c by Ratnadeep Debnath, Basic shell commands by Harsh Verma, and Introduction to Vim text editor and Anjuta IDE by Kishan Goyal. In “Fedora in your day to day life”, Amrita, Debashree and Arpita will be talking on the Free graphic and imaging tools like Inkscape and Gimp. If required, Fedora installations will also be done. Free Fedora 10 installation DVDs will be distributed.

People working to conduct this FAD :

  • Arindam Ghosh
  • Subhodip Biswas
  • Ratnadeep Debnath
  • Harsh Verma
  • Kishan Goyal

Expected attendees : Students of 1st, 2nd and 3rd year from CSE, IT, ECE, EIE of Dr. B. C. Roy Engineering College.

The DGPLUG FAD 2009 event page can be found at https://fedoraproject.org/wiki/DGPLUG_FAD_2009

Further details and updates will be notified soon. Any suggestions are welcome.

Resolved Kernel boot problem :D

I am using Fedora 10 and I was running the kernel and I was happy until I did a ‘yum update’. My kernel got updated to kernel, and then the system won’t boot the latest kernel. While booting it gave a mesage :

Unable to access resume device (/dev/dm-1)

mount : could not find filesystem ‘/dev/root’

I wondered what had happened? But, the old kernel seemed to work perfectly. I became fanatic to resolve this issue. I did some googling, and finally came to know that the issue was with /etc/fstab and my Fedora 10 being installed on LVM. Here is my previous fstab details :

# /etc/fstab: static file system information.
# <file system> <mount point>   <type>  <options>       <dump>  <pass>

tmpfs    /dev/shm    tmpfs    defaults    0    0
devpts    /dev/pts    devpts    gid=5,mode=620    0    0
sysfs    /sys    sysfs    defaults    0    0
proc    /proc    proc    defaults    0    0
/dev/dm-0    /    ext3    defaults    1    1
#Entry for /dev/sda7 :
UUID=3bb42530-5757-4f5a-9c10-16580ee6994a    /boot    ext3    defaults    1    2
#Entry for /dev/sda5 :
UUID=08563C60563C50A4    /media/Personal_Data    ntfs-3g    defaults,locale=en_US.UTF-8    0    0
#Entry for /dev/sda2 :
UUID=FCB60995B6095196    /media/c:    ntfs-3g    defaults,locale=en_US.UTF-8    0    0
/dev/dm-1    swap    swap    defaults    0    0

But there were no /dev/dm-0 and /dev/dm-1 in /dev/ folder. The solution was to replace dm-0 by VolGroup00/LogVol00 and dm-1 by VolGroup00/LogVol01. Actually in LVM, the root is denoted by /dev/VolGroup00/LogVol00 and swap by /dev/VolGroup00/LogVol01. I made the necessary changes. Now, /etc/fstab looks like this:

NOTE : For the following steps, root access will be required, do ‘su -‘ first.

# /etc/fstab: static file system information.
# <file system> <mount point>   <type>  <options>       <dump>  <pass>

tmpfs    /dev/shm    tmpfs    defaults    0    0
devpts    /dev/pts    devpts    gid=5,mode=620    0    0
sysfs    /sys    sysfs    defaults    0    0
proc    /proc    proc    defaults    0    0
/dev/VolGroup00/LogVol00    /    ext3    defaults    1    1
#Entry for /dev/sda7 :
UUID=3bb42530-5757-4f5a-9c10-16580ee6994a    /boot    ext3    defaults    1    2
#Entry for /dev/sda5 :
UUID=08563C60563C50A4    /media/Personal_Data    ntfs-3g    defaults,locale=en_US.UTF-8    0    0
#Entry for /dev/sda2 :
UUID=FCB60995B6095196    /media/c:    ntfs-3g    defaults,locale=en_US.UTF-8    0    0
/dev/VolGroup00/LogVol01    swap    swap    defaults    0    0

Now I just needed to create initial ramdisk images for preloading modules. So I did :

mkinitrd -f -v /boot/initrd-

and also for the previous kernel

mkinitrd -f -v /boot/initrd-

Then I did a reboot, and booting with the kernels ( and were as smooth as before.

That was all.

Thank you