1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-03-13 06:01:03 +00:00

CGPU API for device names

This commit is contained in:
Luke Dashjr 2012-03-18 21:06:47 -04:00
parent 303dbf4664
commit f05a319e01
5 changed files with 18 additions and 1 deletions

3
adl.c
View File

@ -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;

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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;