Oct 17, 2014

Getting Scanbuttond to work with Canon Lide 110 and 210 under Ubuntu

I recently purchased the Lide 110 and tried to get the scanner buttons working on my ubuntu home server using a tool called scanbuttond. But after a day of trying to compile everything, I figured two things:
1. The genesys backend that is available from older versions of scanbuttond works only with lower versions of the Canon Lide series, including Lide 100 and 200.

2. The USB protocol and handshake have changed in the Lide 110 and Lide 210. So even if you manage to get it all compiled, the old genesys backend no longer works.

So I started to dig into the various information on the internet and have finally figured  a way to get this working. I thought it would be useful to share with people who need to get this combination working. 

1.       First of all, download the latest version of scanbuttond from the official website.  Extract the file above to a directory where you can compile.
wget http://downloads.sourceforge.net/project/scanbuttond/scanbuttond/0.2.3/scanbuttond-0.2.3.tar.gz
tar -zxzf scanbuttond-0.2.3.tar.gz
cd scanbuttond-0.2.3
2.       You now need to get the old version of scanbuttond, patch and copy the files genesys.c and genesys.h from the old package to the "backends" directory from point 1.

If you are not comfortable doing this manually, just copy these two pre-patched files into the “backends" directory where you extracted the current scanbutton. Skip 3 and 4 if you do this.
cd backends
wget https://dl.dropboxusercontent.com/u/6329778/genesys/genesys.
wget  https://dl.dropboxusercontent.com/u/6329778/genesys/genesys.h

3.   This is the new code that is changed in genesys.c to support Lide 110 and Lide 210.

    static int supported_usb_devices[NUM_SUPPORTED_USB_DEVICES][3] = {
        // vendor, product, num_buttons
        { 0x04a9, 0x1909, 15 }, // CanoScan LiDE 110 (only 4 real buttons)
        { 0x04a9, 0x190a, 15 }  // CanoScan LiDE 210 (only 4 real buttons)
    };
    
    static char* usb_device_descriptions[NUM_SUPPORTED_USB_DEVICES][2] = {
        { "Canon", "CanoScan LiDE 110" },
        { "Canon", "CanoScan LiDE 210" }
    };
The reason to remove support for other canon scanners is because the usb handshake is fundamentally different for these two scanners and there is no sense in keeping support for old scanners that do not work with this code.

4.    And the logic for the USB handshake that has now changed.

    int scanbtnd_get_button(scanner_t* scanner)
    {
       unsigned char bytes[2];
       int num_bytes;
       int button = 0;
      
       if (!scanner->is_open)
          return -EINVAL;

       num_bytes = libusb_control_msg((libusb_device_t*)scanner->internal_dev_ptr,
                               0xc0, 0x0c, 0x008e, 0x3122, (void *)bytes, 0x0002);
      
       if (num_bytes != 2) {
          syslog(LOG_WARNING, "genesys-backend: communication error: read length:%d, num_bytes);
          return 0;
       }
      
       return (bytes[0] ^ 0x1f) & 0x1f;
    }

5.       This is the slightly tricky part as it depends on your machine, getting scanbuttond to compile with the new changes. You have to change the makefiles to use genesys as a extra backend :

cd scanbuttond-0.2.3\backends
rm -f Makefile.am Makefile.in meta.conf
wget https://dl.dropboxusercontent.com/u/6329778/genesys/Makefile.am
wget https://dl.dropboxusercontent.com/u/6329778/genesys/Makefile.in
wget https://dl.dropboxusercontent.com/u/6329778/genesys/meta.conf

Now compile the source code:
cd scanbuttond-0.2.3
./configure --prefix=/usr --sysconfdir=/etc
make
make install

6.       If all goes well in the compile and install, you are ready to rock and roll !
Run scanbuttond with this command:
scanbuttond --foreground --backend=/usr/lib/libscanbtnd-backend_genesys.so
tail –f /var/log/syslog
Start pressing buttons on the scanner and you should see the results in the console.

For your reference, this is my /etc/scanbuttond/buttonpressed.sh
#!/bin/sh
# This script is started by scanbuttond whenever a scanner button has been pressed.
# Scanbuttond passes the following parameters to us:
# $1 ... the button number
# $2 ... the scanner's SANE device name, which comes in handy if there are two or
#        more scanners. In this case we can pass the device name to SANE programs
#        like scanimage.

SCANFILE="/ScannedFiles/$(date +%Y%m%d-%H%M%S)"

case $1 in
        1)
                #echo "Auto Scan has been pressed on $2"
                scanimage --format tiff --mode Color --depth 8 --resolution 150 -l 0 -t 0 | convert tiff:- $SCANFILE.jpg
                ;;
        2)
                #echo "Copy has been pressed on $2"
                scanimage --format tiff --mode Color --depth 8 --resolution 200 -l 0 -t 0 -x 215mm -y 297mm | convert tiff:- $SCANFILE.jpg
                lpr -o scaling=100 -o media=A4 -T SCANNER -P EPSON_Color $SCANFILE.jpg
                ;;
        4)
                #echo "Email has been pressed on $2. Make a small size jpg and pdf"
                scanimage --format tiff --mode Color --depth 8 --resolution 100 -l 0 -t 0 | convert tiff:- $SCANFILE.jpg
                convert -quality 75 -compress jpeg $SCANFILE.jpg $SCANFILE.pdf
                ;;
        8)
                #echo "PDF has been pressed on $2"
                scanimage --format tiff --mode Color --depth 8 --resolution 200 -l 0 -t 0 -x 215mm -y 297mm > $SCANFILE.tiff
                convert -quality 90 -compress jpeg $SCANFILE.tiff $SCANFILE.pdf
                rm -f $SCANFILE.tiff
                ;;
esac

That is all ! Have scanbuttond start automatically by adding this line in your /etc/rc.local
scanbuttond --pollingdelay 3000000 --backend=/usr/lib/libscanbtnd-backend_genesys.so
Enjoy !

Want your own website ? Take a look at Terabyte Websites. They take care of building, hosting and maintaining your website.

Aug 22, 2014

"Tick Tock" Career changes...


Over the last few years, I have been asked by a lot of people on how to move ahead in your career. About making the right jumps, about growing the corporate ladder and making more money in the bargain. And the answers are never similar as each case is different. But then I realized that Im working on a plan in my own career and maybe I should write down my thoughts on the Tick Tock model that I follow for myself.

What is the Tick Tock model ? In software development, many companies operate on a tick-tock release schedule. The “tick” release introduces new features, dramatically alters the UI, and can dramatically alter the underlying framework of the software. The “tock” on the other hand, goes back and cleans up the code, fixes old incompatibilities, eliminates UI inconsistencies, and often prepares the groundwork for the next major tick. This is fundamentally a safe way to move ahead. For example, Windows 7  was a "tick" release for Microsoft, they overhauled the Vista style to a new framework and brought in a new UI. Windows 7 SP1 was the “tock” release, way more stable and rock solid.

So why is a job change difficult ? Fundamentally because people tend to think of career jumps as meaning one primary thing with a few add-on. More Money is the primary thing. And new domain, promotion, work location etc become the add-on. And so they give up on good opportunities that come their way simply because a job change has to be "better in most ways" compared to my current job. 

So there are often very good people stuck in the same job for years. They get paid very well, often times at par with the best of companies, but they hit a glass ceiling when it comes to career growth. They get into a comfort zone with their work (bragging rights are never as issue because they get paid well), they think they are doing great in technology, but they fail to realize that they have been doing variations of the same thing for so many years now that they are bound to be good in it. The complacency sets in deep and hard.

And then someone out there offers you a break in a new company at a better position that you are in. Most times, it is usually someone you knew from the past, but given that nothing comes for free, they often cannot pay more than what you are already making. And the work itself might be very tough. This is the point where you make a “tick” change. Ensure that the management is willing to give you a slightly longer rope and then make the jump, even at the same salary or even at a slightly lower perk structure.

So why would you do that ? Ask yourself two questions :

Would I not take the same promotion in my current company at the same salary ?

and

Given that Im getting bored with the same job, would I not be willing to join a new group in the same company (salary remaining the same) ? 

The answer to both questions is always a yes, yet we hesitate the do the same when the company is new. Think of it as a battery recharge for your system. You get to dabble in a new domain and learn the tricks of the trade at the next level you are being offered. Do it for a few years and you will realize that the management will quickly figure out you are good, then your compensation and stock options will start climbing. Over the next three years, you will often make up for any loss of hypothetical money that you gave up during the jump.

And remember, it’s still hypothetical money that you gave up. Because if you never jumped, you would still be in the same job at the same salary plus maybe a total 12% hike over the three years.

And after a reasonable number of years when you are doing good in your new position, its time for a “tock” change. You are now the master of the current position, so a bigger fish is going to be ready to to lap you up at an fantastic salary and perks. And then you realized that you have not only recovered your loses in the “tick” jump you made, you are now well ahead of the game !

Of course, theory often does not work well in real life. But at a fundamental level, this model never goes wrong. Remember that when the IT companies started up in the 90’s. lot of people got into big companies are now retiring after twenty years in the same company, they never needed to do the jumps because the companies were growing in a insane manner. Every Tom and Dick and Harry was getting promotions and hikes as the companies grew. But this is no longer the case as all the big/good companies have stabilized. You WILL hit a glass ceiling sooner or later. And will have to compromise if you want to make a “tick” jump.


And yes, one word of advice. Spend at least 3 years in any company even if it is only reasonably good. And up to 8 years if the company is great. Anything more, you are seen as a squatter. Anything less, you are seen as a jumper. And your resume will start carrying this weight for all your career.

Want your own website ? Take a look at Terabyte Websites. They take care of building, hosting and maintaining your website.

Jan 9, 2013

Epson Filter driver for L110 & L210 for Raspberry Pi (ARM6)

Update : I have throw away my Epson L110 printer after getting plaugued with constant dry head and clean head/flush ink routine every two weeks. I finally got the Brother printer with the same ink tanks, no more head drying issue. Please consider the Brother DCP-T300 if you are loking for a good printer.

As for the drivers, they are no longer available or mainitaned by me.

------------------------------------------------

Want your own website ? Take a look at Terabyte Websites. They take care of building, hosting and maintaining your website.

------------------------------------------------

I was trying to setup the Raspberry Pi to work as a Printer server on my home network and figured out that the Epson L110 is a new printer, no support as yet from CUPS on Linux.

After a lot of struggle, I managed to compile the ARM6 version of the Epson Filter drivers for the L110 and got it working. Thought I would share the same as it is not easy to get a ARM version of the filter driver.

1. Extract "Epson Filter Driver.zip" in your root on the Raspberry Pi. This will create the /opt structure that you need plus two additional files in the root. The opt directory also contains the Epson Filter driver for ARM.
2. Run postinst.
3. Make sure you correct the path to the filter driver in the PPD file if you are placing it elsewhere.
4. Use the attached PPD file to install the printer in the cups web interface.

Lo and Viola, it starts working. However, CUPS is still not able to print a test page from the same machine, but printing works from other machines as a network printer.


Epson Filter Driver.zip

This will probably work for the Epson L110 Series, L210 Series, L300 Series, L350 Series, L355 Series, L550 Series, L555 Series drivers. The sources and x86 are available at Epson Site

Jul 18, 2012

Case for my Raspberri PI using Lego building blocks

Got my new Raspberry PI today and the first thing was to make a nice little box for it. I had seen some Lego cases in the web, but they were custom blocks. So I used my Son's regular Lego building blocks and built this. Came out surprisingly good and the fit is just perfect :-)



Jul 3, 2012

Setting up a MP3 player and media streamer on a cheap router...

I have been considering hosting all my music collection in a central place in the house to reduce redundancy with the many gadgets we use now a days. A dedicated NAS machine was not a good option simply because electricity is precious and expensive in India. And then the cost of dedicating a 24/7 hardware to host files is also not a great idea. Even if I used a small NAS box to save power, it still does not allow me to play the music anywhere I want. I need clients everywhere that can browse network shares and play the music.

Secondly, the charm of a radio station is the unpredictability of what plays next. The charm never works with a music collection where we tend to play the same songs we like over and over again. So I have also been fascinated with the idea of streaming my own English collection randomly, possibly because there is not a single FM radio station in Bangalore that is dedicated to English music.

The other requirement is that I should be able to control the music in various ways, primarily through the Phones and PC's ate home. After considering various high cost alternatives (in terms of hardware cost), I think I have found pretty much the perfect option. A low cost router that can do all the above :-)

Now, why did I document it when there are tons of people who have tried the same on various forums and have succeeded over the years ? Well, all of them have scattered bits and pieces of information dating back to three years ago when openwrt was small and could easily fit the 4mb flash on the Asus 520gu. The older versions of mpd (music player deamon) were also used, mpd has grown to gigantic proportions in the meantime (by router standards) and none of the forums have consolidated information on how to run audio on the router with the latest features of mpd.

So after one week of piecing together various options and trying out build after build, here is a precise walk through.

 

What do you need :

 

1. A router compatible with either OpenWRT or Tomato open source with a available USB port. I personally started with the ASUS WL-520gU, primarily because it is available for less than Rs 2000 everywhere. Later on, I figured out that I could have made my life a ot easier with a router that ships with more than 4mb memory. My old Buffalo WZR-HP-G300NH was the second experiment and it was much easier to configure.

Anyways, this blog will focus on the low cost ASUS WL-520gU.

2. A cheap USB hub, maybe a Belkin 4 port USB hub that is available for Rs 250. A powered hub is a netter choice is you intend to keep a lot of music in multiple usb drives. I personally had a Logitech 4 port hub.

3. A cheap 1gb or 2gb USB drive that will host the OS files.

4. A big kick ass usb drive which can hold all your music collection. I personally went with a 32gb drive !

5. A cheap USB sound adaptor with any C-Media chipset that is available for Rs 100 in ebay or everywhere in local shops. ( Check MightyOHM forum for more options). And yes, if you want a high end Optical output, there are a few options there also.

Now we start :-)

Want your own website ? Take a look at Terabyte Websites. They take care of building, hosting and maintaining your website.

Setting up the router with Tomato Firmware :


1. Download the Tomato firmware for the router from http://tomatousb.org/download

I personally recommend the Kernel 2.4 Lite version at Tomato 2.4 Lite

Also download the Asus Utility package for the router from their website. You need the Asus Firmware Restoration utility.

2. Connect the computer with a Ethernet cable to the port closest to the WAN port and setup the ip on your computer to 192.168.1.2 manually. No other connections should be active on the PC.

3. Press the reset button on the router and connect the power cord to it even as the button is pressed. You will see the Power LED blink slowly, now release the button.

4. Start the Asus firmware utility, select the firmware file you downloaded and start the process. Allow it to reboot and get ready for a full 5 minutes.

5. Change the IP address back to automatic on your PC and check that the Asus router now gives you a DHCP ip address.

6. Go to http://192.168.1.1 and login with the default user and password, both being "admin".

7. Now connect a WAN link to the router and power off and on the router. It should come up and start acting like a router !


Setting up the router with the necessary configuration and libraries:


1. Go to http://192.168.1.1 and choose the "USB and NAS" option in the Tomato menu and enable "Core USB Support", disable printing support, and enable USB Storage Support.

2. Using a existing linux machine, partition your USB pen drive with a  256mb SWAP named partition and the remaining as a ext2 partition named OPT (do not choose ext3 as it reduces the life of the pen drive with frequent writes).  The partition names of SWAP and OPT are important.

3. Now connect the USB hub to the router and connect the swap/ext2 formatted Pen drive to it. You should be able to see it mounted on the Tomato web interface immediately.

4. Enable ssh interface in the web interface and set the admin password. Now ssh into the router ip (192.168.1.1) using user "root" and password as you just defined.


We are in the SSH world now and ready to install the software we need :


1. Edit /etc/fstab and add these two lines to the file:

LABEL=SWAP none swap sw 0 0
LABEL=OPT /opt ext2 rw,noatime 1 1

2. Issues these commands to make the mount of /opt permanent.

nvram setfile2nvram /etc/fstab
nvram commit
reboot

Wait for the reboot and SSH again to the router. Now you should be able to see the ext2 partition mounted as /opt and the swap active in the web interface or via the mount command.

3. Issue the following commands to enable download of optware packages.

mkdir -p /opt/tmp
cd /opt/tmp
wget http://tomatousb.org/local--files/tut:optware-installation/optware-install.sh -O - | tr -d '\r' > /tmp/optware-install.sh
chmod +x /tmp/optware-install.sh
sh /tmp/optware-install.sh

This will take a little while. Make sure there are no errors reported. 

Now we install mpd and mpc plus the dependencies. The problem with the packaged mpd is that it does not seem to work well with httpd streaming, and hangs a lot. So we circumvented with additional packages from other sources and copying some libraries over existing ones to get the latest versions :

ipkg update

cd /opt/tmp
wget http://tomato.groov.pl/repo/mpd_0.16.2-2_mipsel.ipk
wget http://tomato.groov.pl/repo/gettext_0.14.5-2_mipsel.ipk

ipkg install mpd_0.16.2-2_mipsel.ipk

echo src optware http://tomato.groov.pl/repo > /opt/tmp/optware.conf
echo dest /opt/ / >> /opt/tmp/optware.conf
ipkg -f /opt/tmp/optware.conf update
ipkg -f /opt/tmp/optware.conf install gettext_0.14.5-2_mipsel.ipk
cp /opt/lib/libintl.so.0 /opt/lib/libintl.so.3

ipkg update
ipkg install sqlite libuclibc++
ipkg install mpc

The above install of mpd will install quite a few dependencies. Wait till all is done.

Note : The above files are also hosted in my private dropbox account in case the original link does not work.
https://dl.dropbox.com/u/6329778/gettext_0.14.5-2_mipsel.ipk
https://dl.dropbox.com/u/6329778/mpd_0.16.2-2_mipsel.ipk

Do drop a note of thanks to shibby20 at either of the links below as we used his hosted links on tomatousb. The mpd version in the tomato repository is older and not as efficient, this is his private compiled version of mpd 0.16.2 which works well. Here are the links that detail this:

http://www.wikidot.com/user:info/shibby20
http://tomatousb.org/forum/t-362104/usb-sound-on-asus-wl-520gu

4. Run mpd on the command line. It should now run and give functional errors, but not crib about any dependencies.


Setting up the audio interface


1. Insert the USB audio device to the usb hub. Make sure that the router recognized the insertion by typing the "dmesg" command, you should see a few lines about the audio device insertion

2. Issue the following commands :

cd /opt/tmp
wget http://tomatousb.org/local--files/doc/audio_control_files.tar.gz
cd /
tar zxvf /opt/tmp/audio_control_files.tar.gz opt
cd /opt/tmp
tar zxvf /opt/tmp/audio_control_files.tar.gz autoruns-to-use
cp /opt/tmp/autoruns-to-use/80-start-audio.autorun /opt
rm /opt/mpd/playlists/radio.m3u

Scripts obtained from this link. The link was my first starting point for this project, so a big thanks to the folks out there.Especially the startup scripts are a godsend and make sure that the music starts streaming the moment you switch on the router.

Note : The above files are also hosted in my private dropbox account in case the original link does not work.
https://dl.dropbox.com/u/6329778/audio_control_files.tar.gz 

3. Edit this file : /opt/etc/mpd.conf

Remove the existing state_file line and add this instead:

state_file              "/opt/etc/mpd.state"
pid_file                "/opt/mpd/mpd.pid"

Having the pid file isvery usefull while you are experimenting. Just use the "mpd --kill" command to kill the existing mpd proess instead of. Similarly, the state file is used to save the state information every time mpd exists. So you start the next round from the song you stopped the router at.

3. Edit this file : /opt/etc/mpd.conf

Remove the existing audio_output section and add these sections :

audio_output {
    type            "oss"
    name            "My USB Sound Device"   
    mixer_type      "software"
    device          "/dev/sound/dsp"
}

audio_output {
    type            "httpd"   
    name            "My HTTP Stream"
    encoder         "wave"
    port            "8000"
    bitrate         "128"
    encoding        "mp3"
    format          "44100:16:2"
}

Notes : The audio output section literally took me days to get it right with the right balance of quality and usability. The Asus 520gu does not have the horsepower in the CPU to do vorbis or lame encoding on the fly. The router just crashes. The wave encoder is the only one that works reliable on the 520gu, but if you have a slightly better cpu power in your router, fell free to change it to lame and see. vorbis always crashers in any router, do not know why.

Also, if you need only the http streaming or just the audio output, then remove the other section to save some cpu cycles for the router.

3. Now it is time to run the daemon to check. Insert some speakers or headphones into the audio adaptor and run the following commands:

/opt/80-start-audio.autorun
mpd
mpc update
mpc add /
mpc volume 50
mpc play

You should hear the one song that was added from the zip file you unpacked. Yippeee.

4. Now it is time to check if the same music is ALSO being streamed over http.

Start up vlc on your PC. Issue the mpc play command again (the song is short) and connect vlc to http://192.168.1.1:8000 and press play. You should hear the streamed music on your PC.


This is a good place to make the router enter your existing network and free it of Ethernet cables.

Tomato has a great option to make the Wireless interface in the router act as a bridge to your existing wireless network. Just choose the bride option in Wireless, provide your wireless network credentials and reboot, you will be on your home network wirelessly and the WAN cable would no longer be required.

Now to add your local music collection for random play.


1. Copy all your mp3's to another pen drive, preferably formatted to fat and insert the pen drive to the hub.

2. Note down the mount point in the tomato web interface and change the "music_directory" path to the same in /opt/etc/mpd.conf

3. Issue the commands :

mpd --kill
mpd
mpc add /
mpc update
mpc random on
mpc play

And Voila, you should hear random songs from your entire collection being simultaneously played on the audio adaptor and streamed to your local network. You can control the playlist and the collection by installing Gnome music player client (GMPC) on Windows. Or on Android or iPhone via the mpc ports, they both have lovely interfaces.

You can also add internet radio stations to the playlist. In this case the router serves as a nice Internet radio station streamer.

I actually plan to connect a hi-end FM transmitter to the audio output. That way, I get to play the random songs on any FM radio in the house !!! Finally my dream of a English FM radio station at home for cheap, with approximately 7 watts of power being used :-)

P.S : Also added as a guide at my favorite hangout, techenclave.com !!!
http://www.techenclave.com/guides-tutorials/setting-up-mp3-player-media-134452/#post1674834

Jul 16, 2011

Use your existing printer as a wireless printer for less than Rs 2000 ($40)

With a increasing number of computers and laptops inside each house, the need to share a single printer across the house has become increasingly necessary. I personally have a office laptop, a desktop, a Android tablet and my wife has a laptop; it is a complete pain trying to attach the printer to each of them and print stuff as we need.

One simple solution is to attach the printer to the home machine and share it on the network and have your laptops print to the network printer. I do not like the solution because every time you need to print anything from any place, you need to boot up he machine where the printer is attached.


So a wireless printer is the solution. A wireless inkjet printer itself is very expensive, the moment you need a wireless laser printer, the price complete goes insane. Made me think, there must be a simple way to get to share one printer across the network in such a way that I can place it anywhere and print from any machine. I personally have the Samsung ML-1666 Laser printer.

The tried and cheap Asus Routers with a USB port come to the rescue. Some of them allow you to share printers with a default firmware they ship with, but the default firmware does not allow you to use the router as a client to my wireless network.


Want your own website ? Take a look at Terabyte Websites. They take care of building, hosting and maintaining your website.

So Asus WL-520GU it is for Rs 2000 as it fulfills all our needs and is really cheap !!!



Getting the router ready for OpenWRT: 

1. Boot into linux on the PC (LiveCD will work well), typically Ubuntu. Connect the PC network cable to the lan port. Switch OFF the router.

2. Run the following commands (substitute the XX:XX with your router's MAC ID which is printed on the box):

ifconfig eth0 192.168.1.2 netmask 255.255.255.0

arp -s 192.168.1.1 xx:xx:xx:xx:xx:xx

3. Now run the tftp command and enter the commands under it one by one,

tftp 192.168.1.1
binary
rexmt 1
timeout 60
trace
put openwrt-brcm47xx-squashfs.trx

Wait three minutes and then hard reboot, then go to 192.168.1.1, use default user "root" and no password to get to the web interface. Set a default password for the user.

Now do a telnet 192.168.1.1 and login using user "root" and the password you just set.

Run the following commands in the telnet session:

opkg update
opkg install kmod-usb2 kmod-usb-core kmod-usb-storage kmod-usb-storage-extras block-hotplug block-mount hotplug2 kmod-usb-ohci kmod-usb-printer

All of them should succeed !!!

Configuring the OpenWRT router 

Fire up a web browser and go to 192.168.1.1 for the web interface, move into Administration mode and fix the following:


Step 1 : Go to Luci Overview page and add luci-app-p910nd and p910nd packages to the system


Reboot the router. When it comes up and you login to the web interface again, make sure you go to Services/Initscripts in the web and enable the p910 service and reboot again.


Step 2: You should be able to see the p910nd link in the services page. Enable it.




Step 3: Now is the tricky part, make the Router works as a wireless client for your existing network by changing the settings below to suit your existing network.





 Note the fact that the network interface is set to a WAN instead of a LAN, so the router acts as a client to your wireless rather than becoming a access point itself.

Step 4: Set your WAN screen in the following way :


Step 5 : Now open up the firewall on the router to accept print requests from the WAN side:


Save and apply all the changes above and after a few minutes, physically reboot (power off and then on) the machine.



The moment of truth : Switch off the router, take off the network cable connecting the computer to the router and boot it up. Configure your main network modem/wireless router to assign a static ip address to this router (so that you can always print to the same IP). Again reboot the router and wait till the wireless lights come up. 

You should now be able to access the wireless router's web page from the computer again. Get to a telnet session for the IP that is assigned to the router :

Type "dmesg". You should see a boatload of stuff on the screen, ignore all ! Now connect the printer to the usb port on the router and switch on the printer. Wait a few seconds. Type "dmesg" again. You should see messages in the end saying the device saw and configured the USB printer.

usb 1-1: new full speed USB device using ohci_hcd and address 2
usb 1-1: configuration #1 chosen from 1 choice
usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x03F0 pid 0x1D04

Ensure that the p910d process is running using the command "ps -aef". The output should have:

/usr/sbin/p9100d -b -f /dev/lp0 0

That is it from the router side. Move the router to where the printer is at any corner of the house, connect everything and start it all up



On the windows machine:

Add a new printer, choose Local Printer. Choose to create a new Standard TCP/IP Port. Set the IP address to the IP of the route, Protocol should be RAW, Port number 9100. Install the correct drivers for the printer in Windows (This is very important).

Make sure you create a new printer and not change a existing one.



Fire a test page and the page should print out of the wireless connected printer :-)


Notes : 

1. I have tested with Samsung Laser and HP printers, they seem to work well. But that is no surety that your existing printer will always work. Do a little reading to see if anyone has had success with your printer and OpenWRT/DD-wrt before you go this route.


2. All in one printers are a different ball game. I do not recommend them and I do not use them. So read up on your own if you want support for your scanner in the All-in-one. The printer by itself should work though.

3. Samsung and HP have released nice drivers and applications for Android that allows you to print anything from the Android phone or tablet. I just installed the Samsung application for Android, setup my network printer and can now print seamlessly from the tablet over the network. This makes it a complete solution.

Jun 11, 2011

The quest for the near perfect HTPC continues...

My quest for a perfect (or as close to perfect as possible !) HTPC has made me change my HTPC setup multiple times over the last few years to find the right balance between power consumption, noise, size and flawless 1080p movie play. After the last upgrade this month, I think I have the almost perfect HTPC player.

CPU/Motherboard : AMD Fusion E350

The AMD E3509 is the perfect CPU and motherboard for media playback. A 1.6ghz dual core processor combined with the AMD Radeon HD 6300 on-board graphics takes care of any media that you throw at it, more importantly has on board component and optical outputs for Audio and HDMI that is capable of doing Video+Audio.

It is important to note that XBMC live works by default with a Geforce based solution because of native geforce drivers, butI prefer the Windows 7 combination with DVXA2. The second option works perfectly with both Radeon and Geforce solutions.

The best part of the solution is that the whole platform takes a measly 19watts of power. It is really unbelievable that such a powerful HTPC can work off just 19watts for the CPU and motherboard.

I got the MSI E350 board, available everywhere for less than 7k :

Msi E350IA-E45--AMD Fusion Platform | eBay

Note that when I got the motherboard from the shop, the fan was running really fast and making more noise that I liked. After a BIOS update to the latest on the MSI speed, the fan is hardly heard and is really silent now.

RAM : 2gb or 4gb DDR3

DDR3 is dead cheap now and it makes a lot of sense to get 4gb of memory to run Windows 7 comfortably.

The cheapest ram I got, 1600 for two sticks of 2gb each : EVM Strontium 2GB DDR3 Desktop RAM Memory Module | eBay


Cabinet :

Choice 1 : CFI Cube A8989

This is a beautiful cabinet that is really small and absolutely cute. It comes with a 150w PSU and is perfect as a HTPC if you intend to use a large (3.5") hard drive.

If you want some specific details of the cabinet, look at this site:
CFI Cube Casing for Intel Atom | Surfnux's Weblog

Choice 2: PANACHE T3311 : Panache

This is the one I choose. It is a really small cabinet and is very cramped, but works very well if you have a external hard drive to store your movies and only need a 2.5" small drive to boot Windows 7 and XBMC. More importantly, it comes with a DC power convertor in the small chassis that provides power via a laptop like adaptor. So no fans and zero noise from the PSU.

Hard drive : Determined by the cabinet choice above !

I went for a Kingston 30gb SSD for Rs 3300 from Primeabgb. Loads Windows and XBMC in less then 10 seconds and browsing movies is instant. This ia a perfect choice with the Panache. If you went for the CFI cabinet, you can get a 2tb internal hard drive for cheap and add a 30gb partition for Windows 7 and XBMC.

Getting it all together

Assemble the above, install Windows 7, the ATI drivers and XBMC 10.1. Start XBMC and enable DVXA2 in the system settings and you will find that every movie plays flawlessly over HDMI and CPU consumption never exceeds 15%.

Add a good media remote control for about Rs 1000 and it all works flawlessly.

It is now almost perfect HTPC solution :-)

Jun 7, 2011

A 110v surge protector instead of isolation transformers ?

I have been reading up a lot on step down transformers since I intend to get a Pioneer receiver from the US and am looking to see how to get a good deal.

Almost every thread on this in various forums has details on how to get the best transformer and more importantly, to get isolation type transformers. Comments like these abound : You need to get "Isolation Type" Step down Transformers. Now the reason given for getting a isolation type transformer is that the normal transformers can go bad and start supplying 240v directly instead of converting the voltage, thus bringing down the entire system.

Im thinking, how about getting a normal good brand (Maxine ?) transformer of 1kw/Rs 1k and take the output of the transformer into a US surge protector ($10) and then pass the output of the surge protector to the AV receiver. A good US surge protector comes with ample guarantees of coping with high voltages. So if the cheapo transformer does go bad and supplies more than 120v, the surge protector will kick in and protect the attached device.

Obviously, I could be missing something fundamental here in this line is thinking since folks spend 3-5k on isolation transformers. So Gurus, what am I missing here technically ? Can a surge protector NOT work with a transformer ? Any holes in the theory ?

Want your own website ? Take a look at Terabyte Websites. They take care of building, hosting and maintaining your website.

Apr 8, 2011

AMD motherboard stability issues with DDR3 (XMP based memory)

Im building a new computer with the following components:

Gigabyte GA-880GM-UD2H motherboard
AMD Phenom II x6 1055T processor
Gskil F3-10666CL9D-8GBXL (2x4gb)
Antec 650w PSU
HIS 5670 Video Card

I wanted a AMD 880 board and while picking the RAM, I noticed that some of the RAM were marked as specifically designed For 2nd Generation Intel® Core™ processor. It kind of put me off, but I kept wondering why it should make any difference. I assumed it is a Intel muscle at work and moved on. In short, since AMD cannot take more then 1333mhz DDR3, I stuck to the Gskill as it was advertized to run 1333mhz at 1.5v.

Assembled the comp, everything is stock, brand new, basically nothing is OC'ed. RAM settings are 9-9-9-24, 2T DRAM Freq 669.6 mhz and CPU Freq 2008.9 mhz. I put the system together, it booted first time no problem. I installed windows and then I started getting random BSOD's. The BSOD's indicated memory issues, so I ran Memtest for hours on both sticks, then each stick and there were zero errors. The memory always passed on any test I threw at it. But Windows would randomly freeze, the ATI drivers would restart randomly, basically it was hell !!!

Temps were fine for the entire time, and since I was not OC'ing anything, it did not seem like a issue. Everything in the BIOS was left untouched, voltage was stock at 1.50v and timings were stock at 9-9-9-24. I swapped the sticks between DIMM's, reseated them, etc - nothing seemed to work.

I then ran Prime35 and it would fail in a matter of seconds with a warning that there are rounding off errors. Folks on the net say that this means that the CPU or RAM is malfunctioning, which leads to data corruption and hense rounding off errors.

Frustrated, I started reading more stories on the net, then I noticed something fishy. Few other people had similar issues with AMD and DDR3 memory with support for Intel XMP (Extreme Memory Profile) and almost all of them RMA'ed the memory and got different brands. A little research pointed out that XMP allows the DDR3 and the motherboard to exchange information on what speed was necessary and how much voltage was required. On a AMD board, this information exchange was lost.

So I bumped up the voltage on the RAM manually by 0.05v and the Bios showed that the memory was now getting 1.65v. Rebooted, reinstalled and bingo, the system is now as Stable as stable can be. The Ram heats up a little, so I needed another fan blowing air on the sticks, but otherwise everything works beautifully. Prime35 ran for hours and no errors.

Moral of the story, if you buy DDR3 meant for Intel, it means that the sticks use XMP. It also means that AMD boards might not necessarily provide it the correct voltage to run at the rated speeds. In my case, GSkill claims a 1333mhz at 1.5v, but the sticks require 1.65v to be stable at that speed. So do not leave the Bios voltage at default and play around a little if you have stability issues.

Hope this helps someone facing similar issues :-)

Jan 27, 2011

Two short stories with a great moral...

The Frogs

A farmer came into town and asked the owner of a restaurant if he could use a million frog legs. The restaurant owner was shocked and asked the man where he could get so many frog legs! The farmer replied, "There is a pond near my house that is full of frogs - millions of them. They all croak all night long and they are about to make me crazy!" So the restaurant owner and the farmer made an agreement that the farmer would deliver frogs to the restaurant, five hundred at a time for the next several weeks.

The first week, the farmer returned to the restaurant looking rather sheepish, with two scrawny little frogs. The restaurant owner said, "Well... where are all the frogs?" The farmer said, "I was mistaken. There were only these two frogs in the pond. But they sure were making a lot of noise!"

Moral : Next time you hear somebody criticizing or making fun of you, remember, it's probably just a couple of noisy frogs. Also remember that problems always seem bigger in the dark. Have you ever lain in your bed at night worrying about things which seem almost overwhelming like a million frogs croaking? Chances are pretty good that when the morning comes, and you take a closer look, you'll wonder what all the fuss was about.


The Pretty Lady

Once upon a time a big monk and a little monk were traveling together. They came to the bank of a river and found the bridge was damaged. They had to wade across the river. There was a pretty lady who was stuck at the damaged bridge and couldn't cross the river. The big monk offered to carry her across the river on his back. The lady accepted. The little monk was shocked by the move of the big monk. "How can big brother carry a lady when we are supposed to avoid all intimacy with females?" thought the little monk. But he kept quiet. The big monk carried the lady across the river and the small monk followed unhappily. When they crossed the river, the big monk let the lady down and they parted ways with her.

All along the way for several miles, the little monk was very unhappy with the act of the big monk. He was making up all kinds of accusations about big monk in his own head. This got him madder and madder. But he still kept quiet. And the big monk had no indication to explain his situation. Finally, at a rest point many hours later, the little monk could not stand it any further; he burst out angrily at the big monk. "How can you claim yourself a devout monk, when you seize the first opportunity to touch a female, especially when she is very pretty? All your teachings to me make you a big hypocrite.

The big monk looked surprised and said, "I had put down the pretty lady at the river bank many hours ago, how come you are still carrying her along?"

Moral : This very old Chinese Zen story reflects the thinking of many people today. We encounter many unpleasant things in our life, they irritate us and they make us angry. Sometimes, they cause us a lot of hurt, sometimes they cause us to be bitter or jealous. But like the little monk, we are not willing to let them go away. We keep on carrying the baggage with us. We let them keep on coming back to hurt us, make us angry, make us bitter and cause us a lot of agony. Why? Simply because we are not willing to put it down or let go of the baggage.

We should let go of the incident soon after crossing the river, that is after the unpleasant event is over. There is no need to be further hurt by the unpleasant event after it is over.

Jan 25, 2011

Step by Step guide to setting up Buffalo router into a torrent downloader & NAS box

I have been using the Linksys 610N as a torrent downloader plus wireless router for the past year and while I was happy with the router, there are a few things that were bugging me. One was the NAS speeds to copy the downloaded torrents to my PC. I would hardly get 3mbps. I have also tried the Asus W500g and that was also a broadcom chipset and it was more limited than the Linksys.

So I decided that I would give a try for the Atheros wireless chipset. I shortlisted and got the Buffalo WZR-HP-G300NH router for INR 5k. It is a sleek black router with nice antenna's, fantastic wireless range, gigabit ports, a 400MHz processor, 32MB flash, 64MB RAM and a USB port.

The biggest stumbling block with the Atheros chipset was the fact that DD-WRT had limited support for packages on this chipset. The reason being that the Atheros CPU in the Buffalo router is MIPS while the Broadcom routers like Linksys 610N are MIPSEL. In laymans terms, it means the popular optware packages in DD-WRT compiled for broadcom will not work on this router. I installed dd-wrt and the openwrt packages using a lot of hacks documented on the web and most things did work. Then I started discovering issues, the primary one being there is no large file support in the firmware, so any downloaded files over 2gb would not even be visible on the Samba share.

This left me with the last option, install OpenWRT on the router. Information on OpenWRT is sadly less than for DD-WRT, there are lots of scattered information all over the net, but no consolidated place. Anyways, once I finished the setup, I was pleasantly surprised by the performance of NAS and the wireless ! I easily get over 7mbps to read files off the NAS connected to the WZR-HP-G300NH and the wireless range is fantastic. It also seems to draw less power than the Linksys (3watts as compared to 7watts for the Linksys).

Since I struggled for over a week to get everything working, I decided to document the procedure. Here are the exact steps to setup and configure the Buffalo WZR-HP-G300NH with OpenWRT to act as a wireless router, NAS and torrent downloader.


Remember a few ground rules.

1. Rule one, make sure that all the features of the router works in its default firmware before you move further. If there is a issue with the hardware, you do not want to find out after you have voided the warranty.

2. On the warranty front, OpenWRT is not a supported firmware for the Buffalo, so you might need to move back to the official firmware if there is ever a need to open a warrarty request. Do not blame me if you end up messing everything and cannot revert for some reason.

3. The router is virtually un-brickable as it has TFTP support in its bios. So you can almost always recover in any worse case scenario. Just make sure you have a Linux machine or LiveCD that can be used to update the firmware with TFTP.

4. Have a UPS connected to the router when upgrading. Power cut halfway through a upgrade is one way to void point 3. This router takes almost 5 minutes for a flash update and goes through multiple boots. Never do anything with the router till the red diagnostic LED stops flashing and the green LED come on solid. Get some popcorn if you do not have patience !!!

5. Make sure you have the Indian (B0 C0) or a non Japanese version of the router. This 4 digit code is printed on the router itself above the default SSID (unfortunately no way to figure this out unless you open the box. But if you are buying from a dealer in India, you will not get the Japanese version). If you have a Japanese version (A0 A1 or A0 A3), STOP right now and read this link , there are lots of complications with the Japanese router upgrade.


Here goes:


1. Download the latest "buffalo_to_ddwrt_webflash-MULTI.bin"

Pick on the latest date in the ftp link, move to the buffalo_wzr-hp-g300nh folder to get your file.

ftp://dd-wrt.com/others/eko/BrainSlayer-V24-preSP2/

I particularly used the file from this link for my work.

Note : There is a easier way to directly move to OpenWRT using the TFTP method as described in the last section, but I will use the easy method, even if it means three firmware flashes !!!


2. Connect to 192.168.11.1 with your browser and go to the firmware update page.


Choose the file you downloaded in step 1 and wait till the router is flashed fully.

Note : I will be referencing 192.168.11.1 as the default router page. Sometime the default page could be 192.168.1.1. One of them will always work.


3. After the reboot, if you again go to the router homepage via your browser, you should now see the DD-WRT webpage.

Change the admin password so that you can use ssh and login using the same password you just set.


4. Login to the router via ssh (Can use putty.exe)

Run these commands :
cd /tmp
wget http://downloads.openwrt.org/backfire/10.03.1-rc4/ar71xx/openwrt-ar71xx-wzr-hp-g300nh-jffs2-sysupgrade.bin
mtd -r write openwrt-ar71xx-wzr-hp-g300nh-jffs2-sysupgrade.bin linux
Note : As of now, 10.03.1-rc4 is the latest, always go for the latest version you find.

Wait for a full 6-9 minutes before you do anything. When the router comes up again, you should have OpenWRT running.


5. Run the following commands one by one to install all the USB and file system drives :

opkg update
Make sure this command above completes. If there is a issue with your network, the update will fail. Fix this before you move ahead.
opkg install kmod-fs-btrfs kmod-fs-ext2 kmod-fs-ext3 kmod-fs-ext4 kmod-fs-isofs kmod-fs-reiserfs kmod-fs-vfat kmod-fs-xfs

opkg install kmod-nls-cp1250 kmod-nls-cp1251 kmod-nls-cp437 kmod-nls-cp775 kmod-nls-cp850 kmod-nls-cp852 kmod-nls-cp866 kmod-nls-iso8859-1 kmod-nls-iso8859-13 kmod-nls-iso8859-15 kmod-nls-iso8859-2 kmod-nls-koi8r kmod-nls-utf8

opkg install kmod-usb2 kmod-usb-storage kmod-usb-storage-extras block-hotplug block-mount hotplug2

6. Connect a USB drive to the router and reboot.


Im going to assume that there is a external drive connected with a single partition formatted to ext3. If you need more partitions or a different file system, you probably know what you are doing, so tweak the commands !!!


7. The next set of commands are a safety net.

If you ever bootup without the USB drive connected, you might end up writing to the router flash and mess things, so the command below will make sure you cannot write anything to the share if the drive is not mounted.
mkdir /mnt/download -p
touch /mnt/download/WARNING_USB_DRIVE_IS_NOT_MOUNTED
chmod 444 /mnt/download -R

8. Run the following commands to setup the first partition to be mounted automatically :
uci set fstab.@mount[0].target=/mnt/download
uci set fstab.@mount[0].device=/dev/sda1
uci set fstab.@mount[0].fstype=auto
uci set fstab.@mount[0].enabled=1
uci set fstab.@mount[0].options=rw,sync,noatime,nodiratime
uci commit fstab
Reboot the router


9. Run the following commands to install samba3:
cd /mnt
chmod 777 download/
cd download/
mkdir -p /mnt/download/downloads
mkdir -p /mnt/download/torrents
chmod 777 downloads torrents

opkg update
opkg install samba3 luci-app-samba

uci set samba.@samba[0].name=Buffalo
uci set samba.@samba[0].description=Buffalo
uci set samba.@samba[0].workgroup=WORKGROUP
uci set samba.@sambashare[0]=sambashare
uci set samba.@sambashare[0].guest_ok=yes
uci set samba.@sambashare[0].path=/mnt/download/downloads
uci set samba.@sambashare[0].name=download
uci commit samba

10. Samba3 is now installed. Time to configure it.

Edit the file : /etc/samba/smb.conf.template

Add the lines :
force user = root
writeable = Yes
create mask = 0777
directory mask = 0777
inherit permissions = Yes
Remove the line:
invalid users = root

11. Run the command to start samba :

/etc/init.d/samba restart

At this point, use explorer to goto \\192.168.11.1 to make sure the samba share is accessible and writable.


12. Time to install transmission for the torrent downloads.

Run the following commands :

opkg install transmission-web
transmission-daemon -g /mnt/download/torrents
killall transmission-daemon
cd /mnt/download/torrents
cp settings.json settings.json.copy

13. Time to configure transmission startup :

Replace the contents of the file /etc/init.d/transmission with the text below :

#!/bin/sh /etc/rc.common

START=99

start(){
cp /mnt/download/torrents/settings.json.copy /mnt/download/torrents/settings.json
transmission-daemon -g /mnt/download/torrents
}

stop(){
killall transmission-daemon
}

14. Edit the file /mnt/download/torrents/settings.json.copy and replace all the content in the file with these lines below :

{
"bind-address-ipv4": "0.0.0.0",
"bind-address-ipv6": "::",
"blocklist-enabled": false,
"blocklist-url": "http://www.example.com/blocklist",
"cache-size-mb": 2,
"dht-enabled": true,
"download-dir": "/mnt/download/downloads",
"encryption": 1,
"incomplete-dir": "/mnt/download/incomplete-torrents",
"incomplete-dir-enabled": false,
"lazy-bitfield-enabled": true,
"lpd-enabled": false,
"message-level": 2,
"open-file-limit": 32,
"peer-limit-global": 240,
"peer-limit-per-torrent": 60,
"peer-port": 55555,
"peer-port-random-high": 65535,
"peer-port-random-low": 49152,
"peer-port-random-on-start": false,
"peer-socket-tos": 0,
"pex-enabled": true,
"port-forwarding-enabled": true,
"preallocation": 1,
"ratio-limit": 2,
"ratio-limit-enabled": true,
"rename-partial-files": true,
"rpc-authentication-required": false,
"rpc-bind-address": "0.0.0.0",
"rpc-enabled": true,
"rpc-password": "{414db619f34798e4204bce201b584670afd2795ax7vJCOc. ",
"rpc-port": 9091,
"rpc-username": "",
"rpc-whitelist": "*",
"rpc-whitelist-enabled": true,
"speed-limit-down": 1000,
"speed-limit-down-enabled": true,
"speed-limit-up": 100,
"speed-limit-up-enabled": true,
"start-added-torrents": true,
"trash-original-torrent-files": false,
"umask": 0,
"upload-slots-per-torrent": 14
}
If you know what you are doing, feel free to change any of the values above to change the behavior of your torrent downloader.


15. Run the command below to make transmission auto start with the router :

cd /etc/init.d; chmod +x transmission; ./transmission enable

16. Increase the life of the hard drive by making it sleep after 5 minutes of inactivity :

opkg update
opkg install hd-idle luci-app-hd-idle
uci set hd-idle.@hd-idle[0]=hd-idle
uci set hd-idle.@hd-idle[0].disk=sda
uci set hd-idle.@hd-idle[0].idle_time_unit=minutes
uci set hd-idle.@hd-idle[0].idle_time_interval=5
uci set hd-idle.@hd-idle[0].enabled=1
uci commit

opkg install of the luci component might return a few errors, just ignore them.

16. Reboot the router and browse to : http://192.168.11.1:9091

You should see the transmission webpage from where you can add and control all torrent downloads.


That is about it. Add torrents, let the router download all night, then use samba to copy the downloaded file to your machine !!!

Have fun downloading and NAS'ing







If you mess up with the steps and your router stops responding : :

1. Boot into linux on the PC (LiveCD will work well), typically Ubuntu 10.10. Connect the PC network cable to the lan port closest to the blue WAN port. Switch OFF the router.

2. Run the following commands (substitute the XX:XX with your router's MAC ID which is printed on the box):

ifconfig eth0 192.168.11.2 netmask 255.255.255.0

arp -s 192.168.11.1 xx:xx:xx:xx:xx:xx

3. Now run the tftp command and enter the commands under it one by one,

tftp 192.168.11.1
binary
rexmt 1
timeout 60
trace
put openwrt-ar71xx-wzr-hp-g300nh-jffs2-tftp.bin

4. Now turn on the power to the router even as the command above is running.

The TFTP command would timeout a few times and will start the process as soon as the router is turned on. Wait for a full 10 minutes after the tftp command returns (yes, it takes that long !) and you should be back up and running.

Dec 22, 2010

Full guide to build a cheap and powerful HTPC !

I checked that there are quite a few threads on building HTPC's, but what prompted me to write a new one is because there are quite a few changes from a few months ago in the HTPC world, specifically with XBMC. So what has changed now ?

Hardware acceleration has been added in Windows 7 via DXVA2 in XBMC 10.0 which released in Dec 2010. What this effectively means is that if you use a supported graphics card, XBMC will offload all the video rendering to the card (Remember that this option is available only in Windows Vista and Windows 7, not in Windows XP). You will see the effect this small change has on the choice of hardware in your HTPC.

First things first, the hardware list. I will categorize a few items with a *Splurge*, which means you can blow up the money on them if you are really interested in reducing the noise to a minimum or looks to the maximum in the machine :

1. CPU : When I used to build HTPC's a few months ago, I used to go with a decent CPU and motherboard, specifically a Intel Pentium Dual core E5300 to E5700 and a good mini-itx motherboard with inbuilt graphics support. This used to result in a system that is capable of handling almost every movie I threw at it, save for movies encoded with extravagantly high bitrates.

As of today, the CPU has lesser role in the HTPC. so you can reuse any old cpu that you have and it will work great. Im currently reusing a old Athlon X2 3600+ and it works just fantastic.

In short, if you are setting up a new system, get a Pentium Dual core E5700 for Rs 3000. Else reuse any decent CPU from the last 5 years.

2. Motherboard : Trust me, just go and get the most basic and cheapest micro-atx motherboard that you can lay your hands on. Just make sure it matches the socket for the CPU that you purchased. The ASUS M2N68-AM is a simple choice for about Rs 2000 if you are going the AMD way and the Intel G31/41 motherboards are similarly priced.

The choice of the board will also depend of whether you have any old DDR2 memory sticks lying around. If you have even a single 1gb DDR2 stick with you, go for a DDR2 board. Else stick your neck out and go for DDR3. Im reusing a old Asus AM2 motherboard that was lying around as I had a extra stick of 2gb DDR2 with me.

*Splurge* : If you have the moolah to blow up, you can get a mini-itx motherboard from the US, or if you are plain lucky, you might get it in India. Mini-itx boards are definitely better looking when assembled in a small case, but the boards cost upwards of 5k.

Cabinet : The big question with very few answers in India. The cabinet is what brings in the eye candy from your friends when you showoff, it does not matter how much you blew up on the components inside the box, the cabinet needs to look good. Unless you want to buy a cheapo cabinet from iball, I would recommend three choices:

Choice 1 : Cooler Master Elite 360

A beautiful cabinet that has all the quality you need and has a horizontal layout so that you can keep it near your receiver. One of the best things about this cabinet is that the PSU sits in the front and blows air out from the front. So if you have woodwork done and the cabinet sits in a closed enclosure, this will allow the air to come out from the front. Priced between 2k-3k on ebay.

Choice 2 : Silverstone SG02B (My personal preference)

PrimeABGB is currently running a great offer till new year where you get a Silverstone 500w PSU free with the Silverstone SG02B cabinet. The cabinet itself costs 4.5k otherwise and is a compact one that can take Mini/Micro motherboards. Looks good and is a Silverstone, what more do I say.

Choice 3 : CFI Cube

If you have already blown money in getting a Mini-itx case, this cabinet will work well for you as it only takes mini-itx boards. Comes with a inbuilt 150w PS.

PSU : Any Basic PSU of 250w will do as the machine is not a power guzzler. On the other hand, as most experienced folks in TE will tell you, this is one component where you should gladly put in a little more money and get peace of mind.

*Splurge* : Get a good PSU with a 120mm fan. This will reduce the PSU noise to a bare minimum. I personally got a Corsair CX400 for 3k.

But you will do equally well with either of FSP Saga II 350W or Gigabyte 400w.

CPU cooler : Since the CPU will not be stressed much, you can tweak the bios to run the fan at the lowest necessary speed and save on money.

*Splurge* : Get the Cooler Master Vortex Plus CPU cooler. It is a low height CPU cooler for Intel and AMD and works cool and quiet with a 92mm fan, meant specifically for building HTPC. You cannot just hear anything when the machine is idling. Available locally for Rs 1700.

Video Card : I definitely do not want to get into a ATI versus NVidia war here, but we cannot go much wrong with either here. The Linux support is better for NVidia, but for the DXVA2 support that we need, Radeon works equally well.

My personal preference is the Radeon HD5450 passive cooled card. Passive cooler, great technology and good support in XBMC. Most importantly, it has support for 7.1 Bitrate Audio. Effectively means that you can pass pristine Audio via the HDMI to your receiver and the video to the TV from the receiver. So Dolby TrueHD and DTS MasterHD over HDMI: a necessary addition for serious Home Theatre enthusiasts.

I picked up the HIS HD5450 Silence for 2.9k shipped. Comes with extra brackets for small cases.

Audio :If you do not want to use the HDMI out for audio, or if you have a older receiver that can only take optical output, you can add a Turtle beach Micro II USB adaptor for unprocessed sound via optical output. Costs about Rs 1500 in India via Global ebay. The reason Im suggesting the USB adaptor rather than a full fledged PCI card is because the PCI card will use up a slot in the machine, leading to less airflow.

If you want pristine 7.1 bitstream via optical output, I would also suggest the Turtle Beach Montego 7.1 Channels 24-bit 96KHz PCI Interface Sound Card. It is a awesome sound card. Available for Rs 3500 via global ebay. This card is supported out of the box in XBMC.

Hard drive : You want a cool and fast hard drive. Two choices based on how your media is available for viewing. If you already have a NAS server hosting your movies, get a cheap and small hard drive, preferably WD green or Blue. If your HTPC will also host your movies, get a WD Greeen 2tb drive and use the first 20gb for XBMC and the rest to store your movies.

*Splurge* : Get a Super talent 16gb SSD card from Global ebay for 3k. Or if you want to splurge more, get a OCZ 40gb Vertex 2 SSD for 5.5k with local warranty. And the XBMC box will boot up crazy fast, will run cool and zero noise !

DVD drive : Just pick any of the LG or Samsung DVD writers for 1k. This will become your default DVD player. Liteon drives are great, but they make a little more noise than I would like on a media center.

*Splurge* : I have personally not used a Blu-ray drive, but I do not see why they will not work. If you have the moolah, get a Blu-ray reader for 6k !!! It will work full fledged as a blu-ray player as XBMC gets better.

Media Remote : You need a simple remote control to sit on the couch and control the movie. I would recommend the USB IR Media Remote Controller for PC. It works very well on XBMC without any configuration and is cheap.

DealExtreme: Universal USB IR Media Remote Controller

Also, I personally wanted to use my existing Logitech Harmony remote with this setup. The code to use the Logitech Harmony with the above USB IR adaptor is Chinavasion CVSB-983 ! Works flawlessly without any changes.

*Splurge* : If you want some geek factor, get the Lenovo Multimedia Remote with Keyboard for $35

Its a unique combination and works great with XBMC. Only downside, no backlight when you are sitting in pitch darkness and want to press a key.

And that is all you need !!!

Assemble the stuff, install Windows 7, video drivers and download and install XBMC 10.0. Once XBMC is installed, the key is to make sure that you enable DXVA2 in XBMC.

If you need more info on this, go to the official link.
How To: Enable Hardware Accelerated Decoding via DXVA2 in XBMC for Windows - XBMC

And that is it, connect the Video card via HDMI to your HD capable TV and enjoy the movies via XBMC. If all goes well, the cool and quiet machine you just assembled should be purring along showing a CPU usage of less then 5% to render the most complicated of movies and pass pristine audio to your receiver.

Some of you might have already seen the famous "killa sampla" scene which wrecks havox when rendered by any CPU without hardware rendering support (Including my AMD X6). Well, XBMC used to suffer and shudder when it would try to render this video, but with DVXA support, it plays flawlessly on my old Athlon X2.

Download the full video, but check it out in 1080p in Youtube !

YouTube - Bird 42 MBit ABR + 1 5 MBit

I personally built my new HTPC using a old AMD X2, a older AM2 motherboard and DDR2 memory. You can also put your old machine to good use and spend a little to assemble a great HTPC.