Only in avrdude-5.8.setdtr/: .serial.h.swp
Only in avrdude-5.8.setdtr/: .usb_libusb.c.swp
Only in avrdude-5.8.setdtr/: CALLCONV
Only in avrdude-5.8.orig/: ChangeLog
Only in avrdude-5.8.orig/: ChangeLog-2001
Only in avrdude-5.8.orig/: ChangeLog-2002
Only in avrdude-5.8.orig/: ChangeLog-2003
Only in avrdude-5.8.orig/: ChangeLog-2004-2006
Only in avrdude-5.8.setdtr/: Copy of ser_win32.c
Only in avrdude-5.8.setdtr/: FECT
Only in avrdude-5.8.setdtr/: LAGS
Only in avrdude-5.8.setdtr/: MT
Only in avrdude-5.8.setdtr/: NODE_TYPE
Only in avrdude-5.8.setdtr/: OAD_TYPE
Only in avrdude-5.8.setdtr/: REDUCE
Only in avrdude-5.8.setdtr/: TE
Only in avrdude-5.8.setdtr/: TENCY_TIME
Only in avrdude-5.8.setdtr/: _ACL_INFORMATION_CLASS
Only in avrdude-5.8.setdtr/: _exrc
diff -U5 -arp -x '*.o' -x '*.tmp' -x '*~' -x '*.exe' -x '*.a' -x Makefile -x '*.log' -x config.status -x config_gram.c -x lexer.c avrdude-5.8.orig/arduino.c avrdude-5.8.setdtr/arduino.c
--- avrdude-5.8.orig/arduino.c	2009-03-06 21:09:11 +0100
+++ avrdude-5.8.setdtr/arduino.c	2009-07-16 00:45:57 +0200
@@ -80,15 +80,34 @@ static int arduino_read_sig_bytes(PROGRA
   m->buf[2] = buf[3];
 
   return 3;
 }
 
+static int arduino_open(PROGRAMMER * pgm, char * port)
+{
+  strcpy(pgm->port, port);
+  serial_open(port, pgm->baudrate? pgm->baudrate: 115200, &pgm->fd, SEROPEN_FL_SETDTR | SEROPEN_FL_PULSERTS);
+
+  /*
+   * drain any extraneous input
+   */
+  stk500_drain(pgm, 0);
+
+  if (stk500_getsync(pgm) < 0)
+    return -1;
+
+  return 0;
+}
+
+
 void arduino_initpgm(PROGRAMMER * pgm)
 {
 	/* This is mostly a STK500; just the signature is read
-     differently than on real STK500v1 */
+     differently than on real STK500v1 
+     and the DTR signal is set when opening the serial port
+     for the Auto-Reset feature */
   stk500_initpgm(pgm);
 
   strcpy(pgm->type, "Arduino");
   pgm->read_sig_bytes = arduino_read_sig_bytes;
-
+  pgm->open = arduino_open;
 }
diff -U5 -arp -x '*.o' -x '*.tmp' -x '*~' -x '*.exe' -x '*.a' -x Makefile -x '*.log' -x config.status -x config_gram.c -x lexer.c avrdude-5.8.orig/avr910.c avrdude-5.8.setdtr/avr910.c
--- avrdude-5.8.orig/avr910.c	2009-03-06 21:09:11 +0100
+++ avrdude-5.8.setdtr/avr910.c	2009-07-14 19:20:01 +0200
@@ -381,11 +381,11 @@ static int avr910_open(PROGRAMMER * pgm,
   if(pgm->baudrate == 0) {
     pgm->baudrate = 19200;
   }
 
   strcpy(pgm->port, port);
-  serial_open(port, pgm->baudrate, &pgm->fd);
+  serial_open(port, pgm->baudrate, &pgm->fd, 0);
 
   /*
    * drain any extraneous input
    */
   avr910_drain (pgm, 0);
diff -U5 -arp -x '*.o' -x '*.tmp' -x '*~' -x '*.exe' -x '*.a' -x Makefile -x '*.log' -x config.status -x config_gram.c -x lexer.c avrdude-5.8.orig/butterfly.c avrdude-5.8.setdtr/butterfly.c
--- avrdude-5.8.orig/butterfly.c	2009-03-06 21:09:11 +0100
+++ avrdude-5.8.setdtr/butterfly.c	2009-07-14 19:20:46 +0200
@@ -354,11 +354,11 @@ static int butterfly_open(PROGRAMMER * p
    *  If baudrate was not specified use 19200 Baud
    */
   if(pgm->baudrate == 0) {
     pgm->baudrate = 19200;
   }
-  serial_open(port, pgm->baudrate, &pgm->fd);
+  serial_open(port, pgm->baudrate, &pgm->fd, 0);
 
   /*
    * drain any extraneous input
    */
   butterfly_drain (pgm, 0);
diff -U5 -arp -x '*.o' -x '*.tmp' -x '*~' -x '*.exe' -x '*.a' -x Makefile -x '*.log' -x config.status -x config_gram.c -x lexer.c avrdude-5.8.orig/jtagmkI.c avrdude-5.8.setdtr/jtagmkI.c
--- avrdude-5.8.orig/jtagmkI.c	2009-07-11 00:39:37 +0200
+++ avrdude-5.8.setdtr/jtagmkI.c	2009-07-14 19:21:13 +0200
@@ -671,11 +671,11 @@ static int jtagmkI_open(PROGRAMMER * pgm
   for (i = 0; i < sizeof(baudtab) / sizeof(baudtab[0]); i++) {
     if (verbose >= 2)
       fprintf(stderr,
               "%s: jtagmkI_open(): trying to sync at baud rate %ld:\n",
               progname, baudtab[i].baud);
-    serial_open(port, baudtab[i].baud, &pgm->fd);
+    serial_open(port, baudtab[i].baud, &pgm->fd, 0);
 
     /*
      * drain any extraneous input
      */
     jtagmkI_drain(pgm, 0);
diff -U5 -arp -x '*.o' -x '*.tmp' -x '*~' -x '*.exe' -x '*.a' -x Makefile -x '*.log' -x config.status -x config_gram.c -x lexer.c avrdude-5.8.orig/jtagmkII.c avrdude-5.8.setdtr/jtagmkII.c
--- avrdude-5.8.orig/jtagmkII.c	2009-07-11 00:39:37 +0200
+++ avrdude-5.8.setdtr/jtagmkII.c	2009-07-14 19:21:46 +0200
@@ -1316,11 +1316,11 @@ static int jtagmkII_open(PROGRAMMER * pg
     return -1;
 #endif
   }
 
   strcpy(pgm->port, port);
-  serial_open(port, baud, &pgm->fd);
+  serial_open(port, baud, &pgm->fd, 0);
 
   /*
    * drain any extraneous input
    */
   jtagmkII_drain(pgm, 0);
@@ -1361,11 +1361,11 @@ static int jtagmkII_open_dw(PROGRAMMER *
     return -1;
 #endif
   }
 
   strcpy(pgm->port, port);
-  serial_open(port, baud, &pgm->fd);
+  serial_open(port, baud, &pgm->fd, 0);
 
   /*
    * drain any extraneous input
    */
   jtagmkII_drain(pgm, 0);
@@ -1406,11 +1406,11 @@ static int jtagmkII_dragon_open(PROGRAMM
     return -1;
 #endif
   }
 
   strcpy(pgm->port, port);
-  serial_open(port, baud, &pgm->fd);
+  serial_open(port, baud, &pgm->fd, 0);
 
   /*
    * drain any extraneous input
    */
   jtagmkII_drain(pgm, 0);
@@ -1451,11 +1451,11 @@ static int jtagmkII_dragon_open_dw(PROGR
     return -1;
 #endif
   }
 
   strcpy(pgm->port, port);
-  serial_open(port, baud, &pgm->fd);
+  serial_open(port, baud, &pgm->fd, 0);
 
   /*
    * drain any extraneous input
    */
   jtagmkII_drain(pgm, 0);
diff -U5 -arp -x '*.o' -x '*.tmp' -x '*~' -x '*.exe' -x '*.a' -x Makefile -x '*.log' -x config.status -x config_gram.c -x lexer.c avrdude-5.8.orig/ser_avrdoper.c avrdude-5.8.setdtr/ser_avrdoper.c
--- avrdude-5.8.orig/ser_avrdoper.c	2009-07-11 00:48:48 +0200
+++ avrdude-5.8.setdtr/ser_avrdoper.c	2009-07-16 03:07:04 +0200
@@ -502,11 +502,11 @@ static char *usbErrorText(int usbErrno)
     }
 }
 
 /* ------------------------------------------------------------------------- */
 
-static void avrdoper_open(char *port, long baud, union filedescriptor *fdp)
+static void avrdoper_open(char *port, long baud, union filedescriptor *fdp, unsigned int openflags)
 {
     int rval;
     char *vname = "obdev.at";
     char *devname = "AVR-Doper";
 
diff -U5 -arp -x '*.o' -x '*.tmp' -x '*~' -x '*.exe' -x '*.a' -x Makefile -x '*.log' -x config.status -x config_gram.c -x lexer.c avrdude-5.8.orig/ser_posix.c avrdude-5.8.setdtr/ser_posix.c
--- avrdude-5.8.orig/ser_posix.c	2009-07-02 12:31:14 +0200
+++ avrdude-5.8.setdtr/ser_posix.c	2009-07-16 02:57:32 +0200
@@ -30,10 +30,11 @@
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/socket.h>
 #include <netdb.h>
 #include <netinet/in.h>
@@ -208,11 +209,113 @@ net_open(const char *port, union filedes
   }
 
   fdp->ifd = fd;
 }
 
-static void ser_open(char * port, long baud, union filedescriptor *fdp)
+
+static int ser_set_dtr(union filedescriptor *fdp)
+{
+  unsigned int	ctl;
+  int           r;
+
+  r = ioctl(fdp->ifd, TIOCMGET, &ctl);
+  if (r < 0) {
+    perror("ioctl(\"TIOCMGET\")");
+    return -1;
+  }
+  else {
+    /* make sure the RESET capacitor is unloaded by a cleared DTR */
+    /* clear DTR */
+    ctl &= ~(TIOCM_DTR);
+    r = ioctl(fdp->ifd, TIOCMSET, &ctl);
+    if (r < 0) {
+      perror("ioctl(\"TIOCMSET\")");
+      return -1;
+    }
+    else {
+      usleep(50*1000);
+
+      /* set DTR */
+      ctl |= TIOCM_DTR;
+      r = ioctl(fdp->ifd, TIOCMSET, &ctl);
+      if (r < 0) {
+        perror("ioctl(\"TIOCMSET\")");
+        return -1;
+      }
+      else {
+        usleep(50*1000);
+      }
+    }
+  }
+
+  return 0;
+}
+
+
+static int ser_reset_dtr_rts(union filedescriptor *fdp)
+{
+  unsigned int	ctl;
+  int           r;
+
+  r = ioctl(fdp->ifd, TIOCMGET, &ctl);
+  if (r < 0) {
+    perror("ioctl(\"TIOCMGET\")");
+    return -1;
+  }
+  else {
+    /* clear DTR and RTS */
+    ctl &= ~(TIOCM_DTR | TIOCM_RTS);
+    r = ioctl(fdp->ifd, TIOCMSET, &ctl);
+    if (r < 0) {
+      perror("ioctl(\"TIOCMSET\")");
+      return -1;
+    }
+  }
+
+  return 0;
+}
+
+
+static int ser_pulse_rts(union filedescriptor *fdp)
+{
+  unsigned int	ctl;
+  int           r;
+
+  r = ioctl(fdp->ifd, TIOCMGET, &ctl);
+  if (r < 0) {
+    perror("ioctl(\"TIOCMGET\")");
+    return -1;
+  }
+  else {
+    /* set RTS */
+    ctl |= TIOCM_RTS;
+    r = ioctl(fdp->ifd, TIOCMSET, &ctl);
+    if (r < 0) {
+      perror("ioctl(\"TIOCMSET\")");
+      return -1;
+    }
+    else {
+      usleep(50*1000);
+
+      /* clear RTS */
+      ctl &= ~(TIOCM_RTS);
+      r = ioctl(fdp->ifd, TIOCMSET, &ctl);
+      if (r < 0) {
+        perror("ioctl(\"TIOCMSET\")");
+        return -1;
+      }
+      else {
+        usleep(50*1000);
+      }
+    }
+  }
+
+  return 0;
+}
+
+
+static void ser_open(char * port, long baud, union filedescriptor *fdp, unsigned int openflags)
 {
   int rc;
   int fd;
 
   /*
@@ -244,10 +347,20 @@ static void ser_open(char * port, long b
     fprintf(stderr, 
             "%s: ser_open(): can't set attributes for device \"%s\": %s\n",
             progname, port, strerror(-rc));
     exit(1);
   }
+
+  if(openflags & SEROPEN_FL_SETDTR)
+  {
+    ser_set_dtr(fdp);
+  }
+
+  if(openflags & SEROPEN_FL_PULSERTS)
+  {
+    ser_pulse_rts(fdp);
+  }
 }
 
 
 static void ser_close(union filedescriptor *fd)
 {
@@ -262,10 +375,13 @@ static void ser_close(union filedescript
               progname, strerror(errno));
     }
     saved_original_termios = 0;
   }
 
+  /* clear DTR and RTS on close */
+  ser_reset_dtr_rts(fd);
+
   close(fd->ifd);
 }
 
 
 static int ser_send(union filedescriptor *fd, unsigned char * buf, size_t buflen)
diff -U5 -arp -x '*.o' -x '*.tmp' -x '*~' -x '*.exe' -x '*.a' -x Makefile -x '*.log' -x config.status -x config_gram.c -x lexer.c avrdude-5.8.orig/ser_win32.c avrdude-5.8.setdtr/ser_win32.c
--- avrdude-5.8.orig/ser_win32.c	2009-07-02 12:23:57 +0200
+++ avrdude-5.8.setdtr/ser_win32.c	2009-07-16 02:57:34 +0200
@@ -55,10 +55,15 @@ static struct baud_mapping baud_lookup_t
   { 57600,  CBR_57600 },
   { 115200, CBR_115200 },
   { 0,      0 }                 /* Terminator. */
 };
 
+static DCB g_original_dcb;
+static int g_saved_original_dcb;
+
+static void ser_close(union filedescriptor *fd);
+
 static DWORD serial_baud_lookup(long baud)
 {
   struct baud_mapping *map = baud_lookup_table;
 
   while (map->baud) {
@@ -87,10 +92,31 @@ static BOOL serial_w32SetTimeOut(HANDLE 
 static int ser_setspeed(union filedescriptor *fd, long baud)
 {
 	DCB dcb;
 	HANDLE hComPort = (HANDLE)fd->pfd;
 
+	/*
+	 * read and save original dcb
+	 */
+	ZeroMemory (&dcb, sizeof(DCB));
+	dcb.DCBlength = sizeof(DCB);
+	if(!GetCommState(hComPort, &dcb)) {
+		fprintf(stderr, "%s: ser_setspeed(): GetCommState() failed",
+			progname);
+		/* ignore the error; initial state will not be restored on close */
+	}
+	else
+	{
+		/*
+		 * copy DCB for ser_close if we haven't already
+		 */
+		if (! g_saved_original_dcb) {
+			g_saved_original_dcb = 1;
+			g_original_dcb = dcb;
+		}
+	}
+
 	ZeroMemory (&dcb, sizeof(DCB));
 	dcb.DCBlength = sizeof(DCB);
 	dcb.BaudRate = serial_baud_lookup (baud);
 	dcb.fBinary = 1;
 	dcb.fDtrControl = DTR_CONTROL_DISABLE;
@@ -104,11 +130,11 @@ static int ser_setspeed(union filedescri
 
 	return 0;
 }
 
 
-static void ser_open(char * port, long baud, union filedescriptor *fdp)
+static void ser_open(char * port, long baud, union filedescriptor *fdp, unsigned int openflags)
 {
 	LPVOID lpMsgBuf;
 	HANDLE hComPort=INVALID_HANDLE_VALUE;
 	char *newname = 0;
 
@@ -172,19 +198,34 @@ static void ser_open(char * port, long b
 	}
 
         fdp->pfd = (void *)hComPort;
 	if (ser_setspeed(fdp, baud) != 0)
 	{
-		CloseHandle(hComPort);
+		ser_close(fdp);
 		fprintf(stderr, "%s: ser_open(): can't set com-state for \"%s\"\n",
 				progname, port);
 		exit(1);
 	}
 
+	if(openflags & SEROPEN_FL_SETDTR)
+	{
+		Sleep(50); /* make sure the RESET capacitor is unloaded by a cleared DTR */
+		EscapeCommFunction(hComPort, SETDTR);
+		Sleep(50);
+	}
+
+	if(openflags & SEROPEN_FL_PULSERTS)
+	{
+		EscapeCommFunction(hComPort, SETRTS);
+		Sleep(50);
+		EscapeCommFunction(hComPort, CLRRTS);
+		Sleep(50);
+	}
+
 	if (!serial_w32SetTimeOut(hComPort,0))
 	{
-		CloseHandle(hComPort);
+		ser_close(fdp);
 		fprintf(stderr, "%s: ser_open(): can't set initial timeout for \"%s\"\n",
 				progname, port);
 		exit(1);
 	}
 
@@ -195,14 +236,39 @@ static void ser_open(char * port, long b
 
 
 static void ser_close(union filedescriptor *fd)
 {
 	HANDLE hComPort=(HANDLE)fd->pfd;
+
 	if (hComPort != INVALID_HANDLE_VALUE)
+	{
+		/* restore original settings */
+		if(g_saved_original_dcb) {
+			DCB dcb = g_original_dcb;
+
+			/* always reset DTR and RTS on close, important for Bluetooth devices */
+			dcb.fDtrControl = DTR_CONTROL_DISABLE;
+			dcb.fRtsControl = RTS_CONTROL_DISABLE;
+
+			if(!SetCommState(hComPort, &dcb)) {
+				fprintf(stderr, 
+					"%s: ser_close(): can't reset attributes for device\n",
+					progname);
+			}
+			g_saved_original_dcb = 0;
+		}
+		else {
+			/* fallback strategy when original values cannot be restored */
+			EscapeCommFunction(hComPort, CLRDTR);
+			EscapeCommFunction(hComPort, CLRRTS);
+		}
+
 		CloseHandle (hComPort);
+	}
 
 	hComPort = INVALID_HANDLE_VALUE;
+	fd->pfd = hComPort;
 }
 
 
 static int ser_send(union filedescriptor *fd, unsigned char * buf, size_t buflen)
 {
diff -U5 -arp -x '*.o' -x '*.tmp' -x '*~' -x '*.exe' -x '*.a' -x Makefile -x '*.log' -x config.status -x config_gram.c -x lexer.c avrdude-5.8.orig/serial.h avrdude-5.8.setdtr/serial.h
--- avrdude-5.8.orig/serial.h	2009-03-06 21:09:11 +0100
+++ avrdude-5.8.setdtr/serial.h	2009-07-16 00:45:21 +0200
@@ -42,11 +42,13 @@ union filedescriptor
   } usb;
 };
 
 struct serial_device
 {
-  void (*open)(char * port, long baud, union filedescriptor *fd);
+  void (*open)(char * port, long baud, union filedescriptor *fd, unsigned int openflags);
+#define SEROPEN_FL_SETDTR    0x0001 /* set DTR when opening the serial port, needed for auto-reset of Arduino board */
+#define SEROPEN_FL_PULSERTS  0x0002 /* set RTS for a short time and clear it then when opening the serial port, needed for auto-reset of old Arduino board */
   int (*setspeed)(union filedescriptor *fd, long baud);
   void (*close)(union filedescriptor *fd);
 
   int (*send)(union filedescriptor *fd, unsigned char * buf, size_t buflen);
   int (*recv)(union filedescriptor *fd, unsigned char * buf, size_t buflen);
diff -U5 -arp -x '*.o' -x '*.tmp' -x '*~' -x '*.exe' -x '*.a' -x Makefile -x '*.log' -x config.status -x config_gram.c -x lexer.c avrdude-5.8.orig/stk500.c avrdude-5.8.setdtr/stk500.c
--- avrdude-5.8.orig/stk500.c	2009-03-06 21:09:11 +0100
+++ avrdude-5.8.setdtr/stk500.c	2009-07-14 19:41:45 +0200
@@ -71,17 +71,17 @@ static int stk500_recv(PROGRAMMER * pgm,
   }
   return 0;
 }
 
 
-static int stk500_drain(PROGRAMMER * pgm, int display)
+int stk500_drain(PROGRAMMER * pgm, int display)
 {
   return serial_drain(&pgm->fd, display);
 }
 
 
-static int stk500_getsync(PROGRAMMER * pgm)
+int stk500_getsync(PROGRAMMER * pgm)
 {
   unsigned char buf[32], resp[32];
 
   /*
    * get in sync */
@@ -655,11 +655,11 @@ static void stk500_enable(PROGRAMMER * p
 
 
 static int stk500_open(PROGRAMMER * pgm, char * port)
 {
   strcpy(pgm->port, port);
-  serial_open(port, pgm->baudrate? pgm->baudrate: 115200, &pgm->fd);
+  serial_open(port, pgm->baudrate? pgm->baudrate: 115200, &pgm->fd, 0);
 
   /*
    * drain any extraneous input
    */
   stk500_drain(pgm, 0);
diff -U5 -arp -x '*.o' -x '*.tmp' -x '*~' -x '*.exe' -x '*.a' -x Makefile -x '*.log' -x config.status -x config_gram.c -x lexer.c avrdude-5.8.orig/stk500.h avrdude-5.8.setdtr/stk500.h
--- avrdude-5.8.orig/stk500.h	2009-03-06 21:09:11 +0100
+++ avrdude-5.8.setdtr/stk500.h	2009-07-14 19:41:43 +0200
@@ -26,10 +26,14 @@
 extern "C" {
 #endif
 
 void stk500_initpgm (PROGRAMMER * pgm);
 
+/* used by arduino.c to avoid duplicate code */
+int stk500_getsync(PROGRAMMER * pgm);
+int stk500_drain(PROGRAMMER * pgm, int display);
+
 #ifdef __cplusplus
 }
 #endif
 
 #endif
diff -U5 -arp -x '*.o' -x '*.tmp' -x '*~' -x '*.exe' -x '*.a' -x Makefile -x '*.log' -x config.status -x config_gram.c -x lexer.c avrdude-5.8.orig/stk500v2.c avrdude-5.8.setdtr/stk500v2.c
--- avrdude-5.8.orig/stk500v2.c	2009-07-11 00:39:37 +0200
+++ avrdude-5.8.setdtr/stk500v2.c	2009-07-14 19:22:30 +0200
@@ -1266,11 +1266,11 @@ static int stk500v2_open(PROGRAMMER * pg
     return -1;
 #endif
   }
 
   strcpy(pgm->port, port);
-  serial_open(port, baud, &pgm->fd);
+  serial_open(port, baud, &pgm->fd, 0);
 
   /*
    * drain any extraneous input
    */
   stk500v2_drain(pgm, 0);
@@ -1316,11 +1316,11 @@ static int stk600_open(PROGRAMMER * pgm,
     return -1;
 #endif
   }
 
   strcpy(pgm->port, port);
-  serial_open(port, baud, &pgm->fd);
+  serial_open(port, baud, &pgm->fd, 0);
 
   /*
    * drain any extraneous input
    */
   stk500v2_drain(pgm, 0);
@@ -2763,11 +2763,11 @@ static int stk500v2_jtagmkII_open(PROGRA
     return -1;
 #endif
   }
 
   strcpy(pgm->port, port);
-  serial_open(port, baud, &pgm->fd);
+  serial_open(port, baud, &pgm->fd, 0);
 
   /*
    * drain any extraneous input
    */
   stk500v2_drain(pgm, 0);
@@ -2835,11 +2835,11 @@ static int stk500v2_dragon_isp_open(PROG
     return -1;
 #endif
   }
 
   strcpy(pgm->port, port);
-  serial_open(port, baud, &pgm->fd);
+  serial_open(port, baud, &pgm->fd, 0);
 
   /*
    * drain any extraneous input
    */
   stk500v2_drain(pgm, 0);
@@ -2907,11 +2907,11 @@ static int stk500v2_dragon_hv_open(PROGR
     return -1;
 #endif
   }
 
   strcpy(pgm->port, port);
-  serial_open(port, baud, &pgm->fd);
+  serial_open(port, baud, &pgm->fd, 0);
 
   /*
    * drain any extraneous input
    */
   stk500v2_drain(pgm, 0);
diff -U5 -arp -x '*.o' -x '*.tmp' -x '*~' -x '*.exe' -x '*.a' -x Makefile -x '*.log' -x config.status -x config_gram.c -x lexer.c avrdude-5.8.orig/usb_libusb.c avrdude-5.8.setdtr/usb_libusb.c
--- avrdude-5.8.orig/usb_libusb.c	2009-03-06 21:09:11 +0100
+++ avrdude-5.8.setdtr/usb_libusb.c	2009-07-16 03:04:07 +0200
@@ -54,11 +54,11 @@ static int usb_interface;
 
 /*
  * The "baud" parameter is meaningless for USB devices, so we reuse it
  * to pass the desired USB device ID.
  */
-static void usbdev_open(char * port, long baud, union filedescriptor *fd)
+static void usbdev_open(char * port, long baud, union filedescriptor *fd, unsigned int openflags)
 {
   char string[256];
   char product[256];
   struct usb_bus *bus;
   struct usb_device *dev;
