Saturday, December 12, 2009

Cheap Chinese GPS Freezing

I bought a cheap chinese GPS thinking I'd get some exposure to Windows CE 5. TomTom runs great but it freezes after a couple of minutes if not touched. Touch it, and it comes back to life. Not a safe thing to be doing while driving!

The timing seemed too predictable for it to be a hardware failure. So I investigated further and found forums talking about modifying the registry and eliminating idle power saving values. So I tried doing just that, using a copy of RegEdit.exe for WinCE. No luck. Then reading through more forums I learn the power settings control panel needs to be launched and the OK button pressed to make the settings take affect. And this needs to be done on every boot.

All the registry hacking can be scripted with MortScript (PNA version inside the zip). And MortScript can even run the control panel and push the OK button. Except the control panel title is in Chinese so how do I focus on this window? More forum searching I find it's possible to sleep for a second and then just focus on the active window. So tying this all together I just configure the Autorun.exe of MortScript to be my 'GPS Software', this runs Autorun.mscr (see below) in the same directory, which fixes power settings and launches the actual GPS software.

I wanted to get some WinCE exposure but I didn't realise I'd be hacking registries and learning a new scripting language on day one!

RegWriteString("HKLM", "\System\Explorer\Shell Folders", "My Documents", "\StorageCard")
RegWriteDWord("HKLM", "\System\CurrentControlSet\Control\Power\Timeouts", "BattUserIdle", "0")
RegWriteDWord("HKLM", "\System\CurrentControlSet\Control\Power\ActivityTimers\UserActivity", "Timeout", "0")
RegWriteDWord("HKLM", "\System\CurrentControlSet\Control\Power\Timeouts", "ACUserIdle", "0")
RegWriteDWord("HKLM", "\System\CurrentControlSet\Control\Power\Timeouts", "BattSystemIdle", "0")
RegWriteDWord("HKLM", "\System\CurrentControlSet\Control\Power\ActivityTimers\SystemActivity", "Timeout", "0")
RegWriteDWord("HKLM", "\System\CurrentControlSet\Control\Power\Timeouts", "ACSystemIdle", "0")
RegWriteDWord("HKLM", "\System\CurrentControlSet\Control\Power", "DisableGwesPowerOff", "0")
Run( "ctlpnl.exe", "cplmain.cpl,5,1" )
#WaitFor( "Power Properties", 5 )
#SendOK( "Power Properties" )
Sleep(1000)
WindowName = ActiveWindow()
WaitFor(WindowName, 3)
SendOK(WindowName)
RunWait ("\StorageCard\TomTom\TomTomNavigator.exe")

Thursday, September 17, 2009

Proprietary Airgo Wifi Driver with OpenWrt

I've got this pre-N Belkin access point (f5d8230-4) sitting around doing nothing. The stock firmware is below average in terms of capabilities. Fortunately the thing is Broadcom and runs Linux, which is fairly common. Belkin have even published the GPL stuff. Unfortunately the Airgo driver is a binary driver with no source. And it uses custom commands for wireless configuration instead of the standard Linux stuff.

So it turns out flashing the thing with OpenWrt is a piece of cake. But as expected the wifi doesn't work. Some fellow in the OpenWrt forums figured out that for the binary driver to load with Linux 2.4.30 all that is needed is a few missing semaphore methods patched back in. And sure with a bit of tomfoolery it is then possible to get the wifi up and running for a few seconds before the router crashes and reboots. After that it appears progress on the Airgo driver has been stagnant for nearly 3 years.

But then I wired in my 3.3v tty cable and got a stack trace of the rebooting router. With gdb I was able to identify there was an issue with a method call in linux/netfilter/nf_hook_slow. Seems the method was patched to incorporate ebtables from Linux 2.6. Eliminating the patch fixes the Airgo. Supposedly this wifi card is used in other routers and those routers are also Broadcom based. I was close to throwing this thing away but with OpenWrt I think I'll hold onto it.

update: It was more troublesome to get working with Kamikaze.

Thursday, June 18, 2009

iView RSS feed


iView RTMP streams are unmetred for some Australian ISPs. It would be nice to be able to save these RTMP streams automatically with software like Miro or iTunes. The program information is published as XML, which can be converted to an RSS feed easily enough. But to actually grab the RTMP stream requires special software.

My basic solution:
- Install Tomcat 5.5 and enable the cgi servlet, configure 'executable' to be 'bash'.
- Deploy Exist onto the Tomcat (and locked down the admin account).
- Copy an XQuery script into Exist that fetches the XML file and generates RSS.
- Wrap the rtmpdump binary with a cgi script that does the HTTP handling and grabs an iView authentication token.

End result: I can subscribe to iView RTMP streams in my video rss client of choice (ie Miro).



Kudos to some guys on Whirlpool for publishing scripts that do some CLI rtmpdumping of iView. The IP addresses they use work for me, but different ISPs probably need different IP addresses.

And the two scripts are iview.xql and iviewdump.cgi