1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 07:17:58 +00:00

api.c notify should report disabled devices also - of course

This commit is contained in:
Kano 2012-03-23 10:00:23 +11:00
parent 18a8b5506e
commit 25ca0687a1

14
api.c
View File

@ -1660,17 +1660,9 @@ void notifystatus(int device, struct cgpu_info *cgpu, bool isjson)
static void notify(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson) static void notify(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson)
{ {
int devcount = 0;
int i; int i;
for (i = 0; i < total_devices; i++) { if (total_devices == 0) {
if (devices[i]->deven == DEV_ENABLED) {
devcount++;
break;
}
}
if (devcount == 0) {
strcpy(io_buffer, message(MSG_NODEVS, 0, NULL, isjson)); strcpy(io_buffer, message(MSG_NODEVS, 0, NULL, isjson));
return; return;
} }
@ -1682,10 +1674,8 @@ static void notify(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool
strcat(io_buffer, JSON_NOTIFY); strcat(io_buffer, JSON_NOTIFY);
} }
devcount = 0;
for (i = 0; i < total_devices; i++) for (i = 0; i < total_devices; i++)
if (devices[i]->deven == DEV_ENABLED) notifystatus(i, devices[i], isjson);
notifystatus(devcount++, devices[i], isjson);
if (isjson) if (isjson)
strcat(io_buffer, JSON_CLOSE); strcat(io_buffer, JSON_CLOSE);