CGPU API for device names
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 71 72 73 74 75 76 77 78 79 80 81
diff --git a/adl.c b/adl.c
index 7a4707e..0626cff 100644
--- a/adl.c
+++ b/adl.c
@@ -340,6 +340,9 @@ void init_adl(int nDevs)
}
applog(LOG_INFO, "GPU %d %s hardware monitoring enabled", gpu, lpInfo[i].strAdapterName);
+ if (gpus[gpu].name)
+ free(gpus[gpu].name);
+ gpus[gpu].name = lpInfo[i].strAdapterName;
gpus[gpu].has_adl = true;
/* Flag adl as active if any card is successfully activated */
adl_active = true;
diff --git a/cgminer.c b/cgminer.c
index 84019bb..7a69cee 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -4455,7 +4455,11 @@ int main (int argc, char *argv[])
if (devices_enabled == -1) {
applog(LOG_ERR, "Devices detected:");
for (i = 0; i < total_devices; ++i) {
- applog(LOG_ERR, " %2d. %s%d (driver: %s)", i, devices[i]->api->name, devices[i]->device_id, devices[i]->api->dname);
+ struct cgpu_info *cgpu = devices[i];
+ if (cgpu->name)
+ applog(LOG_ERR, " %2d. %s %d: %s (driver: %s)", i, cgpu->api->name, cgpu->device_id, cgpu->name, cgpu->api->dname);
+ else
+ applog(LOG_ERR, " %2d. %s %d (driver: %s)", i, cgpu->api->name, cgpu->device_id, cgpu->api->dname);
}
quit(0, "%d devices listed", total_devices);
}
diff --git a/driver-bitforce.c b/driver-bitforce.c
index 3c93c55..991355f 100644
--- a/driver-bitforce.c
+++ b/driver-bitforce.c
@@ -91,6 +91,7 @@ static void BFwrite(int fd, const void *buf, ssize_t bufLen)
static bool bitforce_detect_one(const char *devpath)
{
+ char *s;
char pdevbuf[0x100];
if (total_devices == MAX_DEVICES)
@@ -120,6 +121,12 @@ static bool bitforce_detect_one(const char *devpath)
bitforce->device_path = strdup(devpath);
bitforce->deven = DEV_ENABLED;
bitforce->threads = 1;
+ if (likely((!memcmp(pdevbuf, ">>>ID: ", 7)) && (s = strstr(pdevbuf + 3, ">>>"))))
+ {
+ s[0] = '\0';
+ bitforce->name = strdup(pdevbuf + 7);
+ }
+
return add_cgpu(bitforce);
}
diff --git a/driver-opencl.c b/driver-opencl.c
index 7d8197a..95139c3 100644
--- a/driver-opencl.c
+++ b/driver-opencl.c
@@ -1188,6 +1188,8 @@ static bool opencl_thread_prepare(struct thr_info *thr)
cgpu->status = LIFE_NOSTART;
return false;
}
+ if (name && !cgpu->name)
+ cgpu->name = strdup(name);
applog(LOG_INFO, "initCl() finished. Found %s", name);
gettimeofday(&now, NULL);
get_datestamp(cgpu->init, &now);
diff --git a/miner.h b/miner.h
index 259a85e..071ad0b 100644
--- a/miner.h
+++ b/miner.h
@@ -226,6 +226,7 @@ struct cgpu_info {
int cgminer_id;
struct device_api *api;
int device_id;
+ char *name;
char *device_path;
FILE *device_file;
int device_fd;