Browse Source

Merge pull request #89 from kanoi/master

Return an error if using ADL API commands when it's not available
Con Kolivas 14 years ago
parent
commit
7ac4b7806f
2 changed files with 22 additions and 1 deletions
  1. 6 1
      README
  2. 16 0
      api.c

+ 6 - 1
README

@@ -543,6 +543,10 @@ The JSON request format required is '{"command":"CMD","parameter":"PARAM"}'
 where "CMD" is from the "Request" column below and "PARAM" would be e.g.
 where "CMD" is from the "Request" column below and "PARAM" would be e.g.
 the CPU/GPU number if required.
 the CPU/GPU number if required.
 
 
+An example request in both formats:
+  gpufan|0,80
+  {"command":"gpufan","parameter":"0,80"}
+
 The format of each reply (unless stated otherwise) is a STATUS section
 The format of each reply (unless stated otherwise) is a STATUS section
 followed by an optional detail section
 followed by an optional detail section
 
 
@@ -635,7 +639,8 @@ The list of requests and replies are:
                               stating the results of setting GPU N vddc to V
                               stating the results of setting GPU N vddc to V
 
 
  save|filename none           There is no reply section just the STATUS section
  save|filename none           There is no reply section just the STATUS section
-                              stating success or failure
+                              stating success or failure saving the cgminer config
+                              to filename
 
 
  quit          none           There is no status section but just a single "BYE|"
  quit          none           There is no status section but just a single "BYE|"
                               reply before cgminer quits
                               reply before cgminer quits

+ 16 - 0
api.c

@@ -1014,6 +1014,7 @@ static void gpuintensity(SOCKETTYPE c, char *param, bool isjson)
 
 
 static void gpumem(SOCKETTYPE c, char *param, bool isjson)
 static void gpumem(SOCKETTYPE c, char *param, bool isjson)
 {
 {
+#ifdef HAVE_ADL
 	int id;
 	int id;
 	char *value;
 	char *value;
 	int clock;
 	int clock;
@@ -1027,10 +1028,14 @@ static void gpumem(SOCKETTYPE c, char *param, bool isjson)
 		strcpy(io_buffer, message(MSG_GPUMERR, id, value, isjson));
 		strcpy(io_buffer, message(MSG_GPUMERR, id, value, isjson));
 	else
 	else
 		strcpy(io_buffer, message(MSG_GPUMEM, id, value, isjson));
 		strcpy(io_buffer, message(MSG_GPUMEM, id, value, isjson));
+#else
+	strcpy(io_buffer, message(MSG_NOADL, 0, NULL, isjson));
+#endif
 }
 }
 
 
 static void gpuengine(SOCKETTYPE c, char *param, bool isjson)
 static void gpuengine(SOCKETTYPE c, char *param, bool isjson)
 {
 {
+#ifdef HAVE_ADL
 	int id;
 	int id;
 	char *value;
 	char *value;
 	int clock;
 	int clock;
@@ -1044,10 +1049,14 @@ static void gpuengine(SOCKETTYPE c, char *param, bool isjson)
 		strcpy(io_buffer, message(MSG_GPUEERR, id, value, isjson));
 		strcpy(io_buffer, message(MSG_GPUEERR, id, value, isjson));
 	else
 	else
 		strcpy(io_buffer, message(MSG_GPUENG, id, value, isjson));
 		strcpy(io_buffer, message(MSG_GPUENG, id, value, isjson));
+#else
+	strcpy(io_buffer, message(MSG_NOADL, 0, NULL, isjson));
+#endif
 }
 }
 
 
 static void gpufan(SOCKETTYPE c, char *param, bool isjson)
 static void gpufan(SOCKETTYPE c, char *param, bool isjson)
 {
 {
+#ifdef HAVE_ADL
 	int id;
 	int id;
 	char *value;
 	char *value;
 	int fan;
 	int fan;
@@ -1061,10 +1070,14 @@ static void gpufan(SOCKETTYPE c, char *param, bool isjson)
 		strcpy(io_buffer, message(MSG_GPUFERR, id, value, isjson));
 		strcpy(io_buffer, message(MSG_GPUFERR, id, value, isjson));
 	else
 	else
 		strcpy(io_buffer, message(MSG_GPUFAN, id, value, isjson));
 		strcpy(io_buffer, message(MSG_GPUFAN, id, value, isjson));
+#else
+	strcpy(io_buffer, message(MSG_NOADL, 0, NULL, isjson));
+#endif
 }
 }
 
 
 static void gpuvddc(SOCKETTYPE c, char *param, bool isjson)
 static void gpuvddc(SOCKETTYPE c, char *param, bool isjson)
 {
 {
+#ifdef HAVE_ADL
 	int id;
 	int id;
 	char *value;
 	char *value;
 	float vddc;
 	float vddc;
@@ -1078,6 +1091,9 @@ static void gpuvddc(SOCKETTYPE c, char *param, bool isjson)
 		strcpy(io_buffer, message(MSG_GPUVERR, id, value, isjson));
 		strcpy(io_buffer, message(MSG_GPUVERR, id, value, isjson));
 	else
 	else
 		strcpy(io_buffer, message(MSG_GPUVDDC, id, value, isjson));
 		strcpy(io_buffer, message(MSG_GPUVDDC, id, value, isjson));
+#else
+	strcpy(io_buffer, message(MSG_NOADL, 0, NULL, isjson));
+#endif
 }
 }
 
 
 static void send_result(SOCKETTYPE c, bool isjson);
 static void send_result(SOCKETTYPE c, bool isjson);