Sunday, 20 December 2015

Howto upgrade Ubuntu that is no longer supported.

Adapted from

1) Edit apt sources to use "old releases" repositories.
sudo sed -i -e 's/\|' /etc/apt/sources.list
But your sources.list file may contain other repositories that have, for me, prevented this process from working.

a) Manually edit /etc/apt/sources.list and comment out these entries

deb-src ...

and comment out any other repositories that were not converted to

b) Change any country specific URLs to 'US' versions

eg. to

2) Update packages

sudo apt-get update
sudo apt-get dist-upgrade

3) Upgrade Ubuntu version

sudo do-release-upgrade -d

Friday, 1 May 2015

Howto install smokeping on lighttpd on ubuntu 15.04 linux

Smokeping is a great network and service monitoring tool. But it only configures correctly if you are using apache.

I want to run a very light web server and therefore you need to do some manual configuration to make it work.

1. Install lighttpd.

sudo apt-get install lighttpd

2. Ensure that http://localhost works. You should get page like this:

3. Install smokeping

sudo apt-get install smokeping

4. Enable Lighttpd CGI module

sudo lighttpd-enable-mod cgi

5. Reload Lighttpd

sudo /etc/init.d/lighttpd force-reload

6. Ensure that this link brings up a semi-functional page


Icons and graphs probably do not work.

6. Create a directory link in /var/www/ as smokeping to smokeping static page files:

sudo ln -s /usr/share/smokeping/www /var/www/smokeping
7. For some reason, lighttpd base directory is /var/www/html. This needs to be changed to /var/www (which I suspect other packages will be expecting).

Edit /etc/lighttpd/lighttpd.conf

Change this line:
server.document-root = "/var/www/html"


server.document-root = "/var/www"

8. Restart lighttpd and smokeping

sudo /etc/init.d/lighttpd restart
sudo /etc/init.d/smokeping restart

Did you get this?

Update to enable fastcgi.

I don't know what fastcgi is, but compared to cgi is is fast.

On my laptop, it is 5 times faster!

1. Copy smokeping.fcgi.dist as smokeping.fcgi

sudo cp /var/www/smokeping/smokeping.fcgi.dist /var/www/smokeping/smokeping.fcgi

2. Edit smokeping.fcgi to point to your smokeping.cgi script

exec /usr/lib/cgi-bin/smokeping.cgi /etc/smokeping/config

NOTE: my file had smokeping_cgi. This seems to be wrong and must be changed to smokeping.cgi

3. Modify /etc/lighttpd/conf-available/10-fastcgi.conf

Add this:

fastcgi.server += ( 
  "smokeping.fcgi" => ((
    "socket"   => "/var/run/lighttpd/fcgi.socket", 
    "bin-path" => "/usr/share/smokeping/www/smokeping.fcgi"

4. Enable Lighttpd FastCGI module

sudo lighttpd-enable-mod fastcgi

5. Reload Lighttpd

sudo /etc/init.d/lighttpd force-reload

6. This link should now work


Sunday, 8 March 2015

Asus Transformer TX201 - Android + Ubuntu 14.10 Linux

  The Good and the gooder (and some bad points)


2 computers in 1. Keyboard is a dual core i5 and tablet is an intel Z2560 (x86)

#Android and  8 and  and whatever else you can install on a x86 PC.

Using android  you don't need a cable.

Once you manage to boot from USB,  14.10 is trivial to install.

UPDATE: I upgraded kernel to 3.18 and then 3.19.

Fast switching between Android and Linux (or Windows). Both run at same time or you can shut down one and use other.

Chargers are small and well designed Asus plug-packs - not bricks.

Easy to open Keyboard to change HDD.

Under Linux, everything seems to work. Screen brightness is not working properly, but it does work. 

UPDATE: Thanks to Viktar Vaŭčkievič and #ArchLinux, I compiled and installed an ALS module which automatically adjusts screen backlight. See

Running linux in  mode.


11.6" screen. Could be an inch bigger based on bezel.
Tablet and keyboard have WiFi and Bluetooth.

Tablet  is possible.

SD card on tablet mounts in Windows/Linux. But Ubuntu keeps opening a file manager every time I switch back from Android.

UPDATE: Fixed by Control Panel - Details - Removable Media - Tick 'Never prompt or start programs on media insertion'

Linux kernel modules to support device.

Aluminium tablet and keyboard backs.


Matt screen might be better.

No 3G or LTE.

Can not connect 3G modem to tablet (so far).

No Android update from Asus.

No keyboard backlight nor fluorescent key labels.

When screen is open, tablet/screen hinge opens lower than base of keyboard which makes it uncomfortable as a lap-top.

A bit heavy for it's size at 1.7 kg (tablet and keyboard)

Only 2.4GHz WiFi.

UPDATE: But syslog indicates PC might support 5 GHz.

Rear camera does not work on PC.

WiFi (RTL8821) occasionally locks-up. To fix, remove module, put keyboard to sleep (Fn+f2), wake (power button) and load module. Module is rtl8821ae in my case.

UPDATE: This only seems to happen (now) when I tether to an iPhone 5s.

UPDATE: #ArchLinux also had a solution to this - too early for me to confirm that it is fixed. Does not seem to fix.

Thursday, 3 July 2014

Howto install OpenWRT on Netgear DG834 or DG834G (v1 or v2)

Got a spare Netgear DG834 or DG834G? Want to try OpenWRT? Want an easy process?

This assume you are running Ubuntu.

Try this:

0. Before you start...

0.1 Ensure router power plug is secure.
0.2 Ensure LAN cable is clicked into both router and computer.
0.3 Ensure your router is working by opening (or whatever IP address you have changed it to)

1. Backup router config in case you want to restore factory firmware.

2. Factory default router to ensure it's IP address is

2.1 Power on router.
2.2 Hold in reset button until test light (tick) flashes.
2.3 Wait for router to reboot (I think - might have to power cycle it).

3. Run my script to turn on telnet, backup partitions, extract environment file, patch ADAM2 to turn off checksum test, download OpenWRT, split into 2 parts, install patched ADAM2 and OpenWRT parts...

Note: This is not conventional and may not work. But unless you have some hardware fault or power failure, you can fairly easily recover your Netgear using a Netgear image and a small C program called nftp. I'll add instructions below.

3.1 mkdir
3.2 cd
3.3 save my script here
3.4 Run my script like this: 

bash ./pc-setup-wrt-v2.bash

... and follow my instructions.

4. Boot into OpenWRT

4.1 Power cycle router.
4.2 Connect ethernet port - may take 1-2 minutes first time.
4.3 Browse to
4.4 Follow instructions to set password.


My Script

Save as pc-setup-wrt-v2.bash


# Factory default router
#   Power on. Hold in reset button until test light (tick) turns on.

# Setup PC ethernet interface use DHCP. Disconnect. Connect - should get
#   router should be

# test by pointing browser to - should get Netgear Setup Wizard screen
# route del default

# info stuff here

# MTDx partitions using 3.??.32? - seems to have 5 mtdx
# mtd0  0x900d0000,0x903e0000  ROOTFS
# mtd1  0x90020000,0x900d0000  Kernel
# mtd2  0x90000000,0x90020000  ADAM2
# mtd3  0x903e0000,0x903f0000  Probably Netgear firmware config
# mtd4  0x903f0000,0x90400000  Probably ADAM2 config

# Ordered
# mtd2  0x90000000,0x90020000  ADAM2
# mtd1  0x90020000,0x900d0000  Kernel
# mtd0  0x900d0000,0x903e0000  ROOTFS
# mtd3  0x903e0000,0x903f0000  Probably Netgear firmware config
# mtd4  0x903f0000,0x90400000  Prob. ADAM2 config

echo "Install needed packages..."
sudo apt-get install wget
sudo apt-get install expect
sudo apt-get install mini-httpd

echo "Get openwrt image - this is for mtd0 and mtd1 so it needs to be split..."

which wget || { echo "ERROR: wget not installed"; exit 1; }


[[ -f ${OPENWRT} ]] \
  || wget "${OPENWRT}"

echo "Configure this script..."

# ip address of router - should be after factory reboot

# ip address on this host - should not need to change

# port on this host that has ethernet cable to router plugged in - should be same

echo "Configure this script (ROUTER, HOST, and ETH) variables."
echo "Disconnect from all other networks."
echo "Next time you run this it will reconfigure your ETH port and "
echo "connect to your router."
echo "If you have configured variables correctly, comment out next line."
exit 0

echo "Split OpenWRT image file..."


which dd || { echo "ERROR: dd not installed"; exit 1; }

dd if=${OPENWRT} of=${OPEN1} count=720896 bs=1
dd if=${OPENWRT} of=${OPEN0}  skip=720896 bs=1

echo "Reconfigure ETH port..."

which ifconfig || { echo "ERROR: ifconfig not installed"; exit 1; }

sudo ifconfig ${ETH} ${HOST} netmask

echo "Turn on telnet - assumes your reouter has been factory defaulted..."

LOGIN="--user=admin --password=password"

wget -v -O debug.log ${LOGIN} "http://${ROUTER}/setup.cgi?todo=debug"

echo "Telnet to router, and do some heavy stuff - but nothing dangerous...yet..."

# Assign an IP address to ADAM2 (patch)
# Backup each MTD Block to RAM
# Spawn a HTTP Daemon to download MTD Backups
which expect || { echo "ERROR: expect not installed"; exit 1; }
which telnet || { echo "ERROR: telnet not installed"; exit 1; }

expect >telnet.log <
set timeout 30
set send_human {.1 .3 1 .05 2}
spawn telnet ${ROUTER};                             expect "# "; sleep 1;
send_error "Telnet script\n";
send -h "cat /proc/sys/dev/adam2/environment | grep -v \"^my\" > /proc/sys/dev/adam2/environment\r";
                                                     expect "# "; sleep 1;
send -h "echo \"my_ipaddress ${ROUTER}\" > /proc/sys/dev/adam2/environment\r";
                                                     expect "# "; sleep 1;
send_error "Cat environment file...\n";
send -h "cat /proc/sys/dev/adam2/environment\r";    expect "# "; sleep 1;
send_error "Copy partitions to tmp...\n";
send -h "dd if=/dev/mtdblock/0 of=/tmp/mtd0.bin\r"; expect "# "; sleep 1;
send -h "dd if=/dev/mtdblock/1 of=/tmp/mtd1.bin\r"; expect "# "; sleep 1;
send -h "dd if=/dev/mtdblock/2 of=/tmp/mtd2.bin\r"; expect "# "; sleep 1;
send -h "dd if=/dev/mtdblock/3 of=/tmp/mtd3.bin\r"; expect "# "; sleep 1;
send -h "dd if=/dev/mtdblock/4 of=/tmp/mtd4.bin\r"; expect "# "; sleep 1;
send_error "Copy environment file...\n";
send -h "cat /proc/sys/dev/adam2/environment > /tmp/environment.bak\r";                                                     expect "# "; sleep 1;
send -h "cd /tmp\r";                                expect "# "; sleep 1;
send_error "Start web server...\n";send -h "mini_httpd -p 1080\r";                     expect "# "; sleep 1;
send -h "exit\r";

echo "Pull files from router..."
wget ${LOGIN} -O mtd0.bin        "http://${ROUTER}:1080/mtd0.bin"
wget ${LOGIN} -O mtd1.bin        "http://${ROUTER}:1080/mtd1.bin"
wget ${LOGIN} -O mtd2.bin        "http://${ROUTER}:1080/mtd2.bin"
wget ${LOGIN} -O mtd3.bin        "http://${ROUTER}:1080/mtd3.bin"
wget ${LOGIN} -O mtd4.bin        "http://${ROUTER}:1080/mtd4.bin"
wget ${LOGIN} -O environment.bak "http://${ROUTER}:1080/environment.bak"

echo "See if correct ADAM2 versio is installed..."

which grep || { echo "ERROR: grep not installed"; exit 1; }

grep "bootloaderVersion.*0.18.01" environment.bak \
  || { echo "HALT: Boot loader version is not 0.18.01"; exit 1; }

echo "See if ADAM2 is already patched..."


which md5sum || { echo "ERROR: md5sum not installed"; exit 1; }

MDS2=$( md5sum mtd2.bin | cut -d' ' -f1 )

if [[ "$MDS2" == "d8a2f4623bf6f64b7427812f0e849aa7" ]]; then
  echo "mtd2.bin already patched"
  cp mtd2.bin ${ADAM2NEW}
  echo "mtd2.bin not patched"
  echo "Verify ADAM2 file..."
  MDS=$( md5sum mtd2.bin | cut -d' ' -f1 )
  if [[ "$MDS" != "0530bfdf00ec155f4182afd70da028c1" ]]; then
    echo "HALT: ADAM2 (mtd2.bin) MD5 sum does not match"
    exit 1
  echo "Patch ADAM2..."
  cp mtd2.bin ${ADAM2NEW}
  printf '\x00\x00\x00\x00' | dd of=${ADAM2NEW} bs=1 seek=14660 count=4 conv=notrunc 
  echo "Verify patched ADAM2..."
  MDS2=$( md5sum ${ADAM2NEW} | cut -d' ' -f1 )
  if [[ "$MDS2" != "d8a2f4623bf6f64b7427812f0e849aa7" ]]; then
    echo "HALT: Modified ADAM2 (${ADAM2NEW}) MD5 sum does not match"
    exit 1

echo "Kill off any legacy http servers (if we have somehow left them running)..."
killall mini-httpd

echo "Start local web server..."
sudo mini-httpd -p 8000 || { echo "ERROR: mini-httpd did not start"; exit 1; }

echo "Download modified ADAM2 and OpenWRT files to router and install them..."

expect >flash.log <
set timeout 30
set send_human {.1 .3 1 .05 2}
spawn telnet ${ROUTER};                           expect "# "; sleep 1;
send_error "Telnet script to install modified ${ADAM2NEW}\n";
send -h "cd /tmp\r";                              expect "# "; sleep 1;
send -h "rm mtd0.bin\r";                          expect "# "; sleep 1;
send -h "rm mtd1.bin\r";                          expect "# "; sleep 1;
send -h "rm mtd2.bin\r";                          expect "# "; sleep 1;
send -h "rm mtd3.bin\r";                          expect "# "; sleep 1;
send -h "rm mtd4.bin\r";                          expect "# "; sleep 1;
send -h "rm ${ADAM2NEW}\r";                       expect "# "; sleep 1;
send_error "Download modified ${ADAM2NEW} from ${HOST}...\n";
send -h "wget http://${HOST}:8000/${ADAM2NEW}\r"; expect "# "; sleep 10;
send -h "dd if=${ADAM2NEW} bs=1 skip=110747 count=5\r";
expect {
  "DG834" { send_error "GOOD: ${ADAM2NEW} contains DG834 string\n"; };
  timeout { send_error "ERROR: TIMEOUT: Did not get DG834\n"; exit;  };
  "# "    { send_error "ERROR: Got prompt instead of DG834\n"; exit; };
sleep 1;
send_error "Install modified ${ADAM2NEW}...\n";
send -h "dd if=${ADAM2NEW} of=/dev/mtdblock/2\r"; expect "# "; sleep 20;
send -h "rm ${ADAM2NEW}\r";                       expect "# "; sleep 1;
send -h "rm ${OPEN0}\r";                          expect "# "; sleep 1;
send_error "Download ${OPEN0} from ${HOST}...\n";
send -h "wget http://${HOST}:8000/${OPEN0}\r";    expect "# "; sleep 10;
send_error "Install ${OPEN0}...\n";
send -h "dd if=${OPEN0} of=/dev/mtdblock/0\r";    expect "# "; sleep 20;
send -h "rm ${OPEN0}\r";                          expect "# "; sleep 1;
send -h "rm ${OPEN1}\r";                          expect "# "; sleep 1;
send_error "Download ${OPEN1} from ${HOST}...\n";
send -h "wget http://${HOST}:8000/${OPEN1}\r";    expect "# "; sleep 10;
send_error "Install ${OPEN1}...\n";
send -h "dd if=${OPEN1} of=/dev/mtdblock/1\r";    expect "# "; sleep 20;
send -h "rm ${OPEN1}\r";                          expect "# "; sleep 1;
send -h "reboot\r";

echo "Shutdown local web server..."
killall mini-httpd

echo "All done."
echo "Power cycle router."
echo "Reconnect ethernet interface - may take 1-2 minutes"
echo "Browse to"
exit 0

Basic Configuration Steps

Save and Apply after each change.

If unsure, power cycle router.

Set password
Set timezone
Set dropbear (ssh) interface to lan

Edit LAN interface
  IP address (WARNING: This gives me most headaches - perhaps leave it alone for a while)
  (When you save and apply, you may need to disconnect/reconnect ethernet interface on pc)
  I set MTU to 1474

Add new (PPPoATM) interface
Set username and password
Set custom DNS servers to OpenDNS and
Assign ADSL interface to WAN

Edit Wifi
  Set SSID etc.
  Set to WEP and generate WEP hex key somehow.

No WPA???

Sunday, 12 January 2014

Virtualize an old Windows XP disk partition (howto convert disk partition to virtual disk for VirtualBox)

I dug out an old hard disk. I was curious: what gems are stored here?

Turns out there was nothing, but it was in interesting exercise in converting a single disk partition into a VM - something that is not trivial.

I plugged my old drive into a USB hard disk docking station and had a look. It contained Windows XP and Linux from an old PC dating from 2004-2007 I believe.

"Hey!" I thought. I could virtualize this for no good reason and show how easy it is using free and open source software.

Ubuntu Packages

I installed VirtualBox and mbr.

Create VirtualBox VM

  • Select New
  • Name your VM (say TEST)
  • Select Windows and Windows XP
  • Set memory size (default is ok)
  • Select 'do not add a virtual hard drive' - we will create this later in tis VM's directory.

Create Virtual Disk Drive

Open a terminal and change to your ~/VirtualBox\ VM/TEST directory for this example.

Copy and paste my script into your editor.



printf "Copy boot sector image...\n"
sudo dd if=$DISK of=mbr.img bs=512 count=1 || { printf "FAILED\n"; exit 1; }
printf "Done\n"

# put 'normal' mbr incase grub or something was used
printf "Replace MBR code..."
sudo install-mbr mbr.img -t 36 || { printf "FAILED\n"; exit 1; }
printf "Done\n"

printf "Copy disk (%s) partition %d...(at 10MB/s 1GB will take 100s)...\n" "$DISK" $PART
sudo dd if=${DISK}${PART} of=$PARTIMG bs=512 || { printf "FAILED\n"; exit 1; }
sudo chown $USER:$USER $PARTIMG
printf "Done\n"

printf "Make VirtualBox VMDK image with MBR...\n"
sudo VBoxManage internalcommands createrawvmdk -filename ./disk.vmdk -rawdisk $DISK -partitions $PART -mbr ./mbr.img || { printf "FAILED\n"; exit 1; }
# VB needs this owned by user
sudo chown $USER:$USER disk-pt.vmdk
printf "Done\n"

# switch to partition image and zero starting offset
# eg.
# from this: RW 8514387 FLAT "/dev/sdd" 63
# to this: RW 8514387 FLAT "/home/phil/Development/pc-part2disk/part1.img" 0
printf "Modify VMDK files to use disk partition image...\n"
sudo cat disk.vmdk | sed "s@\"$DISK.*@\"./$PARTIMG\" 0@" > diskimage.vmdk
sudo chown $USER:$USER diskimage.vmdk
printf "Done\n"

# remove VB vmdk that points to physical drive - no longer required
sudo rm disk.vmdk

exit 0
 Change DISK and PART to suit your case. This example uses disk /dev/sdd and partition 1.

Also, run chmod +x

Saturday, 15 June 2013

Howto enable AHCI Mode MacBookPro1,2 and MacBookPro4,1

I added this after insmod ext2 in grub:

setpci -s 0:1f.2 90.b=40

This sets Intel ICH7 (page 509) or ICH8 (page 486) controller into AHCI mode.

A similar command will probably work for other ICHx devices.

I got my bus:slot.function from running lspci - take value from line that states SATA IDE mode


00:1f.2 SATA controller: Intel Corporation 82801GBM/GHM (ICH7-M Family) SATA Controller [IDE mode] (rev 02)

Both MBP1,2 and MBP4,1 have same bus:slot.function and use same value (40h) to put controller into AHCI mode.

UPDATE: Should be MacBookPro1,2 not MacBookPro2,1

Monday, 3 June 2013

Root Huawei X3 8150 Without Windows or a Working Touchscreen

I got some of this from here

Some phone modes


Disconnect USB.
Power-off phone.
RED+VOL-DN+POWER - hold for about 5 seconds. Phone will vibrate and show a white screen with IDEOS displayed.
Connect USB.


Disconnect USB.
Power-off phone.
GREEN+VOL-UP+POWER - hold for about 5 seconds. Phone will vibrate, show a white screen with IDEOS displayed and then show Recovery menu.
Connect USB.

Enter DOWNLOAD mode

Disconnect USB.
Power-off phone.
RED+GREEN+POWER - hold for a few seconds until screen turns pink/magenta.
Connect USB.
(This does not work for me under Linux)

Replace Stock Recovery with ClockWork Recovery

Install Android SDK
From ubuntu this is very easy now:
apt-get install android-tools-adb
apt-get install android-tools-fastboot
Open root terminal or open terminal and sudo su.

Check that all is well, that USB connection is working and that ADB is correctly installed

Enter RECOVERY mode
Phone should boot into 'Android system recovery'

# adb devices
List of devices attached 
308730C82377 recovery

Enter FASTBOOT mode

# fastboot erase recovery
erasing 'recovery'...
OKAY [  0.033s]
finished. total time: 0.033s

Get ClockWorkMod Recovery
All available Recovery's are here:

Get ClockWork Recovery fro IDEOS
I used

# fastboot flash recovery /home/phil/Downloads/recovery-clockwork- 
sending 'recovery' (3796 KB)...
OKAY [  0.255s]
writing 'recovery'...
OKAY [  0.806s]
finished. total time: 1.061s

# fastboot reboot
Phone should reboot.

Get Root
Get files from

# adb push ../../rootme/rageagainstthecage-arm5.bin  /data/local/tmp
127 KB/s (5392 bytes in 0.041s)

# adb ls /data/local/tmp
000041fd 00000000 51208853 .
000041fd 00000000 51208845 ..
000081b6 00001510 4c77ab24 rageagainstthecage-arm5.bin

# adb shell
~ # cd /data/local/tmp
/data/local/tmp # chmod 0755 rageagainstthecage-arm5.bin 
/data/local/tmp # ./rageagainstthecage-arm5.bin 
/sbin/sh: ./rageagainstthecage-arm5.bin: not found

I give up. I'll exit shell and try again.

/data/local/tmp # exit

# adb shell
~ # whoami

Hmm. It seem I was already root! I suspect that SuperuserOneClick that I experimented with - but did not log - using mono under linux may have worked - although I had no indication that it did.

I'll carry on.

Next I remount mdtblock4 to be able to write to it.

~ # mount -o rw,remount /dev/block/mdtblock4 /system
mount: mounting /dev/block/mdtblock4 on /system failed: Invalid argument

But it seems it is not mounted.

~ # mount          
rootfs on / type rootfs (rw)
tmpfs on /dev type tmpfs (rw,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
/dev/block/mtdblock5 on /cache type yaffs2 (rw,nodev,noatime,nodiratime)

~ # df
Filesystem           1K-blocks      Used Available Use% Mounted on
tmpfs                    91624        32     91592   0% /dev
/dev/block/mtdblock5     95232      1688     93544   2% /cache

In my case, mtdblock4 is not mounted so I mounted it.

~ # mount /dev/block/mtdblock4 /system

~ # ls /system/
app         etc         lib         tts         xbin
bin         fonts       lost+found  usr
build.prop  framework   media       wifi

Now I realise that I made a typo: I entered mdtblock4 instead of mtdblock4.

~ # mount -o rw,remount /dev/block/mtdblock4 /system 
~ # df
Filesystem           1K-blocks      Used Available Use% Mounted on
tmpfs                    91624        32     91592   0% /dev
/dev/block/mtdblock5     95232      1688     93544   2% /cache
/dev/block/mtdblock4    174080    131780     42300  76% /system

Ok. mtdblock4 is now writeable.

Copy su, busybox, sqlite3, Superuser.apk to device.

# adb push rootme/su  /system/bin/su
837 KB/s (26264 bytes in 0.030s)

# adb push SuperOneClickv2.3.3-ShortFuse\ \(1\)/Dependencies/busybox  /system/bin/busybox
1978 KB/s (1075144 bytes in 0.530s)

# adb push SuperOneClickv2.3.3-ShortFuse\ \(1\)/Dependencies/sqlite3  /system/bin/sqlite3
333 KB/s (24120 bytes in 0.070s)

# adb push SuperOneClickv2.3.3-ShortFuse\ \(1\)/Root/  /system/bin/sqlite3
Superuser.apk  su-v1          su-v2          

# adb push SuperOneClickv2.3.3-ShortFuse\ \(1\)/Root/Superuser.apk  /system/app/Superuser.apk
2095 KB/s (843503 bytes in 0.393s)

Now to change permissions.

# adb shell
~ # cd /system/bin
/system/bin # chmod 4755 su
/system/bin # chmod 4755 busybox 
/system/bin # chmod 4755 sqlite3 

/system/bin # cat /proc/cpu
/proc/cpu/     /proc/cpuinfo

What CPU do we have?

/system/bin # cat /proc/cpuinfo 
Processor : ARMv6-compatible processor rev 2 (v6l)
BogoMIPS : 594.73
Features : swp half thumb fastmult edsp java 
CPU implementer : 0x41
CPU architecture: 6TEJ
CPU variant : 0x1
CPU part : 0xb36
CPU revision : 2

Hardware : HUAWEI U8150 BOARD 
Revision : 0000
Serial : 0000000000000000

Mount /data using ClockWorkMod Recovery
(could have done this using adb)

/system/bin # df
Filesystem           1K-blocks      Used Available Use% Mounted on
tmpfs                    91624        32     91592   0% /dev
/dev/block/mtdblock5     95232      1688     93544   2% /cache
/dev/block/mtdblock4    174080    133716     40364  77% /system
/dev/block/mtdblock6    170624     12340    158284   7% /data

/data is mounted and this seems to be where settings are stored.
 Open settings using sqlite3

/system/bin # ./sqlite3 /data/data/ 
SQLite version 3.6.22
Enter ".help" for instructions
sqlite> .dump
CREATE TABLE android_metadata (locale TEXT);
INSERT INTO "android_metadata" VALUES('en_AU');
INSERT INTO "system" VALUES(4,'volume_voice','4');
INSERT INTO "system" VALUES(5,'volume_alarm','6');
INSERT INTO "system" VALUES(6,'volume_notification','5');
INSERT INTO "system" VALUES(7,'volume_bluetooth_sco','7');
INSERT INTO "system" VALUES(9,'vibrate_on','6');
INSERT INTO "system" VALUES(10,'mode_ringer_streams_affected','166');
INSERT INTO "system" VALUES(11,'mute_streams_affected','46');
INSERT INTO "system" VALUES(12,'dim_screen','1');
INSERT INTO "system" VALUES(13,'stay_on_while_plugged_in','0');
INSERT INTO "system" VALUES(14,'screen_off_timeout','60000');
INSERT INTO "system" VALUES(15,'emergency_tone','0');
INSERT INTO "system" VALUES(16,'call_auto_retry','0');
INSERT INTO "system" VALUES(17,'dtmf_tone_type','0');
INSERT INTO "system" VALUES(18,'hearing_aid','0');
INSERT INTO "system" VALUES(19,'tty_mode','0');
INSERT INTO "system" VALUES(20,'airplane_mode_on','0');
INSERT INTO "system" VALUES(21,'airplane_mode_radios','cell,bluetooth,wifi');
INSERT INTO "system" VALUES(22,'airplane_mode_toggleable_radios','wifi');
INSERT INTO "system" VALUES(23,'auto_time','1');
INSERT INTO "system" VALUES(24,'screen_brightness','77');
INSERT INTO "system" VALUES(25,'screen_brightness_mode','0');
INSERT INTO "system" VALUES(26,'window_animation_scale','0.0');
INSERT INTO "system" VALUES(27,'transition_animation_scale','0.0');
INSERT INTO "system" VALUES(28,'accelerometer_rotation','1');
INSERT INTO "system" VALUES(29,'haptic_feedback_enabled','1');
INSERT INTO "system" VALUES(30,'end_button_behavior','1');
INSERT INTO "system" VALUES(31,'notification_light_pulse','1');
INSERT INTO "system" VALUES(32,'set_install_location','0');
INSERT INTO "system" VALUES(33,'default_install_location','0');
INSERT INTO "system" VALUES(34,'power_sounds_enabled','1');
INSERT INTO "system" VALUES(35,'low_battery_sound','/system/media/audio/ui/LowBattery.ogg');
INSERT INTO "system" VALUES(36,'dock_sounds_enabled','0');
INSERT INTO "system" VALUES(37,'desk_dock_sound','/system/media/audio/ui/Dock.ogg');
INSERT INTO "system" VALUES(38,'desk_undock_sound','/system/media/audio/ui/Undock.ogg');
INSERT INTO "system" VALUES(39,'car_dock_sound','/system/media/audio/ui/Dock.ogg');
INSERT INTO "system" VALUES(40,'car_undock_sound','/system/media/audio/ui/Undock.ogg');
INSERT INTO "system" VALUES(41,'lockscreen_sounds_enabled','0');
INSERT INTO "system" VALUES(42,'lock_sound','/system/media/audio/ui/Lock.ogg');
INSERT INTO "system" VALUES(43,'unlock_sound','/system/media/audio/ui/Unlock.ogg');
INSERT INTO "system" VALUES(44,'vibrate_in_silent','1');
INSERT INTO "system" VALUES(47,'alarm_alert','content://media/internal/audio/media/5');
INSERT INTO "system" VALUES(48,'notification_sound','content://media/internal/audio/media/28');
INSERT INTO "system" VALUES(49,'ringtone','content://media/internal/audio/media/55');
INSERT INTO "system" VALUES(57,'volume_system','0');
INSERT INTO "system" VALUES(58,'volume_system_last_audible','7');
INSERT INTO "system" VALUES(59,'volume_ring','0');
INSERT INTO "system" VALUES(60,'volume_ring_last_audible','1');
INSERT INTO "system" VALUES(61,'mode_ringer','1');
INSERT INTO "system" VALUES(62,'volume_music','10');
INSERT INTO "system" VALUES(63,'volume_music_last_audible','10');
INSERT INTO "system" VALUES(75,'next_alarm_formatted','');
DELETE FROM sqlite_sequence;
INSERT INTO "sqlite_sequence" VALUES('system',75);
INSERT INTO "sqlite_sequence" VALUES('secure',25);
INSERT INTO "sqlite_sequence" VALUES('systemex',1);
INSERT INTO "secure" VALUES(1,'bluetooth_on','0');
INSERT INTO "secure" VALUES(2,'data_roaming','0');
INSERT INTO "secure" VALUES(3,'default_input_method','');
INSERT INTO "secure" VALUES(4,'enabled_input_methods','com.huawei.inputmethod.hwpal/');
INSERT INTO "secure" VALUES(5,'install_non_market_apps','0');
INSERT INTO "secure" VALUES(6,'location_providers_allowed','gps');
INSERT INTO "secure" VALUES(7,'assisted_gps_enabled','1');
INSERT INTO "secure" VALUES(8,'network_preference','1');
INSERT INTO "secure" VALUES(9,'usb_mass_storage_enabled','1');
INSERT INTO "secure" VALUES(10,'wifi_on','0');
INSERT INTO "secure" VALUES(11,'wifi_networks_available_notification_on','1');
INSERT INTO "secure" VALUES(12,'preferred_network_mode','0');
INSERT INTO "secure" VALUES(13,'cdma_cell_broadcast_sms','1');
INSERT INTO "secure" VALUES(14,'preferred_cdma_subscription','0');
INSERT INTO "secure" VALUES(15,'mock_location','0');
INSERT INTO "secure" VALUES(16,'backup_enabled','1');
INSERT INTO "secure" VALUES(17,'backup_transport','');
INSERT INTO "secure" VALUES(18,'mount_play_not_snd','1');
INSERT INTO "secure" VALUES(19,'mount_ums_autostart','0');
INSERT INTO "secure" VALUES(20,'mount_ums_prompt','1');
INSERT INTO "secure" VALUES(21,'mount_ums_notify_enabled','1');
INSERT INTO "secure" VALUES(22,'android_id','9774d56d682e549c');
INSERT INTO "secure" VALUES(23,'adb_enabled','0');
INSERT INTO "secure" VALUES(24,'voice_recognition_service','');
INSERT INTO "secure" VALUES(25,'throttle_reset_day','3');
CREATE TABLE bluetooth_devices (_id INTEGER PRIMARY KEY,name TEXT,addr TEXT,channel INTEGER,type INTEGER);
CREATE TABLE bookmarks (_id INTEGER PRIMARY KEY,title TEXT,folder TEXT,intent TEXT,shortcut INTEGER,ordering INTEGER);
INSERT INTO "bookmarks" VALUES(1,'Browser',NULL,'#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;;end',98,NULL);
INSERT INTO "bookmarks" VALUES(2,'Contacts',NULL,'#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;;end',99,NULL);
INSERT INTO "bookmarks" VALUES(3,'Email',NULL,'#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;;end',101,NULL);
INSERT INTO "bookmarks" VALUES(4,'Gmail',NULL,'#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;;end',103,NULL);
INSERT INTO "bookmarks" VALUES(5,'Calendar',NULL,'#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;;end',108,NULL);
INSERT INTO "bookmarks" VALUES(6,'Music',NULL,'#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;;end',112,NULL);
INSERT INTO "bookmarks" VALUES(7,'Messaging',NULL,'#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;;end',115,NULL);
INSERT INTO "systemex" VALUES(1,'white_languages','en_PK,en_AU,en_US,es_ES');
CREATE INDEX systemIndex1 ON system (name);
CREATE INDEX secureIndex1 ON secure (name);
CREATE INDEX bookmarksIndex1 ON bookmarks (folder);
CREATE INDEX bookmarksIndex2 ON bookmarks (shortcut);
CREATE INDEX systemexIndex1 ON systemex (name);

I wonder what INSERT INTO "secure" VALUES(23,'adb_enabled','0'); is?

I think I want to try this to turn USB Debugging on (based on

update secure set value=1 where name='adb_enabled';

So here goes...

/system/bin # ./sqlite3 /data/data/

sqlite> select * from secure;

Reboot phone.

No good.

I then installed CyanogenMod 7 for Huewei IDEOS 8150.

It supports adb so I should have done this ages ago.

I wrote this bash script to begin phone setup without a touchscreen.


    local -i _a=$1 _k=$2 _v=$3
    printf "$FUNCNAME: _a=%d  _k=%d  _v=%d\n" $_a $_k $_v
    adb shell sendevent "/dev/input/event2" $_a $_k $_v

    local -i _a=$1 _x=$2 _y=$3 _w=$4
    #printf "$FUNCNAME: _a=%d  _x=%d  _y=%d  _w=%d\n" $_a $_x $_y $_w
    # send touch event x y
    adb_sendevent 3 0x39 $_a  # start event?
    adb_sendevent 3 0x35 $_x
    adb_sendevent 3 0x36 $_y
    adb_sendevent 3 0x30 $_w  # finger width?
    adb_sendevent 3 0x31 0  # x moved?
    adb_sendevent 3 0x34 0
    adb_sendevent 3 0x32 0  # y moved?
    adb_sendevent 0 0x02 0  # end event?

    local -i _x=$1 _y=$2 _w=$3
    #adb_sendevent 0 0 0
    adb_touch1 0 $_x $_y   $_w
    adb_touch1 1 0   0x15b 0
    adb_sendevent 0 0 0

    local -i _x=$1 _y=$2
    adb_touch $_x $_y 0x20
    # android icon selected
    adb_touch $_x $_y 0

#1 -->  "KEYCODE_MENU" 
#3 -->  "KEYCODE_HOME" 
#4 -->  "KEYCODE_BACK" 
#5 -->  "KEYCODE_CALL" 
#7 -->  "KEYCODE_0" 
#8 -->  "KEYCODE_1" 
#9 -->  "KEYCODE_2" 
#10 -->  "KEYCODE_3" 
#11 -->  "KEYCODE_4" 
#12 -->  "KEYCODE_5" 
#13 -->  "KEYCODE_6" 
#14 -->  "KEYCODE_7" 
#15 -->  "KEYCODE_8" 
#16 -->  "KEYCODE_9" 
#17 -->  "KEYCODE_STAR" 
#18 -->  "KEYCODE_POUND" 
#19 -->  "KEYCODE_DPAD_UP" 
#26 -->  "KEYCODE_POWER" 
#27 -->  "KEYCODE_CAMERA" 
#28 -->  "KEYCODE_CLEAR" 
#29 -->  "KEYCODE_A" 
#30 -->  "KEYCODE_B" 
#31 -->  "KEYCODE_C" 
#32 -->  "KEYCODE_D" 
#33 -->  "KEYCODE_E" 
#34 -->  "KEYCODE_F" 
#35 -->  "KEYCODE_G" 
#36 -->  "KEYCODE_H" 
#37 -->  "KEYCODE_I" 
#38 -->  "KEYCODE_J" 
#39 -->  "KEYCODE_K" 
#40 -->  "KEYCODE_L" 
#41 -->  "KEYCODE_M" 
#42 -->  "KEYCODE_N" 
#43 -->  "KEYCODE_O" 
#44 -->  "KEYCODE_P" 
#45 -->  "KEYCODE_Q" 
#46 -->  "KEYCODE_R" 
#47 -->  "KEYCODE_S" 
#48 -->  "KEYCODE_T" 
#49 -->  "KEYCODE_U" 
#50 -->  "KEYCODE_V" 
#51 -->  "KEYCODE_W" 
#52 -->  "KEYCODE_X" 
#53 -->  "KEYCODE_Y" 
#54 -->  "KEYCODE_Z" 
#55 -->  "KEYCODE_COMMA" 
#56 -->  "KEYCODE_PERIOD" 
#57 -->  "KEYCODE_ALT_LEFT" 
#61 -->  "KEYCODE_TAB" 
#62 -->  "KEYCODE_SPACE" 
#63 -->  "KEYCODE_SYM" 
#66 -->  "KEYCODE_ENTER" 
#67 -->  "KEYCODE_DEL" 
#68 -->  "KEYCODE_GRAVE" 
#69 -->  "KEYCODE_MINUS" 
#70 -->  "KEYCODE_EQUALS" 
#76 -->  "KEYCODE_SLASH" 
#77 -->  "KEYCODE_AT" 
#78 -->  "KEYCODE_NUM" 
#80 -->  "KEYCODE_FOCUS" 
#81 -->  "KEYCODE_PLUS" 
#82 -->  "KEYCODE_MENU" 
#84 -->  "KEYCODE_SEARCH" 

adb_tap 0x70 0x80  # tap on android icon
adb shell input keyevent 20  # down to 'Create'
adb shell input keyevent 20  # down to 'Sign in'
adb shell input keyevent 23  # enter
adb shell input text ''
adb shell input keyevent 20  # down to 'password'
adb shell input text 'password or 2-factor code'  # 2-factor pw
adb shell input keyevent 23  # enter
adb shell input keyevent 20  # down to 'Sign in'
adb shell input keyevent 23  # enter
My phone is now setup and working.

Now to setup WiFi.