Browse Source

Merge branch 'cgminer' into bfgminer

Luke Dashjr 13 years ago
parent
commit
6d186b9c68
2 changed files with 29 additions and 15 deletions
  1. 11 10
      driver-bitforce.c
  2. 18 5
      miner.php

+ 11 - 10
driver-bitforce.c

@@ -388,14 +388,15 @@ static int64_t bitforce_get_result(struct thr_info *thr, struct work *work)
 		bitforce->device_not_well_reason = REASON_DEV_OVER_HEAT;
 		bitforce->device_not_well_reason = REASON_DEV_OVER_HEAT;
 		bitforce->dev_over_heat_count++;
 		bitforce->dev_over_heat_count++;
 
 
-		if (!pdevbuf[0])           /* Only return if we got nothing after timeout - there still may be results */
+		if (!pdevbuf[0])	/* Only return if we got nothing after timeout - there still may be results */
 			return 0;
 			return 0;
 	} else if (!strncasecmp(pdevbuf, "N", 1)) {/* Hashing complete (NONCE-FOUND or NO-NONCE) */
 	} else if (!strncasecmp(pdevbuf, "N", 1)) {/* Hashing complete (NONCE-FOUND or NO-NONCE) */
-		    /* Simple timing adjustment. Allow a few polls to cope with
-		     * OS timer delays being variably reliable. wait_ms will
-		     * always equal sleep_ms when we've waited greater than or
-		     * equal to the result return time.*/
-	        delay_time_ms = bitforce->sleep_ms;
+		/* Simple timing adjustment. Allow a few polls to cope with
+		 * OS timer delays being variably reliable. wait_ms will
+		 * always equal sleep_ms when we've waited greater than or
+		 * equal to the result return time.*/
+		delay_time_ms = bitforce->sleep_ms;
+
 		if (bitforce->wait_ms > bitforce->sleep_ms + (WORK_CHECK_INTERVAL_MS * 2))
 		if (bitforce->wait_ms > bitforce->sleep_ms + (WORK_CHECK_INTERVAL_MS * 2))
 			bitforce->sleep_ms += (bitforce->wait_ms - bitforce->sleep_ms) / 2;
 			bitforce->sleep_ms += (bitforce->wait_ms - bitforce->sleep_ms) / 2;
 		else if (bitforce->wait_ms == bitforce->sleep_ms) {
 		else if (bitforce->wait_ms == bitforce->sleep_ms) {
@@ -408,16 +409,16 @@ static int64_t bitforce_get_result(struct thr_info *thr, struct work *work)
 		if (delay_time_ms != bitforce->sleep_ms)
 		if (delay_time_ms != bitforce->sleep_ms)
 			  applog(LOG_DEBUG, "BFL%i: Wait time changed to: %d", bitforce->device_id, bitforce->sleep_ms, bitforce->wait_ms);
 			  applog(LOG_DEBUG, "BFL%i: Wait time changed to: %d", bitforce->device_id, bitforce->sleep_ms, bitforce->wait_ms);
 
 
-        /* Work out the average time taken. Float for calculation, uint for display */
-        bitforce->avg_wait_f += (tv_to_ms(elapsed) - bitforce->avg_wait_f) / TIME_AVG_CONSTANT;
-        bitforce->avg_wait_d = (unsigned int) (bitforce->avg_wait_f + 0.5);
+		/* Work out the average time taken. Float for calculation, uint for display */
+		bitforce->avg_wait_f += (tv_to_ms(elapsed) - bitforce->avg_wait_f) / TIME_AVG_CONSTANT;
+		bitforce->avg_wait_d = (unsigned int) (bitforce->avg_wait_f + 0.5);
 	}
 	}
 
 
 	applog(LOG_DEBUG, "BFL%i: waited %dms until %s", bitforce->device_id, bitforce->wait_ms, pdevbuf);
 	applog(LOG_DEBUG, "BFL%i: waited %dms until %s", bitforce->device_id, bitforce->wait_ms, pdevbuf);
 	if (!strncasecmp(&pdevbuf[2], "-", 1))
 	if (!strncasecmp(&pdevbuf[2], "-", 1))
 		return bitforce->nonces;   /* No valid nonce found */
 		return bitforce->nonces;   /* No valid nonce found */
 	else if (!strncasecmp(pdevbuf, "I", 1))
 	else if (!strncasecmp(pdevbuf, "I", 1))
-		return 0;          /* Device idle */
+		return 0;	/* Device idle */
 	else if (strncasecmp(pdevbuf, "NONCE-FOUND", 11)) {
 	else if (strncasecmp(pdevbuf, "NONCE-FOUND", 11)) {
 		applog(LOG_WARNING, "BFL%i: Error: Get result reports: %s", bitforce->device_id, pdevbuf);
 		applog(LOG_WARNING, "BFL%i: Error: Get result reports: %s", bitforce->device_id, pdevbuf);
 		return 0;
 		return 0;

+ 18 - 5
miner.php

@@ -982,6 +982,9 @@ function showrigs($anss, $headname, $rigname)
 
 
  foreach ($anss as $rig => $ans)
  foreach ($anss as $rig => $ans)
  {
  {
+	if ($ans == null)
+		continue;
+
 	newrow();
 	newrow();
 
 
 	$when = 0;
 	$when = 0;
@@ -1026,8 +1029,10 @@ function doforeach($cmd, $des, $sum, $head, $datetime)
 
 
  $count = 0;
  $count = 0;
  $preverr = count($rigerror);
  $preverr = count($rigerror);
- foreach ($rigs as $rig)
+ foreach ($rigs as $num => $rig)
  {
  {
+	$anss[$num] = null;
+
 	if (isset($rigerror[$rig]))
 	if (isset($rigerror[$rig]))
 		continue;
 		continue;
 
 
@@ -1040,7 +1045,7 @@ function doforeach($cmd, $des, $sum, $head, $datetime)
 		if (count($parts) > 2)
 		if (count($parts) > 2)
 			$name = $parts[2];
 			$name = $parts[2];
 		else
 		else
-			$name = $count;
+			$name = $num;
 
 
 		$ans = api($cmd);
 		$ans = api($cmd);
 
 
@@ -1053,12 +1058,14 @@ function doforeach($cmd, $des, $sum, $head, $datetime)
 			$error = null;
 			$error = null;
 		}
 		}
 		else
 		else
-			$anss[$count] = $ans;
+		{
+			$anss[$num] = $ans;
+			$count++;
+		}
 	}
 	}
-	$count++;
  }
  }
 
 
- if (count($anss) == 0)
+ if ($count == 0)
  {
  {
 	$rw = '<td>Failed to access any rigs successfully';
 	$rw = '<td>Failed to access any rigs successfully';
 	if ($preverr > 0)
 	if ($preverr > 0)
@@ -1085,6 +1092,9 @@ function doforeach($cmd, $des, $sum, $head, $datetime)
 
 
  foreach ($anss as $rig => $ans)
  foreach ($anss as $rig => $ans)
  {
  {
+	if ($ans == null)
+		continue;
+
 	foreach ($ans as $item => $row)
 	foreach ($ans as $item => $row)
 	{
 	{
 		if ($item == 'STATUS')
 		if ($item == 'STATUS')
@@ -1119,6 +1129,9 @@ function doforeach($cmd, $des, $sum, $head, $datetime)
 
 
  foreach ($anss as $rig => $ans)
  foreach ($anss as $rig => $ans)
  {
  {
+	if ($ans == null)
+		continue;
+
 	$when = 0;
 	$when = 0;
 	if (isset($ans['STATUS']['When']))
 	if (isset($ans['STATUS']['When']))
 		$when = $ans['STATUS']['When'];
 		$when = $ans['STATUS']['When'];