patch #7932 Read USBtiny VID and PID from avrdude.conf if provided.

* avrdude.conf.in: added usbpid, usbvid to usbtiny
	* usbtiny.[ch]: use usbpid, usbpid if provided in config file

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1134 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
rliebscher 2013-01-29 18:33:34 +00:00
parent c65baa766a
commit 707e6634c1
4 changed files with 25 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2013-01-29 Rene Liebscher <R.Liebscher@gmx.de>
patch #7932 Read USBtiny VID and PID from avrdude.conf if provided.
* avrdude.conf.in: added usbpid, usbvid to usbtiny
* usbtiny.[ch]: use usbpid, usbpid if provided in config file
2013-01-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #38172: avrftdi: Incorrect information in avrdude.conf

View File

@ -714,6 +714,8 @@ programmer
desc = "USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/";
type = "usbtiny";
connection_type = usb;
usbvid = 0x1781;
usbpid = 0x0c9f;
;
programmer

View File

@ -204,6 +204,7 @@ static int usbtiny_open(PROGRAMMER* pgm, char* name)
struct usb_device *dev = 0;
char *bus_name = NULL;
char *dev_name = NULL;
int vid, pid;
// if no -P was given or '-P usb' was given
if(strcmp(name, "usb") == 0)
@ -225,11 +226,22 @@ static int usbtiny_open(PROGRAMMER* pgm, char* name)
PDATA(pgm)->usb_handle = NULL;
if (pgm->usbvid)
vid = pgm->usbvid;
else
vid = USBTINY_VENDOR_DEFAULT;
if (pgm->usbpid)
pid = pgm->usbpid;
else
pid = USBTINY_PRODUCT_DEFAULT;
// now we iterate through all the busses and devices
for ( bus = usb_busses; bus; bus = bus->next ) {
for ( dev = bus->devices; dev; dev = dev->next ) {
if (dev->descriptor.idVendor == USBTINY_VENDOR
&& dev->descriptor.idProduct == USBTINY_PRODUCT ) { // found match?
if (dev->descriptor.idVendor == vid
&& dev->descriptor.idProduct == pid ) { // found match?
if(verbose)
fprintf(stderr,
"%s: usbdev_open(): Found USBtinyISP, bus:device: %s:%s\n",
@ -259,7 +271,7 @@ static int usbtiny_open(PROGRAMMER* pgm, char* name)
}
if (!PDATA(pgm)->usb_handle) {
fprintf( stderr, "%s: Error: Could not find USBtiny device (0x%x/0x%x)\n",
progname, USBTINY_VENDOR, USBTINY_PRODUCT );
progname, vid, pid );
return -1;
}

View File

@ -25,8 +25,8 @@
// these are specifically assigned to USBtiny,
// if you need your own VID and PIDs you can get them for cheap from
// www.mecanique.co.uk so please don't reuse these. Thanks!
#define USBTINY_VENDOR 0x1781
#define USBTINY_PRODUCT 0x0C9F
#define USBTINY_VENDOR_DEFAULT 0x1781
#define USBTINY_PRODUCT_DEFAULT 0x0C9F
// Generic requests to the USBtiny
#define USBTINY_ECHO 0 // echo test