Hi,

the DediProg firmware version 5.1.5 of the SF-100 works just fine. Also
I've added error handling for the initial USB command to catch -EPERM
errors.

This version allows any firmware version from 2.x.y to 5.x.y, as
suggested by Carl Daniel.

Signed-off-by: Mathias Krause <[email protected]>

Regards,
Mathias
Index: dediprog.c
===================================================================
--- dediprog.c	(Revision 1216)
+++ dediprog.c	(Arbeitskopie)
@@ -17,6 +17,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
+#include <stdio.h>
 #include <string.h>
 #include <usb.h>
 #include "flash.h"
@@ -191,6 +192,7 @@
 static int dediprog_check_devicestring(void)
 {
 	int ret;
+	int fw[3];
 	char buf[0x11];
 
 	/* Command Prepare Receive Device String. */
@@ -215,10 +217,13 @@
 		msg_perr("Device not a SF100!\n");
 		return 1;
 	}
+	if (sscanf(buf, "SF100 V:%d.%d.%d ", &fw[0], &fw[1], &fw[2]) != 3) {
+		msg_perr("Unexpected firmware version string!\n");
+		return 1;
+	}
 	/* Only these versions were tested. */
-	if (memcmp(buf, "SF100   V:2.1.1 ", 0x10) &&
-	    memcmp(buf, "SF100   V:3.1.8 ", 0x10)) {
-		msg_perr("Unexpected firmware version!\n");
+	if (fw[0] < 2 || fw[0] > 5) {
+		msg_perr("Unexpected firmware version %d.%d.%d!\n", fw[0], fw[1], fw[2]);
 		return 1;
 	}
 	return 0;
@@ -235,6 +240,10 @@
 
 	memset(buf, 0, sizeof(buf));
 	ret = usb_control_msg(dediprog_handle, 0xc3, 0xb, 0x0, 0x0, buf, 0x1, DEFAULT_TIMEOUT);
+	if (ret < 0) {
+		msg_perr("Command A failed (%s)!\n", usb_strerror());
+		return 1;
+	}
 	if ((ret != 0x1) || (buf[0] != 0x6f)) {
 		msg_perr("Unexpected response to Command A!\n");
 		return 1;
_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to