mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-16 02:31:06 +00:00
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:
18
usbtiny.c
18
usbtiny.c
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user