Allow specifying a specific driver for --scan-serial For example: --scan-serial bitforce:/dev/ttyUSB0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
diff --git a/bitforce.c b/bitforce.c
index e063664..556354f 100644
--- a/bitforce.c
+++ b/bitforce.c
@@ -203,13 +203,17 @@ static void bitforce_detect_auto()
static void bitforce_detect()
{
struct string_elist *iter, *tmp;
+ const char*s;
bool found = false;
bool autoscan = false;
list_for_each_entry_safe(iter, tmp, &scan_devices, list) {
- if (!strcmp(iter->string, "auto"))
+ s = iter->string;
+ if (!strncmp("bitforce:", iter->string, 9))
+ s += 9;
+ if (!strcmp(s, "auto"))
autoscan = true;
- else if (bitforce_detect_one(iter->string)) {
+ else if (bitforce_detect_one(s)) {
string_elist_del(iter);
found = true;
}
diff --git a/icarus.c b/icarus.c
index 1d59657..f5e2055 100644
--- a/icarus.c
+++ b/icarus.c
@@ -205,9 +205,13 @@ static bool icarus_detect_one(const char *devpath)
static void icarus_detect()
{
struct string_elist *iter, *tmp;
+ const char*s;
list_for_each_entry_safe(iter, tmp, &scan_devices, list) {
- if (icarus_detect_one(iter->string))
+ s = iter->string;
+ if (!strncmp("icarus:", iter->string, 7))
+ s += 7;
+ if (icarus_detect_one(s))
string_elist_del(iter);
}
}