Merge branch 'master' of github.com:ckolivas/cgminer
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 115 116 117 118 119 120 121
diff --git a/README b/README
index 3cecbce..29c3dba 100644
--- a/README
+++ b/README
@@ -102,7 +102,8 @@ If building on Red Hat:
curl libcurl libcurl-devel openssh
If building on Ubuntu:
- sudo apt-get install build-essential autoconf automake libtool libcurl3-dev libudev-dev
+ sudo apt-get install build-essential autoconf automake libtool pkg-config \
+ libcurl3-dev libudev-dev
CGMiner specific configuration options:
--enable-ants1 Compile support for Antminer S1 Bitmain (default
diff --git a/cgminer.c b/cgminer.c
index c2d56e7..ece6778 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -3560,7 +3560,7 @@ static void __kill_work(void)
/* This should be the common exit path */
void kill_work(void)
{
- __kill_work();
+ cg_completion_timeout(&__kill_work, NULL, 5000);
quit(0, "Shutdown signal received.");
}
@@ -3577,7 +3577,7 @@ void app_restart(void)
{
applog(LOG_WARNING, "Attempting to restart %s", packagename);
- __kill_work();
+ cg_completion_timeout(&__kill_work, NULL, 5000);
clean_up(true);
#if defined(unix) || defined(__APPLE__)
@@ -7953,8 +7953,24 @@ static void clean_up(bool restarting)
curl_global_cleanup();
}
+/* Should all else fail and we're unable to clean up threads due to locking
+ * issues etc, just silently exit. */
+static void *killall_thread(void __maybe_unused *arg)
+{
+ pthread_detach(pthread_self());
+ pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+ sleep(5);
+ exit(1);
+ return NULL;
+}
+
void __quit(int status, bool clean)
{
+ pthread_t killall_t;
+
+ if (unlikely(pthread_create(&killall_t, NULL, killall_thread, NULL)))
+ exit(1);
+
if (clean)
clean_up(false);
#ifdef HAVE_CURSES
@@ -7968,6 +7984,7 @@ void __quit(int status, bool clean)
forkpid = 0;
}
#endif
+ pthread_cancel(killall_t);
exit(status);
}
diff --git a/driver-hashfast.c b/driver-hashfast.c
index cf053d5..c7a9b69 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -650,26 +650,27 @@ static bool hfa_detect_common(struct cgpu_info *hashfast)
if (!ret) {
/* We should receive a valid header even if OP_NAME isn't
* supported by the firmware. */
- applog(LOG_WARNING, "%s: Failed to receive OP_NAME response", hashfast->drv->name);
- goto out;
- }
-
- /* Only try to parse the name if the firmware supports OP_NAME */
- if (h->operation_code == OP_NAME) {
- if (!hfa_get_data(hashfast, info->op_name, 32 / 4)) {
- applog(LOG_WARNING, "%s %d: OP_NAME failed! Failure to get op_name data",
- hashfast->drv->name, hashfast->device_id);
- goto out;
- }
- info->has_opname = info->opname_valid = true;
- applog(LOG_DEBUG, "%s: Returned an OP_NAME", hashfast->drv->name);
- for (i = 0; i < 32; i++) {
- if (i > 0 && info->op_name[i] == '\0')
- break;
- /* Make sure the op_name is valid ascii only */
- if (info->op_name[i] < 32 || info->op_name[i] > 126) {
- info->opname_valid = false;
- break;
+ applog(LOG_NOTICE, "%s %d: Firmware upgrade required to support module Naming.",
+ hashfast->drv->name, hashfast->device_id);
+ ret = true;
+ } else {
+ /* Only try to parse the name if the firmware supports OP_NAME */
+ if (h->operation_code == OP_NAME) {
+ if (!hfa_get_data(hashfast, info->op_name, 32 / 4)) {
+ applog(LOG_WARNING, "%s %d: OP_NAME failed! Failure to get op_name data",
+ hashfast->drv->name, hashfast->device_id);
+ goto out;
+ }
+ info->has_opname = info->opname_valid = true;
+ applog(LOG_DEBUG, "%s: Returned an OP_NAME", hashfast->drv->name);
+ for (i = 0; i < 32; i++) {
+ if (i > 0 && info->op_name[i] == '\0')
+ break;
+ /* Make sure the op_name is valid ascii only */
+ if (info->op_name[i] < 32 || info->op_name[i] > 126) {
+ info->opname_valid = false;
+ break;
+ }
}
}
}