From b3ff415b9e6de3ac8e39d0fecec847f2f1a57581 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Fri, 30 Nov 2012 12:36:00 +0000 Subject: [PATCH] * jtag3_private.h: Add two more error detail codes I stumbled across during development * jtag3.c: (Dito.) * usb_libusb.c: Reduce timeouts from 100 to 10 s, still long enough, but not getting cold feet when something goes wrong. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@1116 81a1dc3b-b13d-400b-aceb-764788c761c2 --- avrdude/ChangeLog | 8 ++++++++ avrdude/jtag3.c | 9 +++++++++ avrdude/jtag3_private.h | 2 ++ avrdude/usb_libusb.c | 6 +++--- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/avrdude/ChangeLog b/avrdude/ChangeLog index fd44f144..da1f4a67 100644 --- a/avrdude/ChangeLog +++ b/avrdude/ChangeLog @@ -1,3 +1,11 @@ +2012-11-30 Joerg Wunsch + + * jtag3_private.h: Add two more error detail codes I stumbled + across during development + * jtag3.c: (Dito.) + * usb_libusb.c: Reduce timeouts from 100 to 10 s, still long + enough, but not getting cold feet when something goes wrong. + 2012-11-29 Joerg Wunsch * jtag3.c: Handle events returned by the ICE diff --git a/avrdude/jtag3.c b/avrdude/jtag3.c index 5040061f..5b9fe751 100644 --- a/avrdude/jtag3.c +++ b/avrdude/jtag3.c @@ -263,6 +263,14 @@ static void jtag3_prmsg(PROGRAMMER * pgm, unsigned char * data, size_t len) case RSP3_FAIL_PDI: strcpy(reason, "PDI failure"); break; + + case RSP3_FAIL_UNSUPP_MEMORY: + strcpy(reason, "unsupported memory type"); + break; + + case RSP3_FAIL_WRONG_LENGTH: + strcpy(reason, "wrong length in memory access"); + break; } fprintf(stderr, ", reason: %s\n", reason); } @@ -537,6 +545,7 @@ static int jtag3_command(PROGRAMMER *pgm, unsigned char *cmd, unsigned int cmdle fprintf(stderr, "%s: %s command: timeout/error communicating with programmer (status %d)\n", progname, descr, status); + return -1; } else if (verbose >= 3) { putc('\n', stderr); jtag3_prmsg(pgm, *resp, status); diff --git a/avrdude/jtag3_private.h b/avrdude/jtag3_private.h index f5aaa2f6..6fa4a357 100644 --- a/avrdude/jtag3_private.h +++ b/avrdude/jtag3_private.h @@ -138,6 +138,8 @@ # define RSP3_FAIL_NO_ANSWER 0x20 # define RSP3_FAIL_NO_TARGET_POWER 0x22 # define RSP3_FAIL_WRONG_MODE 0x32 /* progmode vs. non-prog */ +# define RSP3_FAIL_UNSUPP_MEMORY 0x34 /* unsupported memory type */ +# define RSP3_FAIL_WRONG_LENGTH 0x35 /* wrong lenth for mem access */ # define RSP3_FAIL_NOT_UNDERSTOOD 0x91 /* ICE events */ diff --git a/avrdude/usb_libusb.c b/avrdude/usb_libusb.c index 51e3c0fa..73ec6120 100644 --- a/avrdude/usb_libusb.c +++ b/avrdude/usb_libusb.c @@ -279,7 +279,7 @@ static int usbdev_send(union filedescriptor *fd, unsigned char *bp, size_t mlen) */ do { tx_size = (mlen < fd->usb.max_xfer)? mlen: fd->usb.max_xfer; - rv = usb_bulk_write(udev, fd->usb.wep, (char *)bp, tx_size, 100000); + rv = usb_bulk_write(udev, fd->usb.wep, (char *)bp, tx_size, 10000); if (rv != tx_size) { fprintf(stderr, "%s: usbdev_send(): wrote %d out of %d bytes, err = %s\n", @@ -325,7 +325,7 @@ usb_fill_buf(usb_dev_handle *udev, int maxsize, int ep) { int rv; - rv = usb_bulk_read(udev, ep, usbbuf, maxsize, 100000); + rv = usb_bulk_read(udev, ep, usbbuf, maxsize, 10000); if (rv < 0) { if (verbose > 1) @@ -422,7 +422,7 @@ static int usbdev_recv_frame(union filedescriptor *fd, unsigned char *buf, size_ do { rv = usb_bulk_read(udev, fd->usb.rep, usbbuf, - fd->usb.max_xfer, 100000); + fd->usb.max_xfer, 10000); if (rv < 0) { if (verbose > 1)