Recently, I was trying to connect to a WiFi access point in my room. Some how the system not able to associate to the access point. It took lots of time for me to find out that WPA-PSK encryption is used. Following steps helped me to setup wpa_supplicant which encrypts the stream.

1. Create wpa_supplicant.conf. Mine is located at /etc/

ctrl_interface=/var/run/wpa_supplicant
network={
	ssid="Access Point SSID"
	scan_ssid=1
	proto=WPA
	key_mgmt=WPA-PSK
	psk="Really Secret"
	priority=5
}

2. Put following commands inside a shell script

#!/bin/sh
wpa_supplicant -Dwext -ieth2 -c/etc/wpa_supplicant.conf -Bw
dhclient eth2

3. Run the above script to bring the link up.

Now have fun with browsing!

The latest version of iee80211 (ieee80211-1.2.18) and ipw220 (ipw2200-1.2.2) are not compiling properly on the latest linux kernel 2.6.25.3.

I got the following error when I compiled ipw2200 on my laptop.

/home/noorul/software/ipw2200/ipw2200-1.2.2/ipw2200.c: In function ‘ipw_pci_probe’:
/home/noorul/software/ipw2200/ipw2200-1.2.2/ipw2200.c:11937: error: implicit declaration of function ‘SET_MODULE_OWNER’

In my case I was able to find out a solution from some other project. But there is a patch in the bug database. Here is the link http://www.intellinuxwireless.org/bugzilla/attachment.cgi?id=1378

But in the case of iee80211, I couldn’t find a straight forward solution. But the following steps helped me. There were several errors across multiple files.

1. I had to make changes to ieee80211_module.c. Here is the patched file.

ieee80211_module.c

2. Then the files ieee80211_crypt_wep.c, ieee80211_crypt_tkip.c

ieee80211_crypt_wep.c
ieee80211_crypt_tkip.c

Once I made the above changes, I followed the normal compilation procedure and everything worked fine. Posting this one through wireless internet connection.

I was struggling to install E17 from CVS on my Debian system. I couldn’t find out the exact steps that I have to follow. Recently I joined e-users mailing list and I got help from one the members. The steps are given below.


cd
mkdir src
cd src
cvs -z3 -d:pserver:anonymous@anoncvs.enlightenment.org:/var/cvs/e co e17/libs/eet
cvs -z3 -d:pserver:anonymous@anoncvs.enlightenment.org:/var/cvs/e co e17/libs/edb
cvs -z3 -d:pserver:anonymous@anoncvs.enlightenment.org:/var/cvs/e co e17/libs/evas
cvs -z3 -d:pserver:anonymous@anoncvs.enlightenment.org:/var/cvs/e co e17/libs/ecore
cvs -z3 -d:pserver:anonymous@anoncvs.enlightenment.org:/var/cvs/e co e17/libs/embryo
cvs -z3 -d:pserver:anonymous@anoncvs.enlightenment.org:/var/cvs/e co e17/libs/edje
cvs -z3 -d:pserver:anonymous@anoncvs.enlightenment.org:/var/cvs/e co e17/apps/e

cd e17/lib/eet
./autogen.sh && ./configure && make && sudo make install

cd ../edb
./autogen.sh && ./configure && make && sudo make install

cd ../evas
./autogen.sh && ./configure && make && sudo make install

cd ../ecore
./autogen.sh && ./configure && make && sudo make install

cd ../embryo
./autogen.sh && ./configure && make && sudo make install

cd ../edje
./autogen.sh && ./configure && make && sudo make install

cd ../../apps/e
./autogen.sh && ./configure && make && sudo make install

cd
enlightenment_start

These steps are derived from the user guide at
http://www0.get-e.org/E17_User_Guide/English/_pages/2.1.html

Here is my initial screen shot.

My E17 Desktop Screenshot

Posted by: noorul | May 25, 2008

Struggling with playing VCD on GNU/Linux.

Few months back I tried playing a VCD on my linux laptop but I couldn’t play it. I spent some time trying to find out what went wrong. dmesg showed lots of error messages like this.


hdc: command error: status=0x51 { DriveReady SeekComplete Error }
hdc: command error: error=0x54 { AbortedCommand LastFailedSense=0x05 }
ide: failed opcode was: unknown
ATAPI device hdc:
Error: Illegal request -- (Sense key=0x05)
Illegal mode for this track or incompatible medium -- (asc=0x64, ascq=0x00)
The failed "Read 10" packet command was:
"28 00 00 00 01 3e 00 00 02 00 00 00 00 00 00 00 "
end_request: I/O error, dev hdc, sector 1276

Even when I tried to mount cd-rom drive and access the file /media/cdrom/MPEGAV/AVSEQ01.dat, I got following error;


AVSEQ01.DAT: ERROR: cannot read `AVSEQ01.DAT' (Input/output error)

I even tried using dd to copy and create an image of the VCD onto hard disk and loop mount it. But this also lead to input/output error. At that time I was not in a mood to spent more time and find out a solution. I use mplayer for playing media files on my laptop. Today I noticed few things when I ran mplayer command. It displayed the following and hanged.


MPlayer dev-SVN-r19208-3.3.5 (C) 2000-2006 MPlayer Team
CPU: Intel(R) Pentium(R) M processor 1.86GHz (Family: 6, Model: 13, Stepping: 8)
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2

Playing vcd://.
track 01: adr=1 ctrl=4 format=2 00:02:00 mode: 1
track 02: adr=1 ctrl=4 format=2 00:18:74 mode: 1
track 03: adr=1 ctrl=4 format=2 37:52:32 mode: 1

When I carefully went through those last three lines I could see the length of the 3rd track to be more meaningful. So I tried playing the 3rd track using the following command and it worked. I need to google and find out why exactly I am not able to access this file directly.


$ mplayer vcd://3
or
$ mplayer -vcd 3

Okay! I have to watch this movie now.

Sony Ericsson w810i – Airtel Mobile Office – A review 11:30

Recently I bought a Sony Ericsson w810i mobile. Till then I was using Nokia 1100. I never felt to go for a high end model. Recently Airtel introduced Mobile Office scheme and I thought of utilising this feature.

Airtel Mobile Office provide various schemes under this name. I choose 30 days unlimited internet access for Rs. 375/-. This is in Chennai and I don’t know about the price in other cities. I think it is much cheaper in Kerala. One wonderful thing about this scheme is that roaming is free of charge. While roaming you can access unlimited internet without paying any roaming charges. I had wonderful experience in Cochin. It is best to use this scheme in Airtel EDGE enabled networks. To utilise this technology an EDGE enabled mobile phone is necessary. That is why I choose Sony Ericsson w810i.

I bought w810i for Rs. 14400/-. I thought it was worth spending that much because of the cool features it has other than normal mobile features.

  • Music only mode allows you to use your device as music player.
  • Wonderful music player which plays almost all formats.
  • Built-in FM radio. Earphone should be plugged in inorder to use this feature.
  • 512 MB memory stick that comes with the mobile is enough to store some of your recent hits and some games and cool applications.
  • Lots of Java applications can run on this mobile.
  • EDGE enabled for high speed data transfer.
  • Bluetooth
  • Infra-red.
  • Plenty of cool applications
  • Light weighted.

What else can you ask from a small mobile phone?

I haven’t used any other high end mobile phones. So I can’t make a comparison here. Altogether I am satisfied with the performance and features of this mobile.

Coming back to Airtel Mobile Office, I had some initial issues getting connected to the internet. There is a Rs. 375/- recharge especially for Mobile Office. Once this is done, customer will receive a confirmation message from Airtel within 24 hours saying that the connection got activated. Followed by setting will be sent which is to be installed. Now you have to restart the phone to start using GPRS connection. I was not aware of this restart thing and hence I was not able to connect initially. I had to take the phone to nearby Airtel center where they fixed the issue by just restarting the mobile.

After getting this issues fixed, I was on internet always. Even I can connect this mobile phone to my laptop and browse from it. That is another article. I installed some cool Java applications that helps me to keep connected to the internet.

  • Opera Mini – Wonderful browser. I wonder how could they put everything in KBs.
  • GoTalkMobile – For instant messaging – Google Talk.
  • EQO Mobile – For instant messaging – Supports multiple protocol – Yahoo, Gtalk, etc.
  • jmIrc – Cool irc client.
  • MidpSSH – Another wonderful telnet/ssh client. I couldn’t believe when I remotely logged into grex.org.
  • flurry – To send photos as e-mail.

Most of these applications are available from http://getjar.com.

Life is much better!

Posted by: noorul | May 25, 2008

Ruby 1.8 with POP3 with SSL support.

Ruby 1.8 does’nt have code to access POP3 servers using SSL. But there is code for accessing HTTP servers using SSL. So I thought I can tweak the same code to use with Net::POP3 class. Since these days gmail is so popular that most of the people started using it. Gmail only provides POP3 over SSL. So this tweak may help those who want to access Gmail using Ruby.

The dynamic removal of methods from ruby classes helped me with this. I had to even remove the constructor to keep the changes minimal. But ruby is smart enough to throw warning message for removing the constructor. I ignored the warning because in our case it is not going to create any havoc.

Even though this code resides in a new file pops.rb, the changes are made to the class POP3 which is defined in pop.rb. Actually you will be using a modified version of POP3 class rather than a new version of it. The only additional thing that need to be taken care of is while creating an instance you have to pass the SSL port and also after that you need to set the value of use_ssl attribute of POP3 class to true. If use_ssl is false then the POP3 behaves normally. In the code itself there is an example.

Below is the code for net/pops.rb.

require 'net/pop'
require 'openssl'

module Net

  # == Examples
  # 
  # === Retrieving Messages 
  # 
  # This example retrieves messages from the server and deletes them 
  # on the server.
  #
  # Messages are written to files named 'inbox/1', 'inbox/2', ....
  # Replace 'pop.example.com' with your POP3 server address, and
  # 'YourAccount' and 'YourPassword' with the appropriate account
  # details.
  # 
  #     require 'net/pops'
  # 
  #     pop = Net::POP3.new('pop.example.com', pop3_ssl_port)
  #     pop.use_ssl = true
  #     pop.start('YourAccount', 'YourPassword')             # (1)
  #     if pop.mails.empty?
  #       puts 'No mail.'
  #     else
  #       i = 0
  #       pop.each_mail do |m|   # or "pop.mails.each ..."   # (2)
  #         File.open("inbox/#{i}", 'w') do |f|
  #           f.write m.pop
  #         end
  #         m.delete
  #         i += 1
  #       end
  #       puts "#{pop.mails.size} mails popped."
  #     end
  #     pop.finish                                           # (3)
  # 
  # 1. Call Net::POP3#start and start POP session.
  # 2. Access messages by using POP3#each_mail and/or POP3#mails.
  # 3. Close POP session by calling POP3#finish or use the block form of #start.

  class POP3

    remove_method :do_start
    remove_method :initialize

    def initialize( addr, port = nil, isapop = false )
      @address = addr
      @port = port || self.class.default_port
      @apop = isapop

      @command = nil
      @socket = nil
      @started = false
      @open_timeout = 30
      @read_timeout = 60
      @debug_output = nil

      @mails = nil
      @n_mails = nil
      @n_bytes = nil

      @use_ssl = false
      @ssl_context = nil

    end

    def do_start( account, password )
      s = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
      if use_ssl?
        unless @ssl_context.verify_mode
          warn "warning: peer certificate won't be verified in this SSL session"
          @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
        end
        s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context)
        s.sync_close = true
      end
      @socket = Net::InternetMessageIO.new(s)
      @socket.read_timeout = @read_timeout
      @socket.debug_output = @debug_output

      if use_ssl?
        s.connect
      end

      on_connect
      @command = POP3Command.new(@socket)
      if apop?
        @command.apop account, password
      else
        @command.auth account, password
      end
      @started = true
    ensure
      do_finish if not @started
    end
    private :do_start

    def use_ssl?
      @use_ssl
    end

    # For backward compatibility.
    alias use_ssl use_ssl?

    # Turn on/off SSL.
    # This flag must be set before starting session.
    # If you change use_ssl value after session started,
    # a Net::HTTP object raises IOError.
    def use_ssl=(flag)
      flag = (flag ? true : false)
      raise IOError, "use_ssl value changed, but session already started" \
          if started? and @use_ssl != flag
      if flag and not @ssl_context
        @ssl_context = OpenSSL::SSL::SSLContext.new
      end
      @use_ssl = flag
    end

    def self.ssl_context_accessor(name)
      module_eval(<<-End, __FILE__, __LINE__ + 1)
        def #{name}
          return nil unless @ssl_context
          @ssl_context.#{name}
        end

        def #{name}=(val)
          @ssl_context ||= OpenSSL::SSL::SSLContext.new
          @ssl_context.#{name} = val
        end
      End
    end

    ssl_context_accessor :key
    ssl_context_accessor :cert
    ssl_context_accessor :ca_file
    ssl_context_accessor :ca_path
    ssl_context_accessor :verify_mode
    ssl_context_accessor :verify_callback
    ssl_context_accessor :verify_depth
    ssl_context_accessor :cert_store

    def ssl_timeout
      return nil unless @ssl_context
      @ssl_context.timeout
    end

    def ssl_timeout=(sec)
      raise ArgumentError, 'Net::POP3#ssl_timeout= called but use_ssl=false' \
          unless use_ssl?
      @ssl_context ||= OpenSSL::SSL::SSLContext.new
      @ssl_context.timeout = sec
    end

    # For backward compatibility
    alias timeout= ssl_timeout=

    def peer_cert
      return nil if not use_ssl? or not @socket
      @socket.io.peer_cert
    end
  end

end

Another way is to use socat. You can download it from internet or can be installed it using your favourite package manager.

Here is how the command is to be used.

socat TCP4-L:3000 OPENSSL:pop.gmail.com:995,verify=0

Now insted of using ‘net/pops’ you can use ‘net/pop’ itself and communicate with POP3 servers using SSL. But the only change will be that, instead of using the target server in the constructor you need to use the localhost with the port that you mention for TCP4-L in socat.

pop = Net::POP3.new('localhost', 3000)

I don’t know whether this will help people. If it does, then drop me a mail. I think ruby 1.9 will have this built inside ‘net/pop’.

Have fun!

I use SE W810i with Airtel Mobile Office service to connect to the internet. There are two ways by which you can do this. One is connecting the mobile phone to the computer using USB cable. Another option is to connect the phone using Bluetooth. Both options allows you to use the phone as a modem. For me both of them worked, but here I will be mention how to configure using USB cable.

I assume that you have subscribed to Airtel Mobile Office and you are able to browse internet using phone.

You need cdc_acm module in order to make your phone act as a modem. I hope you have this compiled as a module. Just plugin the USB cable into your computers USB port and use the command dmesg to see the following messages at the bottom.


usb 2-2: new full speed USB device using uhci_hcd and address 2
usb 2-2: configuration #1 chosen from 1 choice
cdc_acm 2-2:1.1: ttyACM0: USB ACM device
cdc_acm 2-2:1.3: ttyACM1: USB ACM device
usbcore: registered new interface driver cdc_acm
drivers/usb/class/cdc-acm.c: v0.25:USB Abstract Control Model driver for USB modems and ISDN adapters

If you see something similar, that means your device has been detected as a modem. You can access this device using the file /dev/ttyACM0. You can even use minicom or other communication programs to use this device as a modem.

Also you need ppp to connect to the internet. Install ppp daemon for your distribution. Debian users can just do the following to install ppp.


sudo apt-get install ppp

This will install both pppd and chat programs. I won’t get into much detail about these commands here.

Steps
1. Create a file /etc/ppp/peers/w810i with the following contents.


/dev/ttyACM0
connect '/usr/sbin/chat -v -f /etc/ppp/peers/chat-w810i'
debug
crtscts
noipdefault
ipcp-accept-local
defaultroute
novj
nobsdcomp
novjccomp
nopcomp
noaccomp
usepeerdns
noauth

2. Now create another file /etc/ppp/peers/chat-w810i with the following contents.


ECHO ON
'' 'AT'
'OK\r' 'AT+CGDCONT=1,"IP","airtelgprs.com","0.0.0.0",0,0'
'OK\r' 'ATD*99***1#'
'CONNECT'

Now you are ready to connect to the internet. Just type in the following command.


sudo pppd call w810i

You must be sudoer for the sudo command to work. It will ask for your password. If you don’t use sudo then you can log in as root and run the same command without sudo in the beginning. Now you will see a message “Connecting” on your mobile phone. If you look at the file /var/log/messages at the bottom you can see something similar to below lines, this means you are connected to the internet.


Jul 30 20:22:18 xxxxxx pppd[4652]: Serial connection established.
Jul 30 20:22:18 xxxxxx pppd[4652]: Using interface ppp0
Jul 30 20:22:18 xxxxxx pppd[4652]: Connect: ppp0 /dev/ttyACM0
Jul 30 20:22:19 xxxxxx pppd[4652]: Remote message: Congratulations!
Jul 30 20:22:19 xxxxxx pppd[4652]: PAP authentication succeeded
Jul 30 20:22:19 xxxxxx kernel: PPP Deflate Compression module registered
Jul 30 20:22:20 xxxxxx pppd[4652]: local IP address 117.97.49.57
Jul 30 20:22:20 xxxxxx pppd[4652]: remote IP address 61.95.248.66
Jul 30 20:22:20 xxxxxx pppd[4652]: primary DNS address 202.56.250.5
Jul 30 20:22:20 xxxxxx pppd[4652]: secondary DNS address 202.56.250.6

Open your favourite browser, mine is firefox, and have fun.

Posted by: noorul | May 25, 2008

Know ICICI Securities charges!

I was not completely aware of the following charges that ICICIDirect levied on every transaction.

The general brokerage that is charged for delivery based trading is 0.75% of
the trade value or Rs.25 whichever is higher.

For the transaction value less than Rs.1000 the flat brokerage of 2.5 % will
be applicable.

Service Tax @ 12.36% of brokerage and securities transaction tax @ 0.125% of
trade value are in additional

It is always better to transact for more than Rs. 3335.00. If you transact below this amount you are loosing money.

Posted by: noorul | May 25, 2008

IBM ThinkPad R52 and linux

I upgraded my kernel from 2.6.21 to 2.6.22. But, somehow with the same .config from 2.6.21 didn’t work as I expected with 2.6.22. The model R52 comes with IDE CD-ROM drive. So I wanted to use the ide drivers with scsi emulation for CD-ROM. I compiled ide modules into the kernel so that it gets loaded first and detect my CD-ROM drive. But ide module probes for all IDE devices including my hard disk. I don’t want to use IDE driver for my hard disk instead I wanted to use ata drivers with scsi emulation. The option left is to pass module level parameters to ide asking not to probe for my hard disk. This can be achieved by passing hda=noprobe to ide. As per the following excerpt from Documentation/kernel-parameters.txt;

Module parameters for modules that are built into the kernel image
are specified on the kernel command line with the module name plus
‘.’ plus parameter name, with ‘=’ and value if appropriate, such as:

usbcore.blinkenlights=1

I can pass hda=noprobe to ide by appending ide.hda=noprobe to kernel command line. But this doesn’t work for me. I think that in drivers/ide/ide.c, the code for latest __setup() macro is incomplete. I read lots of code and tried to understand what exactly is happening, but I couldn’t find out how I can pass hda=noprobe to ide without doing the following changes to drivers/ide/ide.c. I added following piece of code in the function ide_init().


#ifndef MODULE /* I dont want the below code to be compiled if I later compile this as a module */
ide_setup("hda=noprobe");
ide_setup("hdb=noprobe"); // I don't have second HDD, still I don't want it to probe.
#endif /* !MODULE */

The above code will ensure that, when the kernel loads ide drivers, it wont probe for my hard disk. And above piece of code helped me to achieve my goal. I still don’t know whether there is some way to pass hda=noprobe to ide without doing above code change. If someone know, how to do it, then let me know.

Posted by: noorul | May 25, 2008

Compiling emacs-unicode from cvs on debian etch.

Emacs-22+ doesn’t support Xft fonts, hence the look and feel of emacs on X-Windows is not that good. But development is going on to provide this feature in emacs. The emacs-unicode-2 branch for emacs has this feature, hopefully this will get integrated to emacs-23.

I followed the following steps to compile emacs-unicode from CVS.

1. Checkout latest source for emacs-unicode.


cd /opt
cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs co -r emacs-unicode-2 emacs

2. I had a problem with NSTATICS constant in emacs/src/alloc.c when compiling. I think you might face the same problem. You have to change the value of this constant. You have to look for the definition of this constant in emacs/src/alloc.c. I did the following. May be a lower value will also work. Commented the existing definition and added mine.


/* #define NSTATICS 1280 */
#define NSTATICS 2048

3. Now use configure script to generate make files.


cd /opt/emacs
./configure --with-gtk --enable-font-backend --with-xft --with-freetype

4. At last the make command


make bootstrap

It took around 5 hours for me to figure out the NSTATICS problem. I hope this will help some of you. If this helps any one of you then drop me a mail. I will be happy.

Older Posts »

Categories

Follow

Get every new post delivered to your Inbox.