Index: /trunk/Serial_Server/library/Process.cpp
===================================================================
--- /trunk/Serial_Server/library/Process.cpp	(revision 209)
+++ /trunk/Serial_Server/library/Process.cpp	(revision 210)
@@ -51,4 +51,25 @@
 #define SERIAL_INQUIRE_PORTANDBAUD_PORT 0xfc
 
+void logBuff( char *message, unsigned long buffoffset, unsigned long readto, int verboseLevel )
+{
+	char logBuff[ 514*9 + 10 ];
+	int logCount;
+
+	if( verboseLevel == 6 || (verboseLevel >= 4 && buffoffset == readto) )
+	{
+		if( verboseLevel == 4 && buffoffset > 11 )
+			logCount = 11;
+		else
+			logCount = buffoffset;
+
+		for( int t = 0; t < logCount; t++ )
+			sprintf( &logBuff[t*9], "[%3d:%02x] ", t, buff.b[t] );
+		if( logCount != buffoffset )
+			sprintf( &logBuff[logCount*9], "... " );
+
+		log( 4, "%s%s", message, logBuff );
+	}
+}
+
 void processRequests( Serial *serial, Image *image0, Image *image1, int timeoutEnabled, int verboseLevel )
 {
@@ -56,5 +77,5 @@
 	int workOffset, workCount;
 
-	int vtype;
+	int vtype = 0;
 
 	unsigned long mylba;
@@ -68,4 +89,5 @@
 	Image *img;
 	unsigned long cyl, sect, head;
+	unsigned long perfTimer;
 
 	GetTime_Timeout_Local = GetTime_Timeout();
@@ -81,24 +103,9 @@
 		buffoffset += len;
 
+		//
+		// For debugging, look at the incoming packet
+		//
 		if( verboseLevel >= 4 )
-		{
-			char logBuff[ 514*9 + 10 ];
-			int logCount;
-
-			if( verboseLevel == 6 || buffoffset == readto )
-			{
-				if( verboseLevel == 4 && buffoffset > 11 )
-					logCount = 11;
-				else
-					logCount = buffoffset;
-
-				for( int t = 0; t < logCount; t++ )
-					sprintf( &logBuff[t*9], "[%3d:%02x] ", t, buff.b[t] );
-				if( logCount != buffoffset )
-					sprintf( &logBuff[logCount*9], "... " );
-
-				log( 4, logBuff );
-			}
-		}
+			logBuff( "    Received: ", buffoffset, readto, verboseLevel );
 
 		timeout = 0;
@@ -117,4 +124,7 @@
 		lasttick = GetTime();
 
+		// 
+		// No work currently to do, look at each character as they come in...
+		//
 		if( buffoffset == 1 && !readto )
 		{
@@ -125,14 +135,21 @@
 			else if( (buff.b[0] & SERIAL_COMMAND_HEADERMASK) == SERIAL_COMMAND_HEADER )
 			{
+				//
+				// Found our command header byte to start a commnad sequence, read the next 7 and evaluate
+				//
 				readto = 8;
+				continue;
 			}
 			else
 			{
+				//
+				// Spurious characters, discard
+				//
 				if( verboseLevel >= 2 )
 				{
 					if( buff.b[0] >= 0x20 && buff.b[0] <= 0x7e )
-						log( 3, "[%d:%c]", buff.b[0], buff.b[0] );
+						log( 3, "Spurious: [%d:%c]", buff.b[0], buff.b[0] );
 					else
-						log( 3, "[%d]", buff.b[0] );
+						log( 3, "Spurious: [%d]", buff.b[0] );
 				}
 				buffoffset = 0;
@@ -141,5 +158,12 @@
 		}
 
-		// read 512 bytes from serial port - only one reason for that size: Write Sector
+		//
+		// Partial packet received, keep reading...
+		//
+		if( readto && buffoffset < readto )
+			continue;
+
+		//
+		// Read 512 bytes from serial port, only one command reads that many characters: Write Sector
 		//
 		if( buffoffset == readto && readto == 514 )
@@ -161,4 +185,7 @@
 			img->writeSector( &buff.w[0] );
 
+			//
+			// Echo back the CRC
+			//
 			if( serial->writeCharacters( &buff.w[256], 2 ) != 2 )
 				log( 1, "Serial Port Write Error" );
@@ -168,4 +195,5 @@
 		}
 
+		//
 		// 8 byte command received, or a continuation of the previous command
 		//
@@ -176,4 +204,7 @@
 			if( workCount )
 			{
+				//
+				// Continuation...
+				//
 				if( buff.b[0] != (workCount-0) )
 				{
@@ -185,4 +216,7 @@
 			else
 			{
+				//
+				// New Command...
+				//
 				if( (crc = checksum( &buff.w[0], 3 )) != buff.w[3] )
 				{
@@ -196,8 +230,10 @@
 					if( !image1 )
 					{
-						log( 2, "slave drive selected when not supplied" );
+						log( 2, "Slave drive selected when not supplied" );
+						img = NULL;
 						continue;
 					}
-					img = NULL;
+					else
+						img = image1;
 				}
 				else
@@ -231,17 +267,22 @@
 				workOffset = 0;
 				workCount = buff.chs.count;
+				if( verboseLevel > 1 && workCount > 100 )
+					perfTimer = GetTime();
 			}
 
 			if( workCount && (workCommand == (SERIAL_COMMAND_WRITE | SERIAL_COMMAND_READWRITE)) )
 			{
+				//
+				// Write command...   Setup to receive a sector
+				//
 				readto = 514;
 			}
 			else 
 			{
+				//
+				// Inquire command...
+				//
 				if( workCommand == SERIAL_COMMAND_INQUIRE )
 				{
-					log( 2, "Inquire Disk Information, Drive=%d", 
-						 (buff.inquire.driveAndHead & ATA_DriveAndHead_Drive) >> 4 );
-
 					if( serial->speedEmulation && 
 						(buff.inquire.portAndBaud & SERIAL_INQUIRE_PORTANDBAUD_BAUD) != serial->baudRate->divisor )
@@ -261,4 +302,7 @@
 					img->respondInquire( &buff.w[0], serial->baudRate, buff.inquire.portAndBaud );
 				}
+				//
+				// Read command...
+				//
 				else
 				{
@@ -270,29 +314,36 @@
 
 				if( serial->writeCharacters( &buff.w[0], 514 ) != 514 )
-				{
 					log( 1, "Serial Port Write Error" );
-				}
 
 				workCount--;
 				workOffset++;
 			}
-
-			if( verboseLevel > 1 )
-			{
-				if( vtype == 1 )
-					log( 2, "%s: LBA=%u, Count=%u", 
-						 (workCommand & SERIAL_COMMAND_WRITE ? "Write" : "Read"),
-						 mylba, workCount );
-				else if( vtype == 2 )
-					log( 2, "%s: Cylinder=%u, Sector=%u, Head=%u, Count=%u, LBA=%u", 
-						 (workCommand & SERIAL_COMMAND_WRITE ? "Write" : (workCommand & SERIAL_COMMAND_READWRITE ? "Read" : "Inquire")),
-						 cyl, sect, head, workCount, mylba );
-
-				vtype = 0;		  
-
-				if( workOffset > 1 )
-					log( 3, "       Offset=%u, Checksum=%04x", workOffset-1, buff.w[256] );				  
-			}
+		}
+
+		if( verboseLevel > 1 )
+		{
+			char *comStr = (workCommand & SERIAL_COMMAND_WRITE ? "Write" : 
+							(workCommand & SERIAL_COMMAND_READWRITE ? "Read" : "Inquire"));
+
+			if( vtype == 1 )
+				log( 2, "%s %d: LBA=%u, Count=%u", comStr, img == image0 ? 0 : 1,
+					 mylba, workCount );
+			else if( vtype == 2 )
+				log( 2, "%s %d: Cylinder=%u, Sector=%u, Head=%u, Count=%u, LBA=%u", comStr, img == image0 ? 0 : 1,
+					 cyl, sect, head, workCount+1, mylba );
+
+			vtype = 0;		  
+
+			if( workOffset > 1 )
+				log( 3, "    Continuation: Offset=%u, Checksum=%04x", workOffset-1, buff.w[256] );
+
+			if( !(workCommand & SERIAL_COMMAND_WRITE) && verboseLevel >= 4 )
+				logBuff( "    Sending: ", 514, 514, verboseLevel );
+
+			if( workCount == 0 && workOffset > 100 )
+				log( 2, "    Block Complete: %.2lf bytes per second", (512.0 * workOffset) / (GetTime() - perfTimer) * 1000.0 );
 		}
 	}
 }
+
+
Index: /trunk/Serial_Server/library/Serial.cpp
===================================================================
--- /trunk/Serial_Server/library/Serial.cpp	(revision 209)
+++ /trunk/Serial_Server/library/Serial.cpp	(revision 210)
@@ -17,5 +17,7 @@
 	{  19200, 0xff,  "19.2K",  "19K" }, 
 	{  38400,  0x2,  "38.4K",  "38K" }, 
+	{  76800,  0x2,  "76.8K",  "77K" },
 	{ 115200,  0x3, "115.2K", "115K" }, 
+	{ 153600,  0x3, "153.6K", "154K" },
 	{ 230400, 0xff, "230.4K", "230K" }, 
 	{ 460800,  0x1, "460.8K", "460K" }, 
