Improve Micronucleus programmer error messages

This commit is contained in:
Marius Greuel 2021-01-26 22:23:25 +01:00
parent 03eb736a62
commit 7d87a12d57
1 changed files with 10 additions and 11 deletions

View File

@ -647,6 +647,13 @@ static int micronucleus_open(PROGRAMMER* pgm, char* port)
}
}
if (port != NULL && dev_name == NULL)
{
avrdude_message(MSG_INFO, "%s: ERROR: Invalid -P value: '%s'\n", progname, port);
avrdude_message(MSG_INFO, "%sUse -P usb:bus:device\n", progbuf);
return -1;
}
// Determine VID/PID
int vid = pgm->usbvid ? pgm->usbvid : MICRONUCLEUS_VID;
int pid = MICRONUCLEUS_PID;
@ -710,8 +717,7 @@ static int micronucleus_open(PROGRAMMER* pgm, char* port)
pdata->usb_handle = usb_open(device);
if (pdata->usb_handle == NULL)
{
avrdude_message(MSG_INFO, "%s: WARNING: cannot open USB device: %s\n", progname, usb_strerror());
continue;
avrdude_message(MSG_INFO, "%s: ERROR: Failed to open USB device: %s\n", progname, usb_strerror());
}
}
}
@ -733,13 +739,6 @@ static int micronucleus_open(PROGRAMMER* pgm, char* port)
break;
}
if (port != NULL && dev_name == NULL)
{
avrdude_message(MSG_INFO, "%s: ERROR: Invalid -P value: '%s'\n", progname, port);
avrdude_message(MSG_INFO, "%sUse -P usb:bus:device\n", progbuf);
return -1;
}
if (!pdata->usb_handle)
{
avrdude_message(MSG_INFO, "%s: ERROR: Could not find device with Micronucleus bootloader (%04X:%04X)\n",
@ -874,7 +873,7 @@ static int micronucleus_parseextparams(PROGRAMMER* pgm, LISTID xparams)
}
else
{
avrdude_message(MSG_INFO, "%s: invalid extended parameter '%s'\n", progname, param);
avrdude_message(MSG_INFO, "%s: Invalid extended parameter '%s'\n", progname, param);
return -1;
}
}
@ -912,7 +911,7 @@ void micronucleus_initpgm(PROGRAMMER* pgm)
// Give a proper error if we were not compiled with libusb
static int micronucleus_nousb_open(struct programmer_t* pgm, char* name)
{
avrdude_message(MSG_INFO, "%s: error: no usb support. Please compile again with libusb installed.\n", progname);
avrdude_message(MSG_INFO, "%s: error: No usb support. Please compile again with libusb installed.\n", progname);
return -1;
}