From 27a62a0fd107ff14537b3c9100583acf554f2297 Mon Sep 17 00:00:00 2001 From: jt-holdcraft <133894727+jt-holdcraft@users.noreply.github.com> Date: Wed, 17 May 2023 17:55:42 +0200 Subject: [PATCH] main.cpp: fix device detection --- main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 65cd8ab..857b055 100644 --- a/main.cpp +++ b/main.cpp @@ -112,7 +112,8 @@ int main(int argc, char **argv) switch (c) { case 'd': deviceindex=strtol(optarg,NULL,10); - if (errno==EINVAL || errno==ERANGE) { + if (errno==EINVAL || errno==ERANGE || + strlen(optarg) > 4 || !strcmp(optarg,"?")) { // Serialnumber deviceindex=sdr::search_device(optarg); } break;