Skip to content

Commit

Permalink
Only print matching alternatives when serial adapter is not unique
Browse files Browse the repository at this point in the history
  • Loading branch information
MCUdude committed Sep 17, 2023
1 parent 98f0640 commit 6359188
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/serialadapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,12 @@ int setport_from_serialadapter(char **portp, const SERIALADAPTER *ser, const cha
if (1 < sa_num_matches_by_sea(ser, sp, sernum, n)) {
pmsg_warning("-P %s is not unique; consider one of the below\n", *portp);
for (int i = 0; i < n; i++) {
if (sp[i].unique && sp[i].sernum[0])
msg_warning("-P %s or -P %s:%s\n", sp[i].port, *portp, sp[i].sernum);
else
msg_warning("-P %s (via %s serial adapter)\n", sp[i].port, *portp);
if (sp[i].match) {
if (sp[i].unique && sp[i].sernum[0])
msg_warning("-P %s or -P %s:%s\n", sp[i].port, *portp, sp[i].sernum);
else
msg_warning("-P %s (via %s serial adapter)\n", sp[i].port, *portp);
}
}
rv = -2;
}
Expand Down Expand Up @@ -191,10 +193,12 @@ int setport_from_vid_pid(char **portp, int vid, int pid, const char *sernum) {
if (1 < sa_num_matches_by_vid_pid(vid, pid, sp, sernum, n)) {
pmsg_warning("-P %s is not unique; consider one of the below\n", *portp);
for (int i = 0; i < n; i++) {
if (sp[i].unique && sp[i].sernum[0])
msg_warning("-P %s or -P %s:%s\n", sp[i].port, *portp, sp[i].sernum);
else
msg_warning("-P %s (via %s serial adapter)\n", sp[i].port, *portp);
if (sp[i].match) {
if (sp[i].unique && sp[i].sernum[0])
msg_warning("-P %s or -P %s:%s\n", sp[i].port, *portp, sp[i].sernum);
else
msg_warning("-P %s (via %s serial adapter)\n", sp[i].port, *portp);
}
}
rv = -2;
}
Expand Down

0 comments on commit 6359188

Please sign in to comment.