mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-01 01:14:22 +00:00
adl: rename adl_errors() to adl_error_desc(), shorten error desc's, handle unknown error
This commit is contained in:
parent
b298675896
commit
3ae7531fa9
32
adl.c
32
adl.c
@ -126,56 +126,56 @@ static LPADLDisplayInfo lpAdlDisplayInfo = NULL;
|
|||||||
int set_fanspeed(int gpu, int iFanSpeed);
|
int set_fanspeed(int gpu, int iFanSpeed);
|
||||||
static float __gpu_temp(struct gpu_adl *ga);
|
static float __gpu_temp(struct gpu_adl *ga);
|
||||||
|
|
||||||
char *adl_errors(int error)
|
char *adl_error_desc(int error)
|
||||||
{
|
{
|
||||||
char *result;
|
char *result;
|
||||||
switch(error)
|
switch(error)
|
||||||
{
|
{
|
||||||
case ADL_ERR:
|
case ADL_ERR:
|
||||||
result = "Generic Error. Most likely one or more of the Escape calls to the driver failed!";
|
result = "Generic error (escape call failed?)";
|
||||||
break;
|
break;
|
||||||
case ADL_ERR_NOT_INIT:
|
case ADL_ERR_NOT_INIT:
|
||||||
result = "ADL not initialized";
|
result = "ADL not initialized";
|
||||||
break;
|
break;
|
||||||
case ADL_ERR_INVALID_PARAM:
|
case ADL_ERR_INVALID_PARAM:
|
||||||
result = "One of the parameter passed is invalid";
|
result = "Invalid parameter";
|
||||||
break;
|
break;
|
||||||
case ADL_ERR_INVALID_PARAM_SIZE:
|
case ADL_ERR_INVALID_PARAM_SIZE:
|
||||||
result = "One of the parameter size is invalid";
|
result = "Invalid parameter size";
|
||||||
break;
|
break;
|
||||||
case ADL_ERR_INVALID_ADL_IDX:
|
case ADL_ERR_INVALID_ADL_IDX:
|
||||||
result = "Invalid ADL index passed";
|
result = "Invalid ADL index";
|
||||||
break;
|
break;
|
||||||
case ADL_ERR_INVALID_CONTROLLER_IDX:
|
case ADL_ERR_INVALID_CONTROLLER_IDX:
|
||||||
result = "Invalid controller index passed";
|
result = "Invalid controller index";
|
||||||
break;
|
break;
|
||||||
case ADL_ERR_INVALID_DIPLAY_IDX:
|
case ADL_ERR_INVALID_DIPLAY_IDX:
|
||||||
result = "Invalid display index passed";
|
result = "Invalid display index";
|
||||||
break;
|
break;
|
||||||
case ADL_ERR_NOT_SUPPORTED:
|
case ADL_ERR_NOT_SUPPORTED:
|
||||||
result = "Function not supported by the driver";
|
result = "Function not supported by the driver";
|
||||||
break;
|
break;
|
||||||
case ADL_ERR_NULL_POINTER:
|
case ADL_ERR_NULL_POINTER:
|
||||||
result = "Null Pointer error";
|
result = "Null Pointer error";
|
||||||
break;
|
break;
|
||||||
case ADL_ERR_DISABLED_ADAPTER:
|
case ADL_ERR_DISABLED_ADAPTER:
|
||||||
result = "Call can't be made due to disabled adapter";
|
result = "Disabled adapter, can't make call";
|
||||||
break;
|
break;
|
||||||
case ADL_ERR_INVALID_CALLBACK:
|
case ADL_ERR_INVALID_CALLBACK:
|
||||||
result = "Invalid Callback";
|
result = "Invalid callback";
|
||||||
break;
|
break;
|
||||||
case ADL_ERR_RESOURCE_CONFLICT:
|
case ADL_ERR_RESOURCE_CONFLICT:
|
||||||
result = "Display Resource conflict";
|
result = "Display resource conflict";
|
||||||
break;
|
break;
|
||||||
case ADL_ERR_SET_INCOMPLETE:
|
case ADL_ERR_SET_INCOMPLETE:
|
||||||
result = "Failed to update some of the values. Can be returned by set request that include multiple values if not all values were successfully committed.";
|
result = "Failed to update some of the values";
|
||||||
break;
|
break;
|
||||||
case ADL_ERR_NO_XDISPLAY:
|
case ADL_ERR_NO_XDISPLAY:
|
||||||
result = "There's no Linux XDisplay in Linux Console environment";
|
result = "No Linux XDisplay in Linux Console environment";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
result = "Unhandled error";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -304,13 +304,13 @@ static bool prepare_adl(void)
|
|||||||
// retrieve adapter information only for adapters that are physically present and enabled in the system
|
// retrieve adapter information only for adapters that are physically present and enabled in the system
|
||||||
result = ADL_Main_Control_Create(ADL_Main_Memory_Alloc, 1);
|
result = ADL_Main_Control_Create(ADL_Main_Memory_Alloc, 1);
|
||||||
if (result != ADL_OK) {
|
if (result != ADL_OK) {
|
||||||
applog(LOG_INFO, "ADL initialisation error: %d! %s", result, adl_errors(result));
|
applog(LOG_INFO, "ADL initialisation error: %d (%s)", result, adl_error_desc(result));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ADL_Main_Control_Refresh();
|
result = ADL_Main_Control_Refresh();
|
||||||
if (result != ADL_OK) {
|
if (result != ADL_OK) {
|
||||||
applog(LOG_INFO, "ADL refresh error: %d! %s", result, adl_errors(result));
|
applog(LOG_INFO, "ADL refresh error: %d (%s)", result, adl_error_desc(result));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user