private static bool NvPowerPoliciesSetStatus(int busId, ref NvGpuPowerStatus info) { if (NvapiNativeMethods.NvPowerPoliciesSetStatus == null) { return(false); } try { if (!HandlesByBusId.TryGetValue(busId, out NvPhysicalGpuHandle handle)) { return(false); } var r = NvapiNativeMethods.NvPowerPoliciesSetStatus(handle, ref info); if (r != NvStatus.NVAPI_OK) { NTMinerConsole.DevError(() => $"{nameof(NvapiNativeMethods.NvPowerPoliciesSetStatus)} {r.ToString()}"); } if (r == NvStatus.NVAPI_OK) { return(true); } } catch { } return(false); }
private bool NvPowerPoliciesSetStatus(int busId, ref NvGpuPowerStatus info) { if (NvapiNativeMethods.NvPowerPoliciesSetStatus == null) { return(false); } try { if (!HandlesByBusId.TryGetValue(busId, out NvPhysicalGpuHandle handle)) { return(false); } info.version = (uint)(VERSION1 | (Marshal.SizeOf(typeof(NvGpuPowerStatus)))); var r = NvapiNativeMethods.NvPowerPoliciesSetStatus(handle, ref info); if (r != NvStatus.NVAPI_OK) { Write.DevError($"{nameof(NvapiNativeMethods.NvPowerPoliciesSetStatus)} {r.ToString()}"); } if (r == NvStatus.NVAPI_OK) { return(true); } } catch { } return(false); }
private bool NvPowerPoliciesSetStatus(int busId, ref NvGpuPowerStatus info) { if (NvapiNativeMethods.NvPowerPoliciesSetStatus == null) { return(false); } try { info.version = (uint)(VERSION1 | (Marshal.SizeOf(typeof(NvGpuPowerStatus)))); var r = NvapiNativeMethods.NvPowerPoliciesSetStatus(HandlesByBusId[busId], ref info); if (r != NvStatus.OK) { Write.DevError($"{nameof(NvapiNativeMethods.NvPowerPoliciesSetStatus)} {r}"); } if (r == NvStatus.OK) { return(true); } } catch { } return(false); }