Convert the serial autodetect functions to use int instead of char to enumerate devices.
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
diff --git a/driver-bitforce.c b/driver-bitforce.c
index 0f2ea65..5b8570e 100644
--- a/driver-bitforce.c
+++ b/driver-bitforce.c
@@ -146,13 +146,13 @@ static bool bitforce_detect_one(const char *devpath)
} while(0)
#ifdef WIN32
-static char bitforce_autodetect_ftdi(void)
+static int bitforce_autodetect_ftdi(void)
{
char buf[65 * numDevs];
char*bufptrs[numDevs + 1];
char devpath[] = "\\\\.\\COMnnnnn";
char *devpathnum = &devpath[7];
- char found = 0;
+ int found = 0;
int i;
FT_STATUS ftStatus;
@@ -210,13 +210,13 @@ out:
return found;
}
#else
-static char bitforce_autodetect_ftdi(void)
+static int bitforce_autodetect_ftdi(void)
{
return 0;
}
#endif
-static char bitforce_detect_auto(void)
+static int bitforce_detect_auto(void)
{
return (serial_autodetect_udev (bitforce_detect_one, "BitFORCE*SHA256") ?:
serial_autodetect_devserial(bitforce_detect_one, "BitFORCE_SHA256") ?:
diff --git a/driver-modminer.c b/driver-modminer.c
index ff96ee4..040100d 100644
--- a/driver-modminer.c
+++ b/driver-modminer.c
@@ -91,7 +91,7 @@ modminer_detect_one(const char *devpath)
#undef bailout
-static char
+static int
modminer_detect_auto()
{
return
diff --git a/fpgautils.c b/fpgautils.c
index 5f48874..a62b491 100644
--- a/fpgautils.c
+++ b/fpgautils.c
@@ -38,7 +38,7 @@
#include "miner.h"
#ifdef HAVE_LIBUDEV
-char
+int
serial_autodetect_udev(detectone_func_t detectone, const char*prodname)
{
struct udev *udev = udev_new();
@@ -69,14 +69,14 @@ serial_autodetect_udev(detectone_func_t detectone, const char*prodname)
return found;
}
#else
-char
+int
serial_autodetect_udev(__maybe_unused detectone_func_t detectone, __maybe_unused const char*prodname)
{
return 0;
}
#endif
-char
+int
serial_autodetect_devserial(detectone_func_t detectone, const char*prodname)
{
#ifndef WIN32
@@ -107,7 +107,7 @@ serial_autodetect_devserial(detectone_func_t detectone, const char*prodname)
#endif
}
-char
+int
_serial_detect(const char*dname, detectone_func_t detectone, autoscan_func_t autoscan, bool forceauto)
{
struct string_elist *iter, *tmp;
diff --git a/fpgautils.h b/fpgautils.h
index c45183b..5b743bc 100644
--- a/fpgautils.h
+++ b/fpgautils.h
@@ -14,17 +14,17 @@
#include <stdio.h>
typedef bool(*detectone_func_t)(const char*);
-typedef char(*autoscan_func_t)();
+typedef int(*autoscan_func_t)();
-extern char _serial_detect(const char*dname, detectone_func_t, autoscan_func_t, bool force_autoscan);
+extern int _serial_detect(const char*dname, detectone_func_t, autoscan_func_t, bool force_autoscan);
#define serial_detect_fauto(dname, detectone, autoscan) \
_serial_detect(dname, detectone, autoscan, true)
#define serial_detect_auto(dname, detectone, autoscan) \
_serial_detect(dname, detectone, autoscan, false)
#define serial_detect(dname, detectone) \
_serial_detect(dname, detectone, NULL, false)
-extern char serial_autodetect_devserial(detectone_func_t, const char*prodname);
-extern char serial_autodetect_udev (detectone_func_t, const char*prodname);
+extern int serial_autodetect_devserial(detectone_func_t, const char*prodname);
+extern int serial_autodetect_udev (detectone_func_t, const char*prodname);
extern int serial_open(const char*devpath, unsigned long baud, signed short timeout, bool purge);
extern ssize_t _serial_read(int fd, char *buf, size_t buflen, char*eol);