A few things, mostly technical notes...

Tuesday, March 11, 2008

How NetGear Forum Saved me money.

I've two Linux PCs in my living room - among many roles, one is the myth backend, and the other is the F/E. The F/E is connected to my Samsung 32" LCD. They both are about 15m apart, and are "wired".

When I was installing the latter, I had the RJ45 cable in handy and decided just to use that cable. Of lately, I been toying with the idea of buying a USB Wireless adaptor, just for the heck of it.

I wanted to buy a NetGear USB adapter, which would have costed about $60.00.

Then I tumbled upon this post, in Netgear's Forum:

That saved me from blowing $60.00 something on NetGear USB adapter. Ah, the sweet feeling of not having to buy hardware which has no Linux support. (ndiswrapper, no thanks..!)

Suck it, NetGear...! As a buyer, I am glad I chose not to buy your crap, NetGear.

Saturday, March 08, 2008

Why one should not use globe7?

globe7 is a voip thingy for Linux.

Don't bother installing it, as they are yet to learn how to create a decent deb package which would not screw your linux system up.

Here's an example:

# dpkg -r globe7
(Reading database ... 124718 files and directories currently installed.)
Removing globe7 ...
dpkg - warning: while removing globe7, directory `/usr/local/share' not empty so not removed.
dpkg - warning: while removing globe7, directory `/usr/local' not empty so not removed.



Using Skype to call India

I like Skype - especially because Skype has Linux Clients, and they simply work, unlike Google Talk, Y messenger etc, on Linux. (In case you're interested to run Skype client on Linux, go for the latest Linux Beta Clients from this page)

But, what is preventing me from using Skype as my long distance/International Call Carrier?

Their rates, of course...!

Rates to India from Skype - 15.0 ¢ per minute
Rates to India from elsewhere - 6.2 ¢ per minute

Do the math...!

Skype rates:

Calling Card Rates:

Thursday, January 10, 2008

How to ensure Set-Top-Box (STB) is Powered On?


How to ensure Set-Top-Box (STB) is Powered On?

STB - in most cases, Set Top Boxes are the boxes the Cable/DishTV companies leave at your place with a remote control for you to flip channels. STBs are external, and in case of models like mine, there appeared to be no reliable method to ensure that it is powered on (Like in case of small power disruption. The computer would probably boot back up, but what about the dumb STB?. Read more about the uncertainity here in this thread. Or, here.)

I initially proposed something naive like this (alt link here) and went on to finalize this working script.

You will need ffmpeg and jp2a installed. On my Ubuntu 7.10, they were installed by running:

sudo apt-get install jp2a ffmpeg 

check_stb (link)

#! /bin/bash

# Authored by Evuraan_AT_gmail_DOT_com

# ABSOLUTELY NO WARRANTY, to the extent permitted by
# applicable law.

# Use at your own risk.

say="/usr/bin/logger -p info -t mythstb-check"
wakeup="/usr/local/bin/irsend SEND_ONCE blaster1 POWER"
info="/usr/local/bin/irsend SEND_ONCE blaster1 DISPLAY"

send_power_on() {
$say "`date` STB seems to be turned off, last count was $blank, attempting to Power it on" &
$wakeup 1>/dev/null 2>/dev/null || :
sleep 2

for i in `echo /tmp/$t*.jpeg`
if [ -s "$i" ]
#blank="`jp2a $i --invert --size=72x24 | sed -e 's/./& \n/g'|grep -c "M"`"
blank="`jp2a $i --invert --size=72x24 | sed 's/W/M/g' | sed -e 's/./& \n/g'|grep -c "M"`"
 rm -f "$i" 1>/dev/null 2>/dev/null || :
[ "$blank" -gt "$mark" ] && export POWERON="100"
[ "$blank" -le "$mark" ] && export POWEROFF="100"
if [ "$POWERON" -eq "100" -a "$POWEROFF" -ne "100" ]
# its off
# power is on, non blank frames
$say "`date` STB seems to be turned on, last count was $blank"


[ -f "$out" ] && rm -f "$out" 1>/dev/null >/dev/null || :

#ivtv-tune -c 3 -d "$pvr" 1>/dev/null 2>/dev/null &

cd /tmp
$info &

dd if="$pvr" of="$out" bs=64K count=2  1>/dev/null 2>/dev/null

if [ -s "$out" ]
ffmpeg -i $out -f image2 -vcodec mjpeg /tmp/$t%d.jpeg 1>/dev/null 2>/dev/null
[ -s "/tmp/${t}1.jpeg" ] && scan_images
$say "`date` Unable to query $pvr, as it seems to be in use."

purge_stuff &

The Idea:
The idea is pretty simple - read from your ivtv device using dd. ffmpeg then converts them into jpeg files (1 per frame). jp2a analyses each of those frames to check whether they're blank or not.

I placed this in my channel change script (example ), so mythtv ensures that the STB is powered on before changing channels. You can also cron it, but it is better to call this in the beginning of your channel change script, as that way, you have a higher chance of unhindered read access to $pvr.

This can be downloaded to your machine as:
wget http://evuraan.info/evuraan/check_stb.txt  -O /tmp/check_stb

To suite specific needs/situations, one may accordingly need to change the parameters pvr, mark and wakeup.

Feedbacks are welcome.

Tuesday, January 08, 2008

Living in Arverne NY, a bloggers review.

If you're considering living in Arverne (11692 NY) this review may be helpful.

Just don't. Just fucking don't.

Unless you work in Arverne itself, or are retired, or you work for Far Rockaway MTA, this is not the place to live.
Especially if you have to commute in Manhattan, you will have to either drive in, or depend on Public Transportation, aka MTA.

MTA subway A line comes this way, and is the longest route they have, with the oldest, dirtiest trains and slowest too.
Two express buses QM17 or QM16 and other local MTA routes does not make the commute any easier either. Reality is, MTA sucks ass.


Here's a better sounding analogy about living in Arverne - you live in the fucking boondocks, pay NY City taxes, and have a
two hour commute to the city, and on top of everything you pay the same for decent housing.

Labels: Living in Arverne, Commute from Arverne, Arverne to Manhattan.

Monday, January 07, 2008

How to use ATI REMOTE Wonder II Remote for MythTv Frontend?

How to use ATI REMOTE Wonder II Remote for MythTv Frontend?

Inspired by their wiki-page, I ended up buying ATI REMOTE WONDER II Remote for my new MythTv Front End system. Here's how I setup
this remote control using xmodmap.

Here's how it works: (1) Launch myth front end with a custom keymap. (2) When we finish and exit myth frontend, reset the keymap to
the normal (sane keymap)

Step 0: Disable gnome-screensaver

I added the following to root's crontab to prevent auto screen lock whenever I pressed the lock button:

* * * * * /usr/bin/killall gnome-screensaver 1>/dev/null 2>/dev/null || :

Step 1: Create default/sane keymap

Fire up a terminal window (xterm/gnome-terminal) and run:

xmodmap -pke > /somedir/sanekeys.txt

Step 2: Create a launcher for myth front end

Let us call it /usr/bin/wmyth. Here would be its content.

#! /bin/bash

/usr/bin/xmodmap /somedir/map.txt | /usr/bin/mythfrontend 2>/dev/null
/usr/bin/xmodmap /somedir/sanekeys.txt

Step 3: Create /somedir/map.txt

Place the following as /somedir/map.txt:

! power
keycode 222 = F1
! scan
keycode 229 = F2
! mute
keycode 160 = F3
! recall
keycode 133 = F4
! stop
keycode 232 = F5
! play
keycode 179 = p
! <<
keycode 152 = Q
! >>
keycode 233 = U
! vol+
keycode 176 = F10
! vol-
keycode 174 = F11
! options
keycode 41 = o
! options1
keycode 136 = o
! options2
keycode 56 = F8
! escape
keycode 232 = Escape
! pause
keycode 110 = p
! ff
keycode 102 = Right
! rew
keycode 100 = Left
! arippa
keycode 158 = Escape
! red
keycode 54 = d
! green
keycode 40 = i
keycode 119 = i
keycode 140 = w
! record
keycode 177 = z

Step 4: Launch wmyth, enjoy.

External Channel changer script which looks up channum against freqid

I had to use an external channel changer script as I moved to use the ir blaster of my Hauppauge PVR 150.   
Shortly thereafter I found that myth is calling the channel-changer script with some weird parameters. For instance, 
to change to channel 18, it would evoke the script with an argument of 34590 or so. (Now, try changing your STB  
to channel 34590, you will know how it was barfing.)

I am blaming my DB schema (2 years old). 

Anyways, here's the script that fixes this problem. Save this as /usr/local/bin/change-channel.sh, chmod it, and  
let mythtv-setup know. 

You can also wget this script:

wget http://evuraan.info/evuraan/change-channel.sh.txt -O /usr/local/bin/change-channel.sh

Lets cut the chase, here's the script:

#! /bin/bash

say="/usr/bin/logger -p info -t mythchannel"

flip_it() {
for digit in $(echo $score | sed -e 's/./& /g'); do
 irsend SEND_ONCE $REMOTE_NAME "$digit"
 $say "`date` coin is $coin, score is $score, digit is $digit" 
sleep 2

if [ -z "$coin" ]
 bb="`echo " mysql -u $user -p $pass -Ee 'select channum from channel where freqid="$coin" ' mythconverg"`" 
 [ ! -z "$bb" ] && score="`(echo "$bb")| sh|grep channum|awk {'print $2'}`"

if [ -z "$score" ]

exit $RET

Saturday, January 05, 2008

How to get to use the IR Transmitter of PVR 150 on Ubuntu Gutsy (7.10) ?

How to get to use the IR Transmitter of PVR 150 on Ubuntu Gutsy (7.10) ?

Many many thanks to this post (http://ubuntuforums.org/showthread.php?t=587732) and this too, http://www.blushingpenguin.com/mark/blog/?p=24, here's how to:

  1. Add to /etc/apt/sources.lst:
    deb     http://ppa.launchpad.net/superm1/ubuntu gutsy main restricted universe multiverse

  2. As root, run,
    # apt-get update

  3. New linux-ubuntu-modules should be available at this point, pull them down to your machine:

    # apt-get upgrade

  4. Modify /etc/lirc/hardware.conf to call *only* lirc_pvr150

    # sed -i 's/^MODULES/#MODULES/g' /etc/lirc/hardware.conf
    # echo MODULES="lirc_pvr150" >> /etc/lirc/hardware.conf

  5. Place Firmware in /lib/firmware

    # cd /lib/firmware; wget http://malayalam.homelinux.net/evuraan/haup-ir-blaster.bin


    # cd /lib/firmware; wget http://www.blushingpenguin.com/mark/lmilk/haup-ir-blaster.bin

  6. Reboot, dmesg should have these. GOOD LUCK..!

    # dmesg|grep pvr
    [   77.487264] lirc_pvr150: chip found with RX and TX
    [   77.631689] lirc_pvr150: firmware of size 302355 loaded
    [   77.631790] lirc_pvr150: 743 codesets loaded
    [   77.670058] lirc_pvr150: Hauppauge PVR-150 IR blaster: firmware version 1.3.

    At this point, you can go here to follow point 8 onwards, good luck..!


Creative Commons License
This work is licensed under a Creative Commons License.