X-Git-Url: https://www.flypig.org.uk/git/?a=blobdiff_plain;f=src%2Fshared.c;h=5f7f5fbdb706c9315d20f89d3999d6a2c1de5160;hb=2bd49e6720dac5fac43e1aefb8ee22a8184d7f75;hp=6b5051cea56cd2a94857424d5fd10d03feaf64c3;hpb=6a2ec331efe11f36a718c60758fa0fd3db9b78fe;p=hashcat.git diff --git a/src/shared.c b/src/shared.c index 6b5051c..5f7f5fb 100644 --- a/src/shared.c +++ b/src/shared.c @@ -3398,21 +3398,6 @@ int hm_get_throttle_with_device_id (const uint device_id) return -1; } -int hm_set_fanspeed_with_device_id_xnvctrl (const uint device_id, const int fanspeed) -{ - if (data.hm_device[device_id].fan_set_supported == 1) - { - if (data.hm_xnvctrl) - { - if (set_fan_speed_target (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, fanspeed) != 0) return -1; - - return 0; - } - } - - return -1; -} - int hm_set_fanspeed_with_device_id_adl (const uint device_id, const int fanspeed, const int fanpolicy) { if (data.hm_device[device_id].fan_set_supported == 1) @@ -3453,6 +3438,43 @@ int hm_set_fanspeed_with_device_id_adl (const uint device_id, const int fanspeed return -1; } +int hm_set_fanspeed_with_device_id_nvapi (const uint device_id, const int fanspeed, const int fanpolicy) +{ + if (data.hm_device[device_id].fan_set_supported == 1) + { + if (data.hm_nvapi) + { + NV_GPU_COOLER_LEVELS CoolerLevels = { 0 }; + + CoolerLevels.Version = GPU_COOLER_LEVELS_VER | sizeof (NV_GPU_COOLER_LEVELS); + + CoolerLevels.Levels[0].Level = fanspeed; + CoolerLevels.Levels[0].Policy = fanpolicy; + + if (hm_NvAPI_GPU_SetCoolerLevels (data.hm_nvapi, data.hm_device[device_id].nvapi, 0, &CoolerLevels) != NVAPI_OK) return -1; + + return 0; + } + } + + return -1; +} + +int hm_set_fanspeed_with_device_id_xnvctrl (const uint device_id, const int fanspeed) +{ + if (data.hm_device[device_id].fan_set_supported == 1) + { + if (data.hm_xnvctrl) + { + if (set_fan_speed_target (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, fanspeed) != 0) return -1; + + return 0; + } + } + + return -1; +} + #endif // HAVE_HWMON /**