Home
About Me!
Projects
Research
Links
Photo Gallery
Travel
Tech Blog
   


Jon's TechBlog

Welcome to my TechBlog where I post notes on my technical troubleshooting, experiments and projects.

OpenVPN on Android 2.2 Japanese Jellyfish RLS7

February 6th, 2011

I performed the following steps to install OpenVPN on a ZTE Blade (Orange San Francisco) with Android 2.2 Japanese Jellyfish RLS7 installed.

  1. Install the android SDK so you can use the (adb shell command)
  2. Navigate into the platform-tools directory in a terminal and run “./adb shell” (without the quotes)
  3. Remount the /system directory so you can write to it:
    su
    mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
    exit
  4. Create the /system/xbin/bb directory and the following symlinks for the route and ifconfig commands:
    mkdir /system/xbin/bb
    ln -s /system/xbin/busybox /system/xbin/bb/ifconfig
    ln -s /system/xbin/busybox /system/xbin/bb/route
  5. Use “OpenVPN Installer” from the Market to install OpenVPN.  Select /system/xbin for the location of the openVPN binary, select /system/xbin/bb for the location of the ifconfig and route commands (the other options did not work for me).
  6. Create an openvpn directory on your sdcard and place your openvpn configuration, certificate/keys in there.
  7. Install “OpenVPN Settings” form the Market and set the following in the advanced menu:
    - Load tun kernel module: yes
    - Load module using: insmod
    - Path to tun module: /system/lib/modules/2.6.32.9-perf/tun.ko
    - Path to configs: /sdcard/openvpn
    - Path to openvpn binary: /system/xbin/openvpn
    - Fix HTC Routes: no
  8. You can now start / stop your OpenVPN connection using the OpenVPN Settings app.

Note that for some reason I have to force close the OpenVPN Setting application and open it again after tapping connect in order for the app to recognise the connection has been made.  I will take a look at the source code to try and find why this is.  The OpenVPN connection appears to get re-established automatically after restarting the phone.

Thanks to the user pbando for his post on the modaco forum that helped me do this.

If you have problems with getting your connection established you can run openvpn from the adb shell so you can see the log output:

openvpn --config <yourconfigfilename>.ovpn

iPhone 3G iOS4 - Unexpected Roaming Data Charges

July 31st, 2010

I recently read an article on the register reporting that a bug in Apple’s iOS 4 on their 3G model means that international data roaming is enabled even when the setting shows it is turned off. This prompted me to call o2 to check if I had incurred any data roaming charges whilst on a recent holiday in Greece.

Sure enough, they reported I had almost £5 of international roaming charges on my bill. I always make sure the international roaming setting is turned off on my phone, so it looks like the article is correct. I didn’t use any apps that consume data whilst away, so this must have all been the phone’s background chatter

Luckily I did not have a signal most of the time, otherwise the bill could have been a lot higher. Despite the article saying the operator are aware, o2 did not admit they had heard of this problem before and will not do anything to address the problem until the almighty Apple admits that the bug exists. Let’s hope Apple do the right thing.

On a side note, as many people have reported, the 3G iPhone has become slow to the extent I find it unusable since installing iOS4. I find it somewhat arrogant that Apple neglect their hardware that is only a couple of years old, presumably expecting everyone to buy their latest model and give them more of their cash.

Aperture 3 - AppleScript to Delete Referenced Masters on Network Drives

March 13th, 2010

After reading an article on the new file handling capabilities of Aperture 3 I decided to give it a go.  I had previously been using Lightroom 2 to edit photos but found the interface quite slow and not the nicest for organising many photos.  For example I couldn’t sort the folder view by date. iPhoto didn’t have the level of editing capabilities I wanted and I disliked the idea of having a monolithic untouchable propriety library “file” storing all my photos.  What if I wanted other apps to access my photo files over the network?  What if I wanted to split my library up as I run out of space on my laptop?  How would I share my libraries across macs?

The article mentioned that with Aperture 3 parts of libraries could be easily imported/exported, different libraries could be kept and switched between easily.  In general it sounded very flexible.  So my idea was to have my main Aperture library on a network drive to allow me to access it from either my mac book or mac mini at home.  Unfortunately this was not possible as, rather frustratingly, Aperture 3 does not let you open or save libraries to network drives.  Googling this showed up many other frustrated users as apparently this was possible with Aperture 2.  However, I was surprised to see one post mention a workaround to store the library on the network, which ended up giving poor results - even on a Gbit network.  So perhaps there is a reason Apple disabled this after all.

My solution is to use referenced masters stored on the network and keep the actual aperture library on the local disk.  The library itself could be rsyned to the network drive and then back to either my mac book or mac mini when I want to make changes.  I wouldn’t have the main library open on both machines at the same time.  If I wanted to do that I would create a temporary library and then import it to the main library latter.  The original photos would all be outside of the library and references held to their location on the network drive.  When I’m not on my home network with my MacBook I could keep a copy of the referenced files on my local hard drive and re-point the references, but since previews of originals are kept in the library this would probably be sufficient for browsing photos away from home.  Especially if the preview size is set to “keep within 1920″ (found in the settings of Aperture 3).

After having played with this setup for a few minutes I noticed a problem when wanting to delete referenced masters stored on a network drive from the library.  Ticking the “Move referenced files to System Trash” resulted in an error “You don’t have access to the System Trash on the master files’ volume”.  So I wrote an AppleScript to do this.

The script will delete the master originals of the selected photos from the mounted file system.  You can then delete the link to them (which will become broken) from your library.  I wanted to make the script just be an alternative to the empty trash button by removing all items in the trash but had trouble getting this to work.  Therefore it just deletes the selected photos instead.  If you select all photos in the trash before running the script this should be fine.  Then delete them from the Aperture trash afterwards.

The script is heavily based on the “Find Master’s Location” script by Brett Gross but altered to work with Aperture 3.  So many thanks to Brett.  I had no idea until I saw his script that it was possible to directly query the Aperture database which is actually using SQLite.

Needless to say, please use this at your own risk. I’ve only tested it with my specific usage.  My reference photos are stored on an ubuntu samba share and mounted at /Volumes/photos on my mac(s).  Master’s icon available on deviantart.com

It is useful to turn on the Script menu for easy access to this AppleScript.

Ap3 Delete Selected Referenced Masters.scpt

Update: 15th March 2010 - The AppleScript has been updated to display a confirmation dialog box before starting and another dialog box when finished reporting how many files were deleted.

Ubuntu 9.10 - Blinking Cursor on Boot Problem

February 9th, 2010

I found that my Zotac ION 330 Ubuntu 9.10 system would, rather strangely, not boot when having a mouse plugged into my apple USB keyboard. I would just getting a blinking cursor after “grub” has momentarily flashed on the screen. It took some experimentation to find this. I first found that if I unplugged the keyboard and mouse it would boot fine, the narrowed it down to the mouse being plugged into the keyboard USB hub. The system would also start fine with the mouse plugged into another USB port, rather than going via the hub in the keyboard.

After searching online I started to believe this is a problem with starting the X server, as normally this is what happens shortly after the blinking cursor appears. I tried disabling ACPI as suggested in some posts but this did not help. In the end I found that setting the following BIOS setting to disabled solved the booting issue:

Advanced -> USB Configuration -> BIOS EHCI Hand-Off

I originally had problems creating an Ubuntu 9.10 USB boot stick, all of the ones I created would not boot, exhibiting the same blinking cursor symptom after selecting the initial option to install. In the end a network install was the only way I could get the install to work (there is no CD drive in the system). I have a feeling that it may have been because of this BIOS setting and that if I tried now I may find I can boot from the USB image. I will try to confirm this soon.

ITV HD on MythTV

February 9th, 2010

ITV HD (on Freesat) is provided not as a proper channel, it is only accessible by pressing the red button whilst an HD program is being shown on ITV.  I wanted to enable my MythTV box to receive this channel and searched on Google to find out if it was possible.  I found many articles such as the one at iwtf.net but still could not get it working.  The database query where transportid = 2315 listed on the iwtf.net article would not return any results, and many repeated channel scans didn’t yield any results.

A post on digitalspy.com mentioned that I could run the following command to watch ITV HD using mplayer via dvbstream. This worked and so I knew it should be possible to get it to work in MythTV too.

dvbstream -f 11426 -p h -s 27500 -o 3401 3402 | ffmpeg -vcodec h264 -i - -f mpegts -vcodec copy -acodec copy - | mplayer -lavdopts fast:skiploopfilter=all -vf harddup,tfields=4:t -mc 100 -autosync 100 -fps 50 -demuxer lavf -nocorrect-pts -

After some playing around I finally got it to work by adding the following entries to the dtv_multiplex and channel tables of the MythTV database:

INSERT INTO `dtv_multiplex` (`sourceid`, `transportid`, `frequency`, `inversion`, `symbolrate`, `fec`, `polarity`, `modulation`, `bandwidth`, `lp_code_rate`, `transmission_mode`, `guard_interval`, `visible`, `constellation`, `hierarchy`, `hp_code_rate`, `mod_sys`, `rolloff`, `sistandard`, `serviceversion`, `updatetimestamp`, `default_authority`) VALUES
(1, 2315, 11428000, 'a', 27500000, '2/3', 'h', 'qpsk', 'a', 'auto', 'a', 'auto', 0, 'qpsk', 'a', 'auto', 'UNDEFINED', '0.35', 'dvb', 33, '2010-02-09 19:42:03', '')

Replace MPLEXID in the insert below to the MPLEXID that was created by the insert above. You may also need to alter your sourceid as I think this should be whatever your DVB-S tuner is set to.

INSERT INTO `channel` (`chanid`, `channum`, `freqid`, `sourceid`, `callsign`, `name`, `icon`, `finetune`, `videofilters`, `xmltvid`, `recpriority`, `contrast`, `brightness`, `colour`, `hue`, `tvformat`, `visible`, `outputfilters`, `useonairguide`, `mplexid`, `serviceid`, `tmoffset`, `atsc_major_chan`, `atsc_minor_chan`, `last_record`, `default_authority`, `commmethod`) VALUES
(119, '119', NULL, 1, 'ITV HD', 'ITV HD', '', NULL, '', '', 0, 32768, 32768, 32768, 32768, 'Default', 1, '', 1, MPLEXID, 10510, 0, 0, 0, '0000-00-00 00:00:00', '', -1);

Hope this helps anyone trying to do the same. The Freesat channel plan on iwtf.net is also very useful.

Xenon HID Bulb Replacement - Mercedes C Class W203

February 7th, 2010

After finding the near-side headlight had become very dim I looked into if it was possible to replace the xenon gas discharge bulb myself. I found a number of websites selling the bulbs and discovered the bulb I needed was the D2R type. Philips and Osram seem to be the main manufacturers.

Fitting the bulb proved to be quite difficult until I discovered the correct procedure. This is not documented anywhere because the manuals tell you to take the car into the dealer for this work. So I thought I would put up some notes here in case anyone else wants to do the same.

Make sure you turn the lights to the off position (NOT Auto) before attempting to replace the bulb. There are very large voltages involved (25,000 v) and needless to say if you change the bulb you do so at your own risk! I wore rubber gloves to be extra careful. I also left the car for a day after last being used before I started this work because the Haynes manual mentioned there could be some charge left in the system even after the lights have been switched off.

After removing the main black headlight compartment cover you will see the connector which is fitted to the back of the bulb. It is red and black and has a yellow warning triangle sticker on it. It will be at a slight angle, if you twist it slightly so that the sticker becomes vertical , it will detach from the back of the bulb. Place the connector out of the way and then you will see the back of the bulb. It is held in place by a round yellow plastic holder. Towards the top left (as you face the front of the car) there is a clip you push towards the centre and then you can rotate the holder and pull it out together with the bulb. Swap the bulb for the new one, making sure when you insert the bulb with the plastic holder back into the compartment, the notches on the bulb are at the top (and hence the brown rod is at the bottom). It is quite difficult to get the notches in the bulb to line up with prongs at the top of the enclosure. Once you have done this hold the bulb in place with the plastic holder, push the clip at the top left of the holder inwards and twist the holder so it becomes locked into place. Then attach the connector by pushing it onto the back of the bulb and twisting slightly. Replace the black compartment cover and you’re done!

Powabyke X-24 Review

October 25th, 2009

Overall the Powabyke X-24 is great, but unfortunately it is far from perfect and let down by some rather big design flaws. In addition from my experience their after-sales service has not been especially good.

The design flaws I’ve found with this bicycle are:

  • The hub motor on the front wheel has a longer than necessary cable which forms a loop before running up the front fork. This could be easily caught, causing damage.
  • The bolt attaching the saddle to the seat post has broken twice so far. It appears to be a weak point. Also, rather frustratingly the bolt is of M7 size, which is very difficult to find.
  • The way the battery attaches to the frame (where a water bottle would go) is not especially good. It slides into some grooves attached to the frame, however there is nothing to lock it in place which means a certain amount of vibration or going over a bump could cause the battery to fall off. The battery itself also has a rather sharp edge on it’s underside that can cut you if care is not taken to hold it correctly.
  • The charger does not appear to me of a high standard. It failed within the first few months and it took many weeks to get a replacement sent out.
  • The level of after-sales service has mostly been poor both from the store I bought it (Evans Cycles) and Powabyke. Having to communicate via the store to Powabyke has complicated matters and often caused a surprising amount of confusion between the parties.

    So these are the bad points, other than these problems the bicycle is fairly good. I often ride it without the battery and it its pleasant to ride. However, with the amount of electric bikes now on the market I would have a strong look at the competition before choosing this bike as I suspect there are better options around.

    Copying files using part of the source filename in the destination

    April 10th, 2009

    When trying to migrate a few Gallery 1 albums to Gallery 2 I found they were missing the full size image and only the sized and thumbnail versions were available.  I created this quick perl script and used it together with the find command to create copies of the sized images with the same filenames minus the .sized part.  For example this would copy IMG_2591.sized.jpg to IMG_2591.jpg.

    Perl Script copy.pl:

    #!/usr/local/bin/perl
    $filename = $ARGV[0];
    $filename =~ m/\.\/([\w\d]+)\.sized\.jpg/;
    $imgname = $1;
    print “cp -p $filename $imgname.jpg\n”;
    `cp -p $filename $imgname.jpg`;

    Shell command:
    find . -name '*.sized.jpg' -execdir ./copy.pl {} \;

    How to deactivate o2 voicemail before roaming

    March 17th, 2009

    If someone leaves you a voicemail while you are roaming internationally with o2, o2 charge you for the luxury. So not only will checking the voicemail cost you money (as you would expect) but the mere fact that someone has left you a voicemail will cost you too. Depending on how likely people are to leave you long voicemails this could get very expensive.

    It sounds crazy to me and I doubt there is a technical limitation why this is the case. Except for perhaps how the iPhone’s visual voicemail works, but this applies to all o2 customers, not just ones with iPhones. My guess is that it is o2 simply trying to make more money.

    So make sure you turn off voicemail as follows when going abroad:

    Turn off voicemail 1760
    Turn on voicemail 1750
    Turn on call alert service 1710 (sends a text when someone calls and you were not able to answer) free of charge

    Bluetooth GSM Asterisk Trunk chan_mobile

    November 23rd, 2008

    In our flat the door entry system works by calling a telephone number you provide. All very clever, but the only problem I can think with that is what if you are already using that line? The person waiting at the door will just get an engaged tone. Ideally you want to know someone is at the door even if you are already on the phone. In other words the person waiting outside your house should have a higher priority. Other ideas regardless of whether you are using the telephone line or not are; a different ring tone (a door bell perhaps) and automatically tuning the TV to the channel showing the door camera.

    I got thinking that mobile phones are so cheap these days I could buy one just for use as the “door intercom”. Then I had another idea, why not integrate it into my existing VoIP network with Asterisk. Then someone at door would call all the phones in house - perhaps set with distinctive rings. Anyone could pick up and talk with the person at the door. It would also then be possible to control the TV based on the incoming call by Asterisk sending the right command to my home automation kit.

    After some googling I came across chan_mobile. Just what I need. It allows a bluetooth mobile phone to act as a GSM trunk. So I can buy a PAYG simcard - put it in an old bluetooth mobile phone and have it as a dedicated line for the door entry system to call. It also has other cool features I might put to use. To find out more go to:

    www.voip-info.org/wiki/view/chan_mobile
    www.chan-mobile.org

    “chan-mobile is an Asterisk channel driver that allows you to use bluetooth devices as FXO or FXS channels.”

    Features:
    Supports multiple Bluetooth adapters
    Supports multiple Bluetooth devices
    Use cellphones and/or headsets
    Send and Receive SMS
    Presence Sensing
    Channel Groups for implementing ‘GSM Gateways’