<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/stylesheet.xsl"?>

<page	name="MotoBackup - Backup your Motorola cellphone"
	author="Hugh Sparks"
	date="Oct 25, 2005"
	version="1.8"
	xmlns="http://www.csparks.com/XMLWithoutTears"
>

<!-- ********************************************************************* -->
<s name="Introduction">
<!-- ********************************************************************* -->

	<p>
	I wanted a simple program to backup, restore and maintain the
	phonebook in my Motorola V60c. I tried several freely available
	programs, but none worked for me. After searching in
	vain all over the Web for documentation on the command set,
	I painfully resorted to thinking. 
	</p>
	
	<p>
	The results are here: a simple pair of programs to backup
	and restore your phonebook. <i>MotoBackup</i> will read
	all the phonebook entries in your phone and write them
	to an XML file. The <i>MotoRestore</i> program will read
	this file and restore the entries to your phone.
	</p>

	<p>
	Over a period of years, the program has been evolved and
	updated to support most of the Motorola V-series phones.
	</p>
</s>

<!-- ********************************************************************* -->
<s name="Downloads">
<!-- ********************************************************************* -->

	<p>
	Unless you have a special problem, you will want to download
	the most recent version of the program. This web page aways
	documents the features found in the most recent version. The
	<link name="change log" url="ChangeLog.txt"/>
	explains the differences between the versions. 
	</p>
	
	<p>
	<link name="Older versions" url="/V60Backup/index.xml"/><cr/><cr/>
	<link name="Windows version 1.7" url="MotoBackup-1.7.zip"/><cr/><cr/>
	<link name="Windows version 1.8" url="MotoBackup-1.8.zip"/><cr/><cr/>
	</p>

</s>
	
<!-- ********************************************************************* -->
<s name="Using the programs">
<!-- ********************************************************************* -->

<ss name="Finding your phone">
	<p>
	Configuring and using <i>MotoBackup</i> and <i>MotoRestore</i> is
	very easy. Getting your computer to talk to the phone on a serial
	port is the hard part. There are two more or less difficult steps
	involved: 1) Installing and configuring the driver. (Serial, USB,
	or Bluetooth.)
	2) <link
		name="Figuring out which port" 
		url="/MotoBackup/FindingThePhone.xml"
	/>
	is connected to the
	phone. If these ideas are very familiar to you and you already
	know the port and speed settings, simply continue to the next
	section. The links above cover these issues in greater depth. 
	</p>

	<p>
	<i>Note:</i> You must disconnect any terminal emulator you may
	have used to find the phone before running the backup or restore
	programs.
	</p>

</ss>

<ss name="Configuring and running MotoBackup">
	<p>
	I will assume that you've got the phone connected to the
	computer and that you know which port and baud rate settings
	are appropriate.
	</p>
	
	<p>
	To test your connection and parameters for the first time,
	try running the program from a Command Window. Open the 
	Windows command window and navigate to the directory where
	you put <i>MotoBackup.exe.</i> 
	</p>
	
	<p>
	Run the program by typing a command of this form:
	<code><![CDATA[
	MotoBackup fileName serialPort baudRate]]></code>
	</p>
	
	<p>
	For example, my Bluetooth connection appears on COM3,
	so I would use this line:
	<code><![CDATA[
	MotoBackup Phonebook.xml com3: 115200 ]]></code>
	</p>

	<p>
	In each example, please note the colon at the end of the
	comm port specification: It is a required part of the name.
	</p>
		
	<p>
	If you have a serial cable connected to com port 1
	on the back of your computer, you would use:
	<code><![CDATA[
	MotoBackup Phonebook.xml com1: 19200 ]]></code>
	</p>
	
	<p>
	Actually, the previous example would work correctly
	with no parameters because the values shown are the
	defaults.
	</p>
	
	<p>
	When you run the program, the following sequence of
	displays will occur:
	</p>
	
	<picture name="Contacting the phone" url="Backup-1-ContactPhone.jpg"/><cr/>
	<picture name="Reading the phone entries" url="Backup-2-ReadPhone.jpg"/><cr/>
	<picture name="Writing the phonebook file" url="Backup-3-WriteFile.jpg"/><cr/>
	
	<p>
	If there is a configuration problem, the program will probably timeout
	trying to contact the phone. If this occurs, review the previous
	sections and pages on drivers, locating, and testing the connection.
	</p>

</ss>
	
<ss name="Using a shortcut">

	<p>
	Most users will need to specify parameters. It is best to create a shortcut
	that runs the program with the required parameters automatically.
	To do this, right-click on the MotoBackup.exe program icon and select
	<i>Create Shortcut.</i> A new file will appear called "Shortcut to MotoBackup.exe".
	Right-click on the shortcut and select <i>Properties.</i> A dialog window will
	appear. Select the "Shortcut" tab:
	</p>
	
	<picture name="Example shortcut configuration" url="Shortcut.jpg"/>

	<p>
	In the editable text box for the <i>Target</i> you will see the full path to the
	MotoBackup.exe program on your machine. To specify values for the parameters,
	just add them to the end of this string as shown in the example above.
	</p>

</ss>

<ss name="MotoRestore">
	<p>
	When you run MotoRestore, it will try to open the file Phonebook.xml
	in the directory where the program is located and write all the entries 
	to the phone. 
	</p>

	<p>
	You can also test MotoRestore from the command line. The procedure
	and parameters are exactly the same as those shown above for 
	<i>MotoBackup.</i>
	</p>

	<p>
	You can drag-n-drop any previously created phonebook.xml file
	on top of your MotoRestore shortcut. It will copy the entries
	to the phone and exit automatically.
	</p>

	<p>
	When <i>MotoRestore</i> runs successfully, the following sequence
	of displays will occur:
	</p>
	
	<picture name="Contacting the phone" url="Backup-1-ContactPhone.jpg"/><cr/>
	<picture name="Backup the phone entries" url="Restore-1-BackupPhone.jpg"/><cr/>
	<picture name="Write new entries to the phone" url="Restore-2-WritePhone.jpg"/><cr/>
	<picture name="Erase unused entries in the phone" url="Restore-3-EraseEntries.jpg"/>
	
</ss>
</s>

<s name="Viewing the phonebook file">
	<p>
	The Phonebook.xml file has an associated stylesheet Phonebook.xsl.
	If you have a recent web browser, you can simply double-click on the
	Phonebook.xml file and a neatly sorted and formatted web page will
	appear in your browser window.
	</p>
	
	<p>
	The Phonebook.xsl stylesheet needs to be in the same directory with
	your Phonebook.xml file for the browser to work properly.
	</p>
</s>

<s name="Editing the phonebook file">
	<p>
	The Phonebook.xml file may be edited using any plain-text editor
	such as Windows Notepad or Linux "vi". If you modify the phonebook
	file using a structured editor such as Microsoft Word, it will be
	ruined.
	</p>
</s>

<s name="Copying and merging entries">
	<p>
	The Phonebook.xml file contains entries that have an index number.
	The entries in the phone also have an index number: you see it as
	the speed-dial number.
	</p>
	<p>
	If you have only added entries to the phone, the index numbers 
	will be 1,2,...,N where N is the number of entries in the phone.
	The next entry you add will have the number N+1.
	</p>
	<p>
	When you delete an entry from the phone, the entry number is
	"free": The next time you add an entry, this free number will
	be used. (If you are a software type, think of the phonebook
	as an array indexed by entry number.)
	</p>
 	<p>
	When you run MotoRestore, the entries in the file replace entries 
	in the phone that have the same number. If you add entries to the
	file with new index numbers, MotoRestore will add them to the phone.
	When editing the file by hand, it is easiest to add new entries at
	the end, simply incrementing the index found in the previous entry.
	It does no harm if a few free numbers go unused. The phone will
	display the entries in alphabetical order no matter how the entries
	are numbered.	
	</p>
	<p>
	The MotoRestore program is very picky about the phonebook file format.
	If you edit the phonebook and the program complains, try viewing the
	file with your web browser. It will tell you where to look for any
	syntax errors.
	</p>
</s>

<!-- ********************************************************************* -->
<s name="Problems">
<!-- ********************************************************************* -->
	
<ss name="The program can't talk to the phone">

	<p>
	If MotoBackup doesn&apos;t work at all, you need to
	<link
		name=" use the terminal emulator"
		url="/MotoBackup/FindingThePhone.xml"
	/>
	to find the phone and port settings.
	</p>
	
	<p>
	Sometimes it helps to reconnect the USB cable or re-install the
	USB serial driver. Bluetooth radio configuration is particularly
	aggravating and beyond the scope of this introduction.
	</p>
			
	<p>
	Note 1: I suspect that the phone "learns" what baud rate
	to use by the first character to arrive on the input
	port after it powers up. Your phone my get into a bad mood
	if you try to connect again at a lower rate.
	</p>

	<p>
	Note 2: The backup and restore programs will not work while the
	terminal emulator is connected to the phone.
	</p>
	
	<p>
	Note 3: The designers of Microsoft Windows could not conceive
	of machines with more than 9 serial ports. As a consequence,
	you cannot use conventional port names beyond COM9: <cr/>
	To deal with this oversight, newer versions of windows require
	the following notation for port numbers beyond 9:
	</p>
	
	<code><![CDATA[
	\\.\COM10
	\\.\COM11
	\\.\COM12
	...
	etc. ]]></code>
	
	<p>
	Note that these bizarre names do not end with a colon.
	</p>
	
</ss>

<ss name="Getting rid of extra virtual modems">
	<p>
	USB and Bluetooth connections create virtual modems that
	like to change their numbers every time you connect your
	phone. Consequently, you may find that you now have 10 or more
	more com ports even if  you only own one device.
	</p>
	
	<p>
	I&apos;m not entirely sure about how to avoid this problem because
	I&apos;m always experimenting with phones and other devices. It 
	may help to always use the same USB port when connecting your phone.
	</p>
	
	<p>
	To clean up your superfluous ports, follow these steps:<cr/>
	Disconnect your USB cable from the phone. If you use a Bluetooth
	connection, delete the whole device using the Bluetooth control
	panel or task bar icon.
	</p>
	
	<p>
	Open the Phone and Modems control panel, select the Modems tab
	and delete all your extra modems. You&apos;ll want to keep your hardware
	serial ports COM1: and COM2: and any real modem ports you've added
	to your computer.
	</p>
	
	<p>
	For Bluetooth phones, re-pair your phone using the Add Device
	procedure on the Bluetooth control panel. You will automagically
	get a new com port with a nice low number.
	</p>
	
	<p>
	For USB phones, connect the cable. The New Hardware wizard dialog
	will appear. Select the defaults and your old driver will be re-intstalled.
	At this point, I find that I need to disconnect and re-connect the
	cable again to get the modem to be visible to Hyperterminal and
	MotoBackup. It will now have a new low port number.
	</p>
	
</ss>

<ss name="MotoRestore hangs up or reports an error during restore">

	<p>
	Certain characters cannot be used in phonebook entries.
	This is becuase of the simple-minded XML parser used by
	the program.
	</p>
	
	<p>
	The program especially <i>hates</i> to see these characters 
	in phonebook names or numbers:
	<code><![CDATA[
	<	Less than
	>	Greater than
	&	Ampersand
	'	Apostrophe
	"	Quotation mark
	,	Comma ]]></code>
	</p>
	
	<p>
	I plan to fix this problem <i>Real Soon Now.&#153;</i>
	</p>
	
	<p> In the mean time, if your phonebook.xml file won't restore
	properly, pay attention to the integer displayed by the progress
	indicator when running MotoRestore. When it fails, fire up a
	<i>plain text editor</i> and search around the entry with the
	offending index number. You will find a forbidden character or
	a truncated entry with no trailing quotation mark around the value.
	Fix this, save the file and try to restore the phonebook again.
	</p>
</ss>

<ss name="Voice-recognition numbers no longer work after using MotoRestore">
	<p>
	This is a limitation imposed by the phone designers: There is no
	way (as far as I know) to save and restore the voice recordings
	used to recognize spoken names.
	</p>
	
	<p>
	The recordings are associated with small integers in the internal
	representation of the phonebook. But the phone will not allow 
	phonebook entries to be restored if these recordings are referenced
	but not present on the phone. This will be the case when a phonebook
	is restored to a new or accidentally erased phone.
	</p>
	
	<p>
	Since this is the primary purpose of MotoBackup and MotoRestore, the only
	alternative was to drop the references to voice recordings. Until I think
	of a better way, you&apos;ll have to re-record them after a restore.
	</p>
</ss>

<ss name="Using the program with other phones">

	<p>
	So far, I've had good luck with all the Motorola
	V-Series phones. Each time I get a new phone, I've had
	to tweak the software a bit because my understanding of
	the protocol has come from trial and error. Other
	users of the program have also contributed many
	discoveries.
	</p>

	<p>
	The following phones are known or reported to work:<code><![CDATA[
	V60c       - Works with a serial cable.
	V60i       - Reported to work.
	V60t       - Reported to work with USB.
	V66        - Reported to work.
	T730       - Works with Serial or USB
	V551       - Works with USB or Bluetooth
	V3 RAZR    - Works with USB or Bluetooth 
	V220       - Reported to work ]]></code>
	</p>

	<p>
	If you have success (or failure) with a different phone, please
	send me a note and I'll post your results here.
	</p>

</ss>

</s>

<!-- ********************************************************************* -->
<s name="How it works">
<!-- ********************************************************************* -->

<ss name="How the program talks to the phone">

	<p>
	The phones understand most of the Hayes modem "AT" commands.
	They can be configured to function as generic modems with
	Windows dialup networking.
	</p>
	
	<p>
	In addition, there are a bunch of "AT+" commands that operate
	the phonebook, datebook and many other features. <i>MotoBackup</i>
	and <i>MotoRestore</i> use these special AT+ commands to read
	and write the internal phonebook entries.
	</p>

	<p>
	You can read more here on 
	<link 	name="how the serial commands operate the phone."
		url="MotorolaAT.xml"/>
	</p>
</ss>

<ss name="What's in the phonebook file">
	<p>
	The phonebook file is a simple XML document. You can examine 
	or modify it using any plain-text editor. The parser used
	by <i>MotoRestore</i> is not very smart so you can easily
	break the file by adding white space and comments even if it
	remains formally correct XML.
	</p>
</ss>
</s>

<s name="Comments and suggestions">
	<p>	
	<link	name="Contact me."
		url="mailto:hugh@csparks.com"/>
	</p>
</s>

</page>

