Commit ed60e33a940e0af7efbe6b50824b0dd87f576999

nelisky 2012-05-04T08:33:13

Some tweaks to reporting and logging. - Adding fpga number to the ztex string representation - Removing usb details from the ztex string representation - First frequency set no longer reports a bogus old freq

diff --git a/driver-ztex.c b/driver-ztex.c
index bbfd9b1..c881cd7 100644
--- a/driver-ztex.c
+++ b/driver-ztex.c
@@ -90,6 +90,7 @@ static void ztex_detect(void)
 			ztex->threads = 1;
 			ztex_slave->fpgaNum = j;
 			ztex_slave->root = ztex_devices[i]->dev;
+			ztex_slave->repr[strlen(ztex_slave->repr) - 1] = ('1' + j);
 			add_cgpu(ztex);
 		}
 
@@ -346,7 +347,7 @@ static uint64_t ztex_scanhash(struct thr_info *thr, struct work *work,
 static void ztex_statline_before(char *buf, struct cgpu_info *cgpu)
 {
 	if (cgpu->deven == DEV_ENABLED) {
-		tailsprintf(buf, "%s | ", cgpu->device_ztex->snString);
+		tailsprintf(buf, "%s-%d | ", cgpu->device_ztex->snString, cgpu->device_ztex->fpgaNum+1);
 		tailsprintf(buf, "%0.2fMhz | ", cgpu->device_ztex->freqM1 * (cgpu->device_ztex->freqM + 1));
 	}
 }
@@ -364,8 +365,9 @@ static bool ztex_prepare(struct thr_info *thr)
 	if (libztex_configureFpga(ztex) != 0)
 		return false;
 	ztex_releaseFpga(ztex);
-	ztex->freqM = -1;
-	ztex_updateFreq(ztex);
+	ztex->freqM = ztex->freqMaxM+1;;
+	//ztex_updateFreq(ztex);
+	libztex_setFreq(ztex, ztex->freqMDefault);
 	applog(LOG_DEBUG, "%s: prepare", ztex->repr);
 	return true;
 }
diff --git a/libztex.c b/libztex.c
index 1762a48..ffc2e67 100644
--- a/libztex.c
+++ b/libztex.c
@@ -381,7 +381,7 @@ int libztex_setFreq(struct libztex_device *ztex, uint16_t freq) {
 		return cnt;
 	}
 	ztex->freqM = freq;
-	if (oldfreq == -1) 
+	if (oldfreq > ztex->freqMaxM) 
 		applog(LOG_WARNING, "%s: Frequency set to %0.2f Mhz",
 		       ztex->repr, ztex->freqM1 * (ztex->freqM + 1));
 	else
@@ -535,7 +535,7 @@ int libztex_prepare_device(struct libusb_device *dev, struct libztex_device** zt
 
 	newdev->usbbus = libusb_get_bus_number(dev);
 	newdev->usbaddress = libusb_get_device_address(dev);
-	sprintf(newdev->repr, "ZTEX %.3d:%.3d-%s", newdev->usbbus, newdev->usbaddress, newdev->snString);
+	sprintf(newdev->repr, "ZTEX %s-1", newdev->snString);
 	newdev->valid = true;
 	return 0;
 }
diff --git a/libztex.h b/libztex.h
index 287b618..d424545 100644
--- a/libztex.h
+++ b/libztex.h
@@ -78,7 +78,7 @@ struct libztex_device {
 	int selectedFpga;
 	bool parallelConfigSupport;
 	
-	char repr[64];
+	char repr[20];
 };
 
 struct libztex_dev_list {