1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-05-31 13:18:49 +00:00

Simplify --gpu-temp-retain handling code

This commit is contained in:
jsteube 2016-11-20 16:08:10 +01:00
parent 7ae025efce
commit c58027c7f6

View File

@ -177,11 +177,12 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
myabort (hashcat_ctx); myabort (hashcat_ctx);
} }
if (hwmon_ctx->hm_device[device_id].fan_get_supported == false) continue;
if (hwmon_ctx->hm_device[device_id].fan_set_supported == false) continue;
const u32 gpu_temp_retain = user_options->gpu_temp_retain; const u32 gpu_temp_retain = user_options->gpu_temp_retain;
if (gpu_temp_retain) if (gpu_temp_retain > 0)
{
if (hwmon_ctx->hm_device[device_id].fan_set_supported == true)
{ {
int temp_cur = temperature; int temp_cur = temperature;
@ -235,13 +236,15 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
} }
else if (device_param->device_vendor_id == VENDOR_ID_NV) else if (device_param->device_vendor_id == VENDOR_ID_NV)
{ {
#if defined (_WIN) if (hwmon_ctx->hm_nvapi)
{
hm_set_fanspeed_with_device_id_nvapi (hashcat_ctx, device_id, fan_speed_new, 1); hm_set_fanspeed_with_device_id_nvapi (hashcat_ctx, device_id, fan_speed_new, 1);
#endif }
#if defined (__linux__) if (hwmon_ctx->hm_xnvctrl)
{
hm_set_fanspeed_with_device_id_xnvctrl (hashcat_ctx, device_id, fan_speed_new); hm_set_fanspeed_with_device_id_xnvctrl (hashcat_ctx, device_id, fan_speed_new);
#endif }
} }
fan_speed_chgd[device_id] = 1; fan_speed_chgd[device_id] = 1;
@ -252,7 +255,6 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
} }
} }
} }
}
hc_thread_mutex_unlock (status_ctx->mux_hwmon); hc_thread_mutex_unlock (status_ctx->mux_hwmon);
} }