Repository navigation
docs: document NoPermission for the fan control setters - #148
Merged
Merged
Conversation
Device::set_fan_speed(), Device::set_default_fan_speed() and Device::set_fan_control_policy() did not list NoPermission among their errors. rust-nvml#64 reports set_fan_speed() returning it, from a fork of this crate, after adding udev rules that set the /dev/nvidia* device nodes to mode 0666. The NVML header's return lists for nvmlDeviceSetFanSpeed_v2, nvmlDeviceSetDefaultFanSpeed_v2 and nvmlDeviceSetFanControlPolicy do not include NVML_ERROR_NO_PERMISSION, so each doc says so. The header says nvmlDeviceSetFanControlPolicy requires a privileged user, so Device::set_fan_control_policy() now states that it requires root/admin permissions. Also fixes a doubled "the" in set_default_fan_speed()'s summary. Refs rust-nvml#64 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tested on an RTX 4090 with driver 550.163.01 in a Debian 13 guest, with the /dev/nvidia* nodes at mode 0666 (NVreg DeviceFileMode 438): - As uid 1000, set_fan_speed(), set_default_fan_speed() and set_fan_control_policy() each returned NoPermission on both fans, and the fan control policy did not change. - As root, all three returned Ok. The policy was Manual after set_fan_speed() and after set_fan_control_policy(Manual), and TemperatureContinousSw after set_default_fan_speed(). So all three now say "Requires root/admin permissions." Refs rust-nvml#64 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #64.
Device::set_fan_speed(),Device::set_default_fan_speed()andDevice::set_fan_control_policy()now say "Requires root/admin permissions." and listNoPermissionamong their errors. #64 reportsset_fan_speed()returningNoPermissionafter the reporter set the/dev/nvidia*device nodes to mode 0666 with udev rules.Hardware test
I ran a probe built from this branch on an RTX 4090 with driver 550.163.01, in a Debian 13 guest (kernel 6.12) with the GPU passed through.
/dev/nvidia0,nvidiactl,nvidia-uvmandnvidia-uvm-toolswere already mode 0666 (DeviceFileMode: 438). Results on both fans:set_fan_speed(50)NoPermission, policy unchangedOk, policyManualset_default_fan_speedNoPermissionOk, policyTemperatureContinousSwset_fan_control_policy(Manual)NoPermissionOk, policyManualset_fan_control_policy(TemperatureContinousSw)NoPermissionOkBoth fans ended on
TemperatureContinousSw.Not tested:
Decisions for the reviewer
nvml-wrapper-sys/nvml.h) listsNVML_ERROR_NO_PERMISSIONfor none ofnvmlDeviceSetFanSpeed_v2,nvmlDeviceSetDefaultFanSpeed_v2ornvmlDeviceSetFanControlPolicy, so eachNoPermissionentry notes this. The header does saynvmlDeviceSetFanControlPolicy"Requires privileged user".device.rs: "Requires root/admin permissions." and "if the user doesn't have permission to perform this operation".Testing
cargo fmt --all -- --check: clean.cargo clippy --all-targets --all-features -- -D warnings: clean.cargo doc -p nvml-wrapper --no-deps: the same 4 warnings as onmain, inenums/device.rsandenum_wrappers/device.rs.Review
Three fresh-agent reviews ran before push.
(#64)in rustdoc. The draft also applied one function's report to another and omitted the header caveat onset_fan_control_policy. All four were fixed, and "Closes" became "Refs".NoPermissioncondition stronger than the test showsset_fan_control_policy(TemperatureContinousSw)with a policy reading it didn't produceProblems seen nearby and not fixed here:
get_fan_control_policyatenums/device.rs:408UnexpectedVariant, for which you can read the docs for", which is unfinished in several places🤖 Generated with Claude Code