mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-28 20:09:12 +03:00
Request exit when encountering invalid port string
This commit is contained in:
@@ -661,7 +661,7 @@ static int pickit5_open(PROGRAMMER *pgm, const char *port) {
|
||||
int numids = str_set_vid_pid_serno(port, &new_vid, &new_pid, serno, sizeof serno);
|
||||
if(numids < 0) {
|
||||
pmsg_error("invalid -P %s; drop -P option or use -P usb[:<vid>:<pid>][:<serno>]\n", port);
|
||||
return LIBAVRDUDE_GENERAL_FAILURE;
|
||||
return LIBAVRDUDE_EXIT_FAIL;
|
||||
}
|
||||
|
||||
// If the config entry did not specify a USB PID, insert the default one
|
||||
|
||||
@@ -48,7 +48,7 @@ static int usbhid_open(const char *port, union pinfo pinfo, union filedescriptor
|
||||
// Override/set pid, vid and/or serno from -P usb[:<vid>:<pid>][:<serno>]
|
||||
if(str_set_vid_pid_serno(port, &pinfo.usbinfo.vid, &pinfo.usbinfo.pid, serno, sizeof serno) < 0) {
|
||||
pmsg_error("invalid -P %s; drop -P option or use -P usb[:<vid>:<pid>][:<serno>]\n", port);
|
||||
return -1;
|
||||
return LIBAVRDUDE_EXIT_FAIL;
|
||||
}
|
||||
|
||||
if(*serno) {
|
||||
@@ -151,7 +151,7 @@ static int usbhid_open(const char *port, union pinfo pinfo, union filedescriptor
|
||||
// The JTAGICE3 running CMSIS-DAP doesn't use a separate endpoint for event reception
|
||||
fd->usb.eep = 0;
|
||||
fd->usb.max_xfer = 64;
|
||||
pmsg_debug("usbhid_open(): product string: %s\n", cn);
|
||||
pmsg_debug("%s(): product string: %s\n", __func__, cn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ static int usbdev_open(const char *port, union pinfo pinfo, union filedescriptor
|
||||
// Override/set pid, vid and/or serno from -P usb[:<vid>:<pid>][:<serno>]
|
||||
if(str_set_vid_pid_serno(port, &pinfo.usbinfo.vid, &pinfo.usbinfo.pid, serno, sizeof serno) < 0) {
|
||||
pmsg_error("invalid -P %s; drop -P option or use -P usb[:<vid>:<pid>][:<serno>]\n", port);
|
||||
return -1;
|
||||
return LIBAVRDUDE_EXIT_FAIL;
|
||||
}
|
||||
|
||||
usb_init();
|
||||
|
||||
Reference in New Issue
Block a user