[HTC Desire S] BillGoss:
Help, I need some [body] help! (sung to the Beatles song "Help")

Here are the symptoms:

Flashing PG88IMG file that I've used before now says "Model ID incorrect"

The serial number is now some corrupted text (see last bullet point)

If I install a ROM (I'm using CM9) after formatting all partitions (using 4EXT Touch) plus GAPPS, then Play comes up with a "Server Error". Also TB will not properly reload its settings. So I basically can't install new ROMs cleanly anymore.

ADB (with latest HTC drivers) cannot see my device. Yes, USB Debug is on.

Running 'cat /proc/cmdline' shows CID is TELST001, but some corruption in other fields. If I write it out to a file, the file is full of Chinese characters (using ES Text editor)

androidboot.batt_poweron=good_bat`#ry

androidboot.mid=uA}f

androidboot.serialno=].&_

androidboot.cid=TELST001

When did this all start?

I discovered that I could create a flashable zip file for the boot.img (looking at the updater-script for the ROM zip file.

I tried to do the same for recovery, but it - obviously - didn't work.

So I tried to copy the recovery file over the partition from the terminal emulator.

And that's where I think I screwed up.

What's working?

I'm currently running CM9 0611 with no problems. I can recover previous backups with no issues. I can update my recovery partition with no problems.

How can I get my phone back to normal?

What is it that I've screwed up?

All help will be most thankfully accepted.

Edit: Solution

The corrupted mid and serialno were the cause of all my problems. Once I'd fixed them, everything was back to normal

Things that I had to learn on the way

ADB, RUU, PG88IMG will not work if you have corrupted carrier id (cid), model id (mid) or serial number. Having a goldcard makes no difference.

A goldcard lets you flash PG88IMG files even if your cid is not in the android-info.txt file in the zip.

The simplest way to create a goldcard is this described here: http://xdaforums.com/showpost.php?p=18748766&postcount=6

You can connect to ADB over WiFi. I needed this because my USB connection wouldn't work. Search for ADB Wifi in Google or Play. I used Wifi ADB. It worked like a charm. This allowed me to upgrade my hboot to an engineering version.

You need an engineering hboot (one that has the fastboot oem commands) to be able to set a serial number and model id. It took me a while to realise what the warning about it only working on an ENG hboot meant (see http://xdaforums.com/showthread.php?t=1724475). I assumed that ENG meant English!

Set /Settings/Developer options/Root access to allow ADB to run su commands

To run fasboot commands you have to be in bootloader! It took me quite a while to realize this. I kept trying fastboot commands when phone had booted normally

How I fixed the problem

Installed ADB WiFi. I sourced it from http://androiddev.orkitra.com/downl...7663795511&download=com.ttxapps.wifiadb_v1.17 because I couldn't download apps from Play.

Connected to the phone using ADB over WiFi.

Flashed the engineering hboot (sourced from http://xdaforums.com/showthread.php?t=1113820).

Rebooted into fastboot and executed the following commands:

fastboot oem writemid PG8810000

fastboot oem writeserialno xxxx (sourced from the number under the phone's battery)

Rebooted into Recovery and flashed a backed up ROM (I could have just wiped cache and dalvik)

Root Cause

I've finally discovered what caused the problem.

It was my writing to the recovery partition. I used this command:

dd if=<input file> of=</dev/block/mmcblk0p23

I got the information about partitions from http://xdaforums.com/showthread.php?t=1545911, but those are for an HTC Amaze and, I now know, they are incorrect for a Desire S!

Just goes to show what a bit of knowledge and some ignorance can do. I have yet to come across an accurate and complete list of the partitions for the HTC Desire S.