Wednesday, September 28, 2011

Filesystem Corruption on Android

In spite of dramatic improvements in filesystem technologies, corruption is still an issue that continues to this day in computing whether it be on the desktop and/or on more portable devices. Recently my Android based phone endured something along these lines. A number of folders had become files and there were randomly named files spread throughout the filesystem on the SD card with unreadable characters. Research indicated that this was a problem that has been experienced before by others (though the type of corruption often varies).

Luckily in my case, all important data was still retained but it was still disconcerting to say the least. The way I dealt with it was by connecting my phone via USB to my laptop and set the connection to run in mass storage mode. Thereafter, I ran 'Scandisk' (FAT32 filesystem is used on the SD card) in order to determine the causes and hopefully create the fixes required in order to achieve filesystem consistency. Obviously, it would store the files in various CHK files. Still had permission errors though. Upon further examination certain directories seemed to have have become files which resulted not being able to save files from camera shots for photos (DCIM) or wallpapers (Wallpaper). By manually recreating the relevant directories and copying back the relevant files to the relevant data directories you could restore most data. By using the built-in image viewer you could regenerate relevant metadata. Obviously, I'm still looking for a more elegant solution that can be built into the device itself.

Monday, September 5, 2011

Open Source PBX Evaluation

A while ago I had to do evaluation of PBX systems for a company after we discovered that we didn't have enough bandwidth between two offices to offer guaranteed quality of service during peak data transfer times. These are some of the notes from that particular evaluation. Note, that this data may be invalid since the actual evaluation was conducted about a year and half ago from the data of this particular post.

- Trixbox/FreePBX/Elastix/AsteriskNOW/SwitchVox have been evaluated
- apparently custom contexts module for Elastix is in beta and has to be custom installed,
- Had to update to latest version of software as old version didn't seem to pick up existing settings from within our current phone network well. New version seems a little funny. Had to setup in unembedded FreePBX, then check in Elastix PBX section and apply, then go back into FreePBX before outbound routes were picked up correctly...
- VMBlast is a module that will allow you to leave voicemail for multiple users in your system,
- To install a new module in FreePBX basically download it, extract it, then within the web inteface go to unembedded FreePBX, 'Modules Admin', Install, Process, Confirm
- Telemarketer Torture module for FreePBX, generates a destination for inbound calls in FreePBX which you may send unwanted callers to Module created by James Finstrom
- Outbound Routes, Dial Patterns
- ZAP, Dial Rules
- AsteriskNOW, think of FreePBX on a stripped down version of Linux that is fast to install. Reminds me of LiveCD produced by Xorcom in order to test connectivity to their devices.
- non-critical bug in Trixbox installer. kmod does not require kernel... interesting that they've opted to go for text based installer as opposed to full blown GUI
- Trixbox have apparently setup their own init.d like start-up system, /var/trixbox_load/firstboot/
- builtin functionality to allow for reboot when no active calls are going
- true web based tick and upgrade system that will allow us to pursue more finer grained control than was previously possible with all in one support packages
- interesting that they should choose to go with phpconfig rather than a complete brand new interface for their file configuration
- SwitchVox is very slick but may end up being beyond our budget considering the number of phones in our system,
- redirects to Asterisk NOW for live test CD
-, installing FreePBX on various systems

Arduino Programming

Recently, an electronics store opened close by. This of course had its pros as well as its cons. The pros being that I have a place close by where I can get all sorts of electronic parts that I require. The con being sometimes you can get caught up in new pieces of technology. One of these pieces of technology happens to be Arduino electronics. There are obviously many different variations of compatible hardware but the most useful one that I came across that was in stock was the EtherTen.

Its basically a 100% Arduino compatible board that has an on board MicroSD card slot, an Ethernet port, as well as an ATmega328P MCU. Besides doing the usual LED blinker type experiments that you may have encoutered at University you'll also have the chance to interact with the outside world using all sorts of extra functionality such as wireless, LCD screens, motors, and enironmentel sensors. (details regarding this are available towards the bottom of this post)

Software Setup

1) Download software from,
2) Upon uncompression the you'll notice a arduino executable. Opening it will result in a minimalistic IDE for simple programming of the device itself.
3) Install the Windows USB driver if required via (you won't require this if you're using Linux)
4) Select correct board by going to Tool > Board
5) Go to Tools > Serial Monitor to find out where device is going to be plugged in. Else just use dmesg and look for something similar to the following (if using Linux)

[ 8632.239231] usb 3-1: new full speed USB device number 3 using uhci_hcd
[ 8632.431914] usb 3-1: New USB device found, idVendor=20a0, idProduct=4150
[ 8632.431926] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[ 8632.431935] usb 3-1: Product: Eleven
[ 8632.431943] usb 3-1: Manufacturer:
[ 8632.431950] usb 3-1: SerialNumber: 64938323231351C0B1A1
[ 8632.435125] cdc_acm 3-1:1.0: ttyACM0: USB ACM device

6) Go to Tools > Serial Port and select the correct port on which the Arduino has been connected on.
7) You should see the blue LED on the board light up to indicate that the board has now been connected.

Running a Program on the Arduino
1) File > Examples > Digital > Name of Program
2) Sketch > Verify/Compile
3) File > Upload to I/O Board

You'll need to have avr-g++ installed as well as a number of other dependent utilities on Linux. I was using Knoppix Live ISO image so I tried downloading Debian packages obviously. I noticed that there were a few dependency oddities though including some that were not so easy to fix so I resorted to using the Windows version to get things up and running quickly.

Note, that Ethernet will not work without sufficient power. Funnily enough, a Linksys switch AC adapter works perfectly with the device (12V with + in centre) though it can cause the device to heat up a little. Note also that the LCD can be used without extra power although at a significantly lower brightness level.

Not everything is perfect. I had to upload compiled firmware twice a few times or else you may encounter limitations like this guy did here, Nonethless, its an incredible piece of hardware considering how inexpensive it is.

You may need to alter the default initialisation string from the example sketch if you do intend to use the LCD/keypad shield. Details of this were on the underside of the actual PCB on my particular 'Shield'.

Currently, I'm working on wireless transfer of information. Details of my progress on this experiment will follow later.