Browse Source

set_device_funcs support for returning messages on success

Luke Dashjr 12 years ago
parent
commit
84462f8031
3 changed files with 9 additions and 3 deletions
  1. 5 1
      api.c
  2. 1 0
      driver-bitforce.c
  3. 3 2
      miner.c

+ 5 - 1
api.c

@@ -486,6 +486,7 @@ struct CODES {
  { SEVERITY_WARN,  MSG_PGANOSET, PARAM_PGA,	"PGA %d does not support pgaset" },
  { SEVERITY_INFO,  MSG_PGAHELP, PARAM_BOTH,	"PGA %d set help: %s" },
  { SEVERITY_SUCC,  MSG_PGASETOK, PARAM_PGA,	"PGA %d set OK" },
+ { SEVERITY_SUCC,  MSG_PGASETOK | USE_ALTMSG, PARAM_BOTH,	"PGA %d set OK: %s" },
  { SEVERITY_ERR,   MSG_PGASETERR, PARAM_BOTH,	"PGA %d set failed: %s" },
 #endif
  { SEVERITY_ERR,   MSG_ZERMIS,	PARAM_NONE,	"Missing zero parameters" },
@@ -3353,7 +3354,10 @@ static void pgaset(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __maybe
 			message(io_data, MSG_PGAHELP, id, ret, isjson);
 			break;
 		case SDR_OK:
-			message(io_data, MSG_PGASETOK, id, NULL, isjson);
+			if (ret)
+				message(io_data, MSG_PGASETOK | USE_ALTMSG, id, ret, isjson);
+			else
+				message(io_data, MSG_PGASETOK, id, NULL, isjson);
 			break;
 		case SDR_UNKNOWN:
 		case SDR_ERR:

+ 1 - 0
driver-bitforce.c

@@ -1589,6 +1589,7 @@ const char *bitforce_rpc_send_cmd1(struct cgpu_info * const proc, const char * c
 		fd = proc->device->device_fd;
 		bitforce_cmd1b(fd, data->xlink_id, replybuf, 8000, setting, strlen(setting));
 		mutex_unlock(mutexp);
+		*success = SDR_OK;
 		return replybuf;
 	}
 }

+ 3 - 2
miner.c

@@ -9805,8 +9805,9 @@ void cgpu_set_defaults(struct cgpu_info * const cgpu)
 		switch (success)
 		{
 			case SDR_OK:
-				applog(LOG_DEBUG, "%"PRIpreprv": Applied rule %s",
-				       cgpu->proc_repr, setstr);
+				applog(LOG_DEBUG, "%"PRIpreprv": Applied rule %s%s%s",
+				       cgpu->proc_repr, setstr,
+				       p ? ": " : "", p ?: "");
 				break;
 			case SDR_ERR:
 			case SDR_HELP: