mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-23 23:19:09 +00:00
Do not try to set fanspeed if connection to X11 failed
This commit is contained in:
parent
9a970c0955
commit
e43be7aba3
@ -82,6 +82,8 @@ int hm_XNVCTRL_XOpenDisplay (XNVCTRL_PTR *xnvctrl)
|
||||
|
||||
if (dpy == NULL)
|
||||
{
|
||||
xnvctrl->dpy = NULL;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -92,11 +94,15 @@ int hm_XNVCTRL_XOpenDisplay (XNVCTRL_PTR *xnvctrl)
|
||||
|
||||
void hm_XNVCTRL_XCloseDisplay (XNVCTRL_PTR *xnvctrl)
|
||||
{
|
||||
if (xnvctrl->dpy == NULL) return;
|
||||
|
||||
xnvctrl->XCloseDisplay (xnvctrl->dpy);
|
||||
}
|
||||
|
||||
int get_fan_control (XNVCTRL_PTR *xnvctrl, int gpu, int *val)
|
||||
{
|
||||
if (xnvctrl->dpy == NULL) return -1;
|
||||
|
||||
int rc = xnvctrl->XNVCTRLQueryTargetAttribute (xnvctrl->dpy, NV_CTRL_TARGET_TYPE_GPU, gpu, 0, NV_CTRL_GPU_COOLER_MANUAL_CONTROL, val);
|
||||
|
||||
if (!rc) return -1;
|
||||
@ -106,6 +112,8 @@ int get_fan_control (XNVCTRL_PTR *xnvctrl, int gpu, int *val)
|
||||
|
||||
int set_fan_control (XNVCTRL_PTR *xnvctrl, int gpu, int val)
|
||||
{
|
||||
if (xnvctrl->dpy == NULL) return -1;
|
||||
|
||||
xnvctrl->XNVCTRLSetTargetAttribute (xnvctrl->dpy, NV_CTRL_TARGET_TYPE_GPU, gpu, 0, NV_CTRL_GPU_COOLER_MANUAL_CONTROL, val);
|
||||
|
||||
int cur;
|
||||
@ -121,6 +129,8 @@ int set_fan_control (XNVCTRL_PTR *xnvctrl, int gpu, int val)
|
||||
|
||||
int get_core_threshold (XNVCTRL_PTR *xnvctrl, int gpu, int *val)
|
||||
{
|
||||
if (xnvctrl->dpy == NULL) return -1;
|
||||
|
||||
int rc = xnvctrl->XNVCTRLQueryTargetAttribute (xnvctrl->dpy, NV_CTRL_TARGET_TYPE_GPU, gpu, 0, NV_CTRL_GPU_CORE_THRESHOLD, val);
|
||||
|
||||
if (!rc) return -1;
|
||||
@ -139,6 +149,8 @@ int get_fan_speed_current (XNVCTRL_PTR *xnvctrl, int gpu, int *val)
|
||||
|
||||
int get_fan_speed_target (XNVCTRL_PTR *xnvctrl, int gpu, int *val)
|
||||
{
|
||||
if (xnvctrl->dpy == NULL) return -1;
|
||||
|
||||
int rc = xnvctrl->XNVCTRLQueryTargetAttribute (xnvctrl->dpy, NV_CTRL_TARGET_TYPE_COOLER, gpu, 0, NV_CTRL_THERMAL_COOLER_LEVEL, val);
|
||||
|
||||
if (!rc) return -1;
|
||||
@ -148,6 +160,8 @@ int get_fan_speed_target (XNVCTRL_PTR *xnvctrl, int gpu, int *val)
|
||||
|
||||
int set_fan_speed_target (XNVCTRL_PTR *xnvctrl, int gpu, int val)
|
||||
{
|
||||
if (xnvctrl->dpy == NULL) return -1;
|
||||
|
||||
xnvctrl->XNVCTRLSetTargetAttribute (xnvctrl->dpy, NV_CTRL_TARGET_TYPE_COOLER, gpu, 0, NV_CTRL_THERMAL_COOLER_LEVEL, val);
|
||||
|
||||
int cur;
|
||||
|
@ -14512,7 +14512,7 @@ int main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (data.hm_adl == NULL && data.hm_nvml == NULL && data.hm_xnvctrl)
|
||||
if (data.hm_adl == NULL && data.hm_nvml == NULL && data.hm_xnvctrl == NULL)
|
||||
{
|
||||
gpu_temp_disable = 1;
|
||||
}
|
||||
@ -14654,7 +14654,7 @@ int main (int argc, char **argv)
|
||||
data.hm_device[device_id].xnvctrl = 0;
|
||||
data.hm_device[device_id].od_version = hm_adapters_adl[platform_devices_id].od_version;
|
||||
data.hm_device[device_id].fan_get_supported = hm_adapters_adl[platform_devices_id].fan_get_supported;
|
||||
data.hm_device[device_id].fan_set_supported = hm_adapters_adl[platform_devices_id].fan_set_supported;
|
||||
data.hm_device[device_id].fan_set_supported = 0;
|
||||
}
|
||||
|
||||
if (device_param->device_vendor_id == VENDOR_ID_NV)
|
||||
@ -16181,7 +16181,7 @@ int main (int argc, char **argv)
|
||||
else if (device_param->device_vendor_id == VENDOR_ID_NV)
|
||||
{
|
||||
#ifdef _POSIX
|
||||
rc = hm_set_fanspeed_with_device_id_xnvctrl (device_id, fanspeed);
|
||||
rc = set_fan_control (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
11
src/shared.c
11
src/shared.c
@ -3194,18 +3194,7 @@ int hm_get_fanpolicy_with_device_id (const uint device_id)
|
||||
|
||||
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
|
||||
{
|
||||
#if defined(LINUX)
|
||||
if (data.hm_xnvctrl)
|
||||
{
|
||||
if (set_fan_control (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE) != 0) return -1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(WIN)
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user