Commit 8307e6733ea51d3c1b0b8d9685411ac211ba500f

Con Kolivas 2014-03-29T09:59:59

Use the serial number as unique_id for cta display

diff --git a/driver-cointerra.c b/driver-cointerra.c
index 8a2ef98..f6e1b7b 100644
--- a/driver-cointerra.c
+++ b/driver-cointerra.c
@@ -519,7 +519,8 @@ static void cta_parse_statset(struct cointerra_info *info, char *buf)
 	mutex_unlock(&info->lock);
 }
 
-static void cta_parse_info(struct cointerra_info *info, char *buf)
+static void cta_parse_info(struct cgpu_info *cointerra, struct cointerra_info *info,
+			   char *buf)
 {
 	mutex_lock(&info->lock);
 	info->hwrev = hu64_from_msg(buf, CTA_INFO_HWREV);
@@ -538,6 +539,12 @@ static void cta_parse_info(struct cointerra_info *info, char *buf)
 	info->min_diffbits = u8_from_msg(buf, CTA_INFO_MINDIFFBITS);
 	info->max_diffbits = u8_from_msg(buf, CTA_INFO_MAXDIFFBITS);
 	mutex_unlock(&info->lock);
+
+	if (!cointerra->unique_id) {
+		uint32_t b32 = htobe32(info->serial);
+
+		cointerra->unique_id = bin2hex((unsigned char *)&b32, 4);
+	}
 }
 
 static void cta_parse_rdone(struct cgpu_info *cointerra, struct cointerra_info *info,
@@ -649,7 +656,7 @@ static void cta_parse_msg(struct thr_info *thr, struct cgpu_info *cointerra,
 		case CTA_RECV_INFO:
 			applog(LOG_DEBUG, "%s %d: Info message received",
 			       cointerra->drv->name, cointerra->device_id);
-			cta_parse_info(info, buf);
+			cta_parse_info(cointerra, info, buf);
 			break;
 		case CTA_RECV_MSG:
 			applog(LOG_NOTICE, "%s %d: MSG: %s",