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 :-)