avrdude-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avrdude-dev] avrdude and usbasp


From: Mark
Subject: Re: [avrdude-dev] avrdude and usbasp
Date: Sat, 14 Jan 2012 08:14:27 -0800 (PST)

Here's what I got 

Flash the firmware from repository.

/home/arturj/kkmulticopter/lib/avrdude/linux/avrdude -C 
/home/arturj/kkmulticopter/lib/avrdude/linux/avrdude.conf -p m168p -P usb -c 
usbasp-clone -B 8 -e -U lfuse:w:0xe2:m -U hfuse:w:0xde:m 
avrdude: Warning: cannot query product for device: No error
avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc

avrdude done.  Thank you.

Error during setting the fuses.
Flashing of firmware aborted.


Looks like this happens inside usbOpenDevice function. If product name can not 
be read, function returns an error and program considers this a fatal failure. 
Perhaps instead we shoud just display a warning and not return an error or 
calling code should not consider this a fatal error, just a warning and 
continue. If we didn't have product id to begin with, chances are we don't care 
what it is. So change 


errorCode = USB_ERROR_IO;
fprintf(stderr,
"%s: Warning: cannot query product for device: %s\n",
progname, strerror(libusb_to_errno(r)));

to

                            errorCode = 0; /* we don't care, act like nothing 
happened */
fprintf(stderr,
"%s: Warning: cannot query product for device: %s\n",
progname, strerror(libusb_to_errno(r)));

Or change

if (usbOpenDevice(&PDATA(pgm)->usbhandle, pgm->usbvid, pgm->usbvendor,
pgm->usbpid, pgm->usbproduct) != 0) {

to also consider usbOpenDevice returning USB_ERROR_IO a non-failure

result = usbOpenDevice(&PDATA(pgm)->usbhandle, pgm->usbvid, pgm->usbvendor,
pgm->usbpid, pgm->usbproduct

if (result !=0 && result != USB_ERROR_IO) {


Also, why are we making original USBasp, it's old version and NIBObee special 
cases hardcoded into usbasp_open function? Shouldn't the code be made generic 
and these 3 also moved to config file?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]