Turn the usbpid parameter of the programmer into a list of PIDs. Make

the JTAGICE3 programmer handle a list of PIDs, by trying each of them
in sequence.  Use a single, central jtag3_open_common() function to
handle the common code of all jtag3_open_* functions.  Centralize all
USB VID/PID definitions in usbdevs.h.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1283 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
joerg_wunsch
2014-02-27 13:06:03 +00:00
parent 52c59fade2
commit 7999eaa25a
19 changed files with 223 additions and 233 deletions

View File

@@ -38,6 +38,7 @@
#include "avr.h"
#include "pgm.h"
#include "usbasp.h"
#include "usbdevs.h"
#if defined(HAVE_LIBUSB) || defined(HAVE_LIBUSB_1_0)
@@ -464,8 +465,19 @@ static int usbasp_open(PROGRAMMER * pgm, char * port)
progname, port);
/* usb_init will be done in usbOpenDevice */
if (usbOpenDevice(&PDATA(pgm)->usbhandle, pgm->usbvid, pgm->usbvendor,
pgm->usbpid, pgm->usbproduct) != 0) {
LNODEID usbpid = lfirst(pgm->usbpid);
int pid, vid;
if (usbpid) {
pid = *(int *)(ldata(usbpid));
if (lnext(usbpid))
fprintf(stderr,
"%s: Warning: using PID 0x%04x, ignoring remaining PIDs in list\n",
progname, pid);
} else {
pid = USBASP_SHARED_PID;
}
vid = pgm->usbvid? pgm->usbvid: USBASP_SHARED_VID;
if (usbOpenDevice(&PDATA(pgm)->usbhandle, vid, pgm->usbvendor, pid, pgm->usbproduct) != 0) {
/* try alternatives */
if(strcasecmp(ldata(lfirst(pgm->id)), "usbasp") == 0) {
/* for id usbasp autodetect some variants */
@@ -500,7 +512,7 @@ static int usbasp_open(PROGRAMMER * pgm, char * port)
fprintf(stderr,
"%s: error: could not find USB device with vid=0x%x pid=0x%x",
progname, pgm->usbvid, pgm->usbpid);
progname, vid, pid);
if (pgm->usbvendor[0] != 0) {
fprintf(stderr, " vendor='%s'", pgm->usbvendor);
}