[flashrom] [commit] r1665 - trunk

repository service svn at flashrom.org
Mon Apr 1 02:46:05 CEST 2013


Author: stefanct
Date: Mon Apr  1 02:46:05 2013
New Revision: 1665
URL: http://flashrom.org/trac/flashrom/changeset/1665

Log:
Enable serprog on Windows.

Sockets are not ported (yet).

Tested on Windows 7 with my Atmega32U2 serprog implementation.
http://paste.flashrom.org/view.php?id=1566

Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
Signed-off-by: Idwer Vollering <vidwer at gmail.com>
Acked-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>

Modified:
   trunk/Makefile
   trunk/serprog.c

Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile	Mon Apr  1 02:45:57 2013	(r1664)
+++ trunk/Makefile	Mon Apr  1 02:46:05 2013	(r1665)
@@ -143,12 +143,6 @@
 # libusb-win32/libftdi stuff is usually installed in /usr/local.
 CPPFLAGS += -I/usr/local/include
 LDFLAGS += -L/usr/local/lib
-# Serprog is not supported under Windows/MinGW (missing sockets support).
-ifeq ($(CONFIG_SERPROG), yes)
-UNSUPPORTED_FEATURES += CONFIG_SERPROG=yes
-else
-override CONFIG_SERPROG = no
-endif
 # For now we disable all PCI-based programmers on Windows/MinGW (no libpci).
 ifeq ($(CONFIG_INTERNAL), yes)
 UNSUPPORTED_FEATURES += CONFIG_INTERNAL=yes
@@ -334,7 +328,7 @@
 # Always enable internal/onboard support for now.
 CONFIG_INTERNAL ?= yes
 
-# Always enable serprog for now. Needs to be disabled on Windows.
+# Always enable serprog for now.
 CONFIG_SERPROG ?= yes
 
 # RayeR SPIPGM hardware support

Modified: trunk/serprog.c
==============================================================================
--- trunk/serprog.c	Mon Apr  1 02:45:57 2013	(r1664)
+++ trunk/serprog.c	Mon Apr  1 02:46:05 2013	(r1665)
@@ -20,21 +20,23 @@
  */
 
 #include <stdio.h>
+#ifndef _WIN32 /* stuff (presumably) needed for sockets only */
 #include <stdlib.h>
 #include <unistd.h>
-#include <strings.h>
-#include <string.h>
-#include <ctype.h>
 #include <fcntl.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
 #include <netdb.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <inttypes.h>
+#endif
+#ifdef _WIN32
+#include <conio.h>
+#else
 #include <termios.h>
+#endif
+#include <string.h>
+#include <errno.h>
 #include "flash.h"
 #include "programmer.h"
 #include "chipdrivers.h"
@@ -81,6 +83,7 @@
 	whether the command is supported before doing it */
 static int sp_check_avail_automatic = 0;
 
+#ifndef WIN32
 static int sp_opensocket(char *ip, unsigned int port)
 {
 	int flag = 1;
@@ -114,6 +117,7 @@
 	setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int));
 	return sock;
 }
+#endif
 
 /* Synchronize: a bit tricky algorithm that tries to (and in my tests has *
  * always succeeded in) bring the serial protocol to known waiting-for-   *
@@ -351,6 +355,7 @@
 	}
 	free(device);
 
+#ifndef _WIN32
 	device = extract_programmer_param("ip");
 	if (have_device && device) {
 		msg_perr("Error: Both host and device specified.\n"
@@ -394,6 +399,7 @@
 			 "flashrom -p serprog:ip=ipaddr:port\n");
 		return 1;
 	}
+#endif
 
 	if (register_shutdown(serprog_shutdown, NULL))
 		return 1;




More information about the flashrom mailing list