Monday, September 21, 2009

Setting linux time from your Cell Phone

I have a Sony z610 cell hooked up to my wgt634u via usb running openwrt. As this box has no internet connection, on power failure it has the wrong date/time.

As the z610 has it's own battery I wish to set my system time based on the z610 clock.

the z610 has no support for NITZ or getting it's time from the cell provider, but this is ok.

the z610 appears as ttyACM0 and ttyACM1. I use smsd pointing at ttyACM1 , so my clock script is free to use ttyACM0.

As this is openwrt, and mipsel based, perl modules like are broken (termios.h etc.) so instead I use ser2net to share the port via tcp, then use perl sockets to access the serial port. This is actually deceptively easy. In perl I used Net::Telnet instead of sockets as this was even easier ! (I didn't get the expected results with sockets either).

Perl Script is easy
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10);
$t->open(Host => "localhost", Port => 2008);
@lines = $t->print("AT+CCLK?");
$line = $t->getline;
$line = $t->getline;
print $line;

to set system date with the shell and this script

date -s "20`perl /etc/ | grep CCLK | cut -b 9-25 |tr "," " " | tr "/" "-"`"

Thursday, September 3, 2009

watchdog script for openwrt

sometimes my 3g based openwrt system gets in a broken state, and as it is going to be remote, I need a watchdog script to reboot it if the internet connection is broken

This is a bash script that runs from boot


ping -4 -c 3 -I ppp0 | grep -v '0 packets received' | grep 'packets received' || (ping -4 -c 3 -I ppp0 | grep -v '0 packets received' | grep 'packets received' || reboot)

sleep 60

/bin/sh /etc/config/ >> /dev/null 2>&1 &


it is called from /etc/rc.d/S95done

Monday, July 27, 2009

windows 7 MCE

The other day I installed Windows 7 RC 64bit onto a spare PC , and plugged in my Dazzle/Pinnacle USB hybrid DTV stick (330e). Windows installed the drivers itself, and following the tuning menu in MCE, it found the Irish DVB-T ( DTT trial) broadcast.

When I tried to play it on the PC, it complained about codecs and wouldn't display.

I added my xbox360 as a media extender, and it played the channels fine via MCE ! ( the dvb-t here is h.264 ).

Next I added a PCI satellite card ( nova-s-plus ), pointing at astra 2D. It found channels such as BBC1 etc, and BBCHD. These all played fine on the 360 too !

Next I tried some divx and xvid via MCE (not via upnp or media player) , these were fine.

Lastly I tried some MPEG-TS files in HD , these were not fine. HDTVpump didn't make and difference. They would think they were playing, but I got no audio or video on my 360. They played fine on the PC.

I tried it on a macbookpro core duo, and they played on the 360 then. It appears MCE is doing some type of transcoding using mfpmp.exe , and the previous PC didn't have enough cpu/memory combo to make it work.

Interestingly , the files with DTS get converted on the fly by MCE to PCM and this is fine on the 360 , those with AC3 get passed through and the AC3 is sent out the 360 perfectly.

Hopefully I can test a FireDTV, as I need an external sat card for the macbook, and preferably and s2 card so I can get more HD channels.

Friday, July 17, 2009

MythTV and DVB-T settings

To receive the DVB-T stations in Ireland, I used Full Scan (Tuned) with these settings

Freq. 738000000
Band. 8Mhz
Inversion. Auto
Constellation QAM 64
LP Coderate 1/2
HP Coderate 2/3
Trans. Mode 8k
Guard Interval 1/32
Hierarchy None

Thursday, June 18, 2009

Baileys liquor Chocolate Chip and Cream desert

Simple and very very very yummy.

Prepare today for tomorrow

1-2 pks (14 biscuits approx but depends on size) of really good quality double chocolate chip cookies
100ml Baileys Cream Liqueur
250ml Cream, whipped
Chocolate Shavings, Drops to decorate, or Cadburys Flake broken up, or sprinkle of cocoa

Use a 9" spring form tin otherwise its tricky to remove the finished cake

Pour the Bailey into a bowl
One by one, dip or soak (depending on how strong you want it) the biscuits into the Baileys
Once each on is soaked place in the tin until you have a layer
Cover and spread evenly the freshly whipped cream
Repeat the dipping processing and make another layer on top of the cream
Cover and spread with cream again
Sprinkle with the chocolate shavings or drops or flake etc to decorate

Leave in the fridge overnight to allow the biscuits to absorb the cream mixture

Remove from fridge just before serving and enjoy !!!

(Increase quantities of Baileys and biscuits as required)

Serve as is without further cream as its quite heavy. Use a cake slice to serve as it is quite messy.

Enjoy !!

Friday, May 22, 2009

Wifi security in Ireland

I recently drove from Wexford to Dublin. I decided to scan for wireless networks on the way. Some interesting stats

I found 192 Access Points;

Security types were;

[Open] 38
[IBSS] 2
[WEP] 89

Of the 192 AP's, 128 were Eircom mac Addresses

Of this 128 , 15 had their SSID's non default (13 were netopia mac 00:0f:cc)

Of the remaining 113, 62 were wep, 7 open and 44 WPA/WPA2

Of this 113, 67 were netopia macs 00:0f:cc, the ones with extra easy to crack wep.

Of this 67, 5 were open and 1 was WPA/WPA2 and 61 were still WEP.

What this tells you is that nearly every one with a netopia that had bad wep, have not changed their setup. Eircom need to fix this.

Tuesday, May 19, 2009

openwrt + 3g + voip = success

Well putting a 3g modem into my wgt634u , with open wrt, connecting by ethernet a WRTP54G , then linking it to home via openvpn, to my SPA3102, works. Now I can place a call from a remote location, via voip/3g out my home phone line, which has unlimited local/national calls :-)

Not to get T.38 working, so that from a remote location my sky multiroom can dial to sky, presenting my home CLID to keep them happy. Right now the WRTP54G doesn't detect the modem calls or T.38, so it does it as a straight g771u call, the modems start to sync, sometimes lock and swap data, but always fail

Remote controlling House Temperature

I have one of these installed

Heatmiser PRT

but am thinking of changing to one that supports rs485 :-)

like this one


Heatmiser will give the protocol docs out, and it looks similar to resol vbus :-)

EDIT: they sent me the docs for V3 protocol which is the current shipping model

Friday, May 15, 2009

k850i and openwrt 8.09

the k850i should be with me next week, it should be usb ethernet, lets see does it break like the k800i did ....

n95 8gb with openwrt 8.09

This works with kmod-usb-acm and comes up as a serial port ttyACM0. it works fine, but seems to suffer from usb buffering, and doesn't get above 500k or 400k speeds. This is just like the e270 if you don't specify maxsize=4096 when loading usb-serial.

I give up with this as the e270 still wins.

k800i with openwrt 8.09

I was interested to see if the k800i would fair better with openwrt, because it presents itself as a usb ethernet, so I hoped I could use it to replace the e270 card, even though it only does 768k.

openwrt supports it via kmod-usb-net-cdc-ether , and configuring network for wan usb0 and dhcp, it worked.

After a short while ( <20 mins) it stopped, and udhcpc couldn't get an ip from it. no errors of any kind. the phone couldn't surf with it's own browser, and the internet icon had gone from the screen. So probably not reliable. a reboot of the phone and it's back working for > 12 hours now... lets see does it repeat, but I am very wary. I can't reboot the phone remotely, at least with the e270 a reboot of the wgt634u causes a reboot of the e270 (it's usb powered).

EDIT: spoke too soon, the phone needed a reboot again with openwrt giving 'NETDEV WATCHDOG: usb0:' errors

openwrt e270 with 8.09

so it appears to be more stable in 8.09, and may go several days before 'usb disconnect'. Interestingly, it now redetects it without reboot, but ppp0 is still active, and therefore it gets assigned USB1 instead of USB0, so networking would need to be reconfigured.

I added openvpn to the wgt634u, and setup tunnels , and this seams to help, so maybe it's a powersave thing that if there is no traffic the e270 3g modem tries to standby and causes the problems

I found that it was intermittent enough for me to live with a watchdog reboot script like this

ping -4 -c 3 -I ppp0 | grep -v '0 packets received' | grep 'packets received' || (ping -4 -c 3 -I ppp0 | grep -v '0 packets received' | grep 'packets received' || reboot)

Trying to code in C/C++

Well I didn't expect it to be simple, and it wasn't, but I have the bones of vbusdecode put together

Tuesday, May 5, 2009

Measureing Gas usage

So, now I need to complete the picture and measure my Natural gas usage (heating and hot water only, no cooking). My system is a potterton HE model, which modulates gas usage , so monitoring the board or burner LED won't work as gas flow is not a constant.

Unfortunately my Meter is outside of the house , on the garden wall, with the gas pipes routed under the path into the house. This means running wires is pretty much impossible. So I would have to do something wireless with batteries, maybe an IR sensor counting the meter turns. Either way, it's going to be expensive and not reliable.

So, I think I will ask my plumber how much he will charge to install a gas meter in the house, in line with the boiler. This is basically to be used as an expensive sensor. This one isn't too expensive, and has a pulsed output that can be read the same way my electricity pulses are measured

Time to ring my plumber, he needs to fix a radiator anyway

Sunday, April 12, 2009

sharing data feeds

I put my solar and other feeds onto pachube, looks like the site may have potential, especially if the support googles visualisation api in the future.

Though , googles powermeter will support solar and they will allow direct user feeds at some point.

I will stick with rrdcollect and google spreadsheets, this gives me local data without depending on the internet working, and also gives me nice external views.

Friday, April 10, 2009

Tuesday, April 7, 2009

New power meters with data feeds

These are pretty reasonably priced

And have a USB cable option, that sends the display information out as an xml string. Shouldn't be difficult to graph and no wiring required :-)

Wednesday, April 1, 2009

creating pac to auto config ipv6 proxy to access ipv4 sites

using polipo proxy to allow ipv6 only clients access ipv4 sites or other proxyable services, I created this pac file , so that browsers only need 'auto configuration' enabled. Works with chrome, firefox and IE , only tested in vista. The first function is a microsoft extension, and was required to get IE to work in vista. The other function is the default.

This pac file sends request that don't resolve to an ipv6 address to the proxy

function FindProxyForURLEx(url, host) {
if (shExpMatch(dnsResolveEx(host), "*:*"))
return "DIRECT";
} else {
return "PROXY myproxy:8123";

function FindProxyForURL(url, host) {
if (shExpMatch(dnsResolve(host), "*:*"))
return "DIRECT";
} else {
return "PROXY myproxy:8123";

Wednesday, January 14, 2009

Route66 Mini PND Stuck in mass storage mode

I got one of these and it managed to get it self stuck in Mass storage mode, support said it had to be sent off for repair :-(

I downloaded gsfinder.exe which is a file explorer for windows ce or mobile , went to route66 directory on mem card, renamed R66Navigate8.exe to backupfile.exe, copied gsfinder.exe into that folder and renamed it to R66Navigate8.exe

reboot, and you will be in gsfinder, navigate to flashdisk/shell and run FactoryReset.exe and voila, just delete gsfinder and rename R66Navigate8.exe back and reboot

load testing