Package: avrdude
Version: 5.5-4
Severity: grave

Avrdude fails to complete a request to getting info, or to program a chip, 
through
USBTiny adapter (http://www.ladyada.net/make/usbtinyisp/).
The error message is:
    avrdude: error: usbtiny_receive: No error (expected 8, got 4)

There is a patch  http://savannah.nongnu.org/patch/download.php?file_id=14754
discussed at http://savannah.nongnu.org/patch/?6233, that fixes this error
among others.

The patch attached here, is built and verified,with the Debian source package.
The only changes are related to this fail.

-- System Information:
Debian Release: 5.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.28_amd64 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=es_ES.UTF-8, LC_CTYPE=es_ES.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages avrdude depends on:
ii  libc6                     2.7-16         GNU C Library: Shared libraries
ii  libncurses5               5.7+20081213-1 shared libraries for terminal hand
ii  libreadline5              5.2-3          GNU readline and history libraries
ii  libusb-0.1-4              2:0.1.12-13    userspace USB programming library

avrdude recommends no packages.

Versions of packages avrdude suggests:
ii  avrdude-doc                   5.5-5      documentation for avrdude

-- no debconf information
--- avrdude-5.5.orig/usbtiny.c	2007-10-29 15:40:04.000000000 +0000
+++ avrdude-5.5/usbtiny.c	2009-01-14 02:39:55.000000000 +0000
@@ -138,7 +138,7 @@
     fprintf( stderr, "Operation %d not defined for this chip!\n", op );
     return -1;
   }
-  memset(cmd, 0, sizeof(cmd));
+  memset(cmd, 0, 4);
   avr_set_bits(p->op[op], cmd);
 
   return pgm->cmd(pgm, cmd, res);
@@ -286,19 +286,19 @@
   int nbytes;
 
   // Make sure its empty so we don't read previous calls if it fails
-  memset(res, '\0', sizeof(res) );
+  memset(res, '\0', 4 );
 
   nbytes = usb_in( USBTINY_SPI,
 		   (cmd[1] << 8) | cmd[0],  // convert to 16-bit words
 		   (cmd[3] << 8) | cmd[2],  //  "
-			res, sizeof(res), 8 * sck_period );
+			res, 4, 8 * sck_period );
   if (verbose > 1) {
     // print out the data we sent and received
     printf( "CMD: [%02x %02x %02x %02x] [%02x %02x %02x %02x]\n",
 	    cmd[0], cmd[1], cmd[2], cmd[3],
 	    res[0], res[1], res[2], res[3] );
   }
-  return ((nbytes == sizeof(res)) &&      // should have read 4 bytes
+  return ((nbytes == 4) &&      // should have read 4 bytes
 	  res[2] == cmd[1]);              // AVR's do a delayed-echo thing
 }
 

Reply via email to