r1115 - trunk/src/host/dfu-util/src

laforge at sita.openmoko.org laforge at sita.openmoko.org
Sun Feb 25 16:43:06 CET 2007


Author: laforge
Date: 2007-02-25 16:43:05 +0100 (Sun, 25 Feb 2007)
New Revision: 1115

Modified:
   trunk/src/host/dfu-util/src/dfu.c
   trunk/src/host/dfu-util/src/dfu.h
Log:
add new dfu_status_to_string() function to stringify DFU_STATUS_* values


Modified: trunk/src/host/dfu-util/src/dfu.c
===================================================================
--- trunk/src/host/dfu-util/src/dfu.c	2007-02-25 15:18:34 UTC (rev 1114)
+++ trunk/src/host/dfu-util/src/dfu.c	2007-02-25 15:43:05 UTC (rev 1115)
@@ -374,3 +374,47 @@
 
     return message;
 }
+
+/* Chapter 6.1.2 */
+static const char *dfu_status_names[] = {
+	[DFU_STATUS_OK]			= "No error condition is present",
+	[DFU_STATUS_errTARGET]		= 
+		"File is not targeted for use by this device",
+	[DFU_STATUS_errFILE]		=
+		"File is for this device but fails some vendor-specific test",
+	[DFU_STATUS_errWRITE]		=
+		"Device is unable to write memory",
+	[DFU_STATUS_errERASE]		=
+		"Memory erase function failed",
+	[DFU_STATUS_errCHECK_ERASED]	=
+		"Memory erase check failed",
+	[DFU_STATUS_errPROG]		=
+		"Program memory function failed",
+	[DFU_STATUS_errVERIFY]		=
+		"Programmed emmory failed verification",
+	[DFU_STATUS_errADDRESS]		=
+		"Cannot program memory due to received address that is out of range",
+	[DFU_STATUS_errNOTDONE]		=
+		"Received DFU_DNLOAD with wLength = 0, but device does not think that it has all data yet",
+	[DFU_STATUS_errFIRMWARE]	=
+		"Device's firmware is corrupt. It cannot return to run-time (non-DFU) operations",
+	[DFU_STATUS_errVENDOR]		=
+		"iString indicates a vendor specific error",
+	[DFU_STATUS_errUSBR]		=
+		"Device detected unexpected USB reset signalling",
+	[DFU_STATUS_errPOR]		=
+		"Device detected unexpected power on reset",
+	[DFU_STATUS_errUNKNOWN]		=
+		"Something went wrong, but the device does not know what it was",
+	[DFU_STATUS_errSTALLEDPKT]	=
+		"Device stalled an unexpected request",
+};
+
+
+const char *dfu_status_to_string(int status)
+{
+	if (status > DFU_STATUS_errSTALLEDPKT)
+		return "INVALID";
+	return dfu_status_names[status];
+}
+

Modified: trunk/src/host/dfu-util/src/dfu.h
===================================================================
--- trunk/src/host/dfu-util/src/dfu.h	2007-02-25 15:18:34 UTC (rev 1114)
+++ trunk/src/host/dfu-util/src/dfu.h	2007-02-25 15:43:05 UTC (rev 1115)
@@ -97,5 +97,7 @@
 
 char* dfu_state_to_string( int state );
 
+const char *dfu_status_to_string(int status);
+
 int debug;
 #endif





More information about the commitlog mailing list