Display a unique identifier instead of a number if the device has one
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
diff --git a/cgminer.c b/cgminer.c
index 057297e..d7a5432 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -2675,14 +2675,13 @@ static void adj_fwidth(float var, int *length)
(*length)++;
}
-static int dev_width;
#define STATBEFORELEN 23
const char blanks[] = " ";
static void curses_print_devstatus(struct cgpu_info *cgpu, int devno, int count)
{
static int devno_width = 1, dawidth = 1, drwidth = 1, hwwidth = 1, wuwidth = 1;
- char logline[256];
+ char logline[256], unique_id[12];
struct timeval now;
double dev_runtime, wu;
unsigned int devstatlen;
@@ -2711,8 +2710,14 @@ static void curses_print_devstatus(struct cgpu_info *cgpu, int devno, int count)
wmove(statuswin,devcursor + count, 0);
adj_width(devno, &devno_width);
- cg_wprintw(statuswin, " %*d: %s %*d: ", devno_width, devno, cgpu->drv->name,
- dev_width, cgpu->device_id);
+ if (cgpu->unique_id) {
+ unique_id[8] = '\0';
+ memcpy(unique_id, blanks, 8);
+ strncpy(unique_id, cgpu->unique_id, 8);
+ } else
+ sprintf(unique_id, "%-8d", cgpu->device_id);
+ cg_wprintw(statuswin, " %*d: %s %8s: ", devno_width, devno, cgpu->drv->name,
+ unique_id);
logline[0] = '\0';
cgpu->drv->get_statline_before(logline, sizeof(logline), cgpu);
devstatlen = strlen(logline);
@@ -8959,17 +8964,11 @@ void enable_device(struct cgpu_info *cgpu)
devices[cgpu->cgminer_id = cgminer_id_count++] = cgpu;
wr_unlock(&devices_lock);
- if (hotplug_mode) {
+ if (hotplug_mode)
new_threads += cgpu->threads;
-#ifdef HAVE_CURSES
- adj_width(mining_threads + new_threads, &dev_width);
-#endif
- } else {
+ else
mining_threads += cgpu->threads;
-#ifdef HAVE_CURSES
- adj_width(mining_threads, &dev_width);
-#endif
- }
+
rwlock_init(&cgpu->qlock);
cgpu->queued_work = NULL;
}
diff --git a/miner.h b/miner.h
index 9f4cb0e..1910fe8 100644
--- a/miner.h
+++ b/miner.h
@@ -428,6 +428,7 @@ struct cgpu_info {
char *name;
char *device_path;
void *device_data;
+ char *unique_id;
#ifdef USE_USBUTILS
struct cg_usb_device *usbdev;
struct cg_usb_info usbinfo;