New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: fan control #1227
base: master
Are you sure you want to change the base?
Feature: fan control #1227
Conversation
8bf3e37
to
13fceca
Compare
driver/razerchromacommon.c
Outdated
struct razer_report report = get_razer_report(0x0d, 0x02, 0x04); | ||
report.arguments[0] = 0x00; //frame_id: fixed value | ||
report.arguments[1] = fan_id; //maybe fans can be set separately by id? | ||
report.arguments[2] = 0x00; // unknown observed: 0x00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This argument is for power mode of the CPU,
0 - balanced
1 - gaming
2 - creator
4 - custom
with 4 goes CPU boost and GPU boost power
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx! added now
Can you please remove the non fan-speed changes from this PR (and potentially put them into a separate PR)? Also generally I'm not comfortable with copying the raw frames from the moon effect into openrazer. |
6bdae45
to
e526e5b
Compare
yes, sorry for that, late night branching and such.
that was expected, just difficult to have a showcase for the extended_custom_frame feature. I'll take this comment over to the PR #1222 |
da189f1
to
3c9b2b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple of comments, thanks for the update
ec95082
to
b55ac8f
Compare
a7c282b
to
a1c6cb1
Compare
I've squashed the commits and fixed up a few things now. Question: do you think this functionality is available on all these devices? If yes we should also add the fan methods to the daemon for these devices. If not, then we need to adjust razerkbd_driver.c |
I assume it is since the other features are identical but I have not way of knowing or testing |
Then please add the methods in the daemon for these devices as well. If it doesn't work on some of those we can remove it in another release. |
@vvvrrooomm are you still on this pr? |
merger add game_mode satisfy auto-generate-script read support for fan_speed & fan_mode rework interface: each fan has his own files now fan control: fix python dbus interface after rework fan speed rework python interface fan speed: fix python interface, getter read-only, right amount of bytes fan speed: remove debug output from driver, fixup output format fan speed: fix kernel driver bug: duplicate sys files were created fan speed:kernel interface consistent is [byte] fan_speed: satisfy script after change of kernel driver * change cfg * enhance script to accept digits in sys files fan_speed: do not use format-strings WIP: DO NOT PUSH: new local version fan_speeed: convert sysfs interfcae to binary mode fan_control: add defaults spaces anf formatting fix: accidentally activate effect for RAZER_BLADE_EARLY_2020_BASE update fake_driver after fix RAZER_BLADE_EARLY_2020_BASE fx fixes from review fixup
a1c6cb1
to
8b20eed
Compare
8b20eed
to
008d199
Compare
Feature added in openrazer/openrazer#1227. Based on original pull requests #275 and #301. Co-authored-by: Martin Haaß <vvvrrooomm@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upon request of a user, I was updating a stale pull request polychromatic/polychromatic#301 to implement a frontend for testing. However, I found the API in its current state difficult to work with and propose some amendments.
device.fx.fan_mode(mode_automatic, game_mode_balanced) | ||
|
||
elif effect == 'fan_speed': | ||
result = device.fx.fan_speed() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example is outdated, it's now device.get_fan_speed(<fan_id>)
when testing under fake driver conditions. Same with other get/set functions.
mode_manual = 0x01 | ||
mode_automatic = 0x01 | ||
|
||
game_mode_balanced = 0x00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems each interface to the API needs to "know" these exact bytes rather then passing an integer/object. May we "hardcode" them into the Python library and/or daemon so they can be validated?
For example, the reactive has a time
and needs to be one of REACTIVE_
values.
def get_fan_mode(self, fan_id): | ||
""" | ||
get fan mode | ||
:return fan_id: might change fans separately if more than one available (ususally 0x00) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A function like get_fan_count()
to return an int
of how many fans are present would be useful.
Currently, there's no way to know how many fans are present for a device. The API so far is too dynamic that it could cause a FileNotFoundError
trying a fan_id
too high (like 3
)
""" | ||
get fan speed | ||
:return fan_speed: speed in RPM/100 | ||
Values appear to be RPM/100, observed were 0x2b - 0x36, i.e. 4300RPM - 5400RPM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dealing with bytes for scripts/apps seems too low level for higher level API usage. Please may we have the daemon convert them to an int
to get/set a RPM value?
Plus, please could we add a variable for the min/max RPM values? Hardcoding the value should be fine, until it's known a laptop could spin faster then 5400 RPM, or less then 4300 RPM.
1 - gaming | ||
2 - creator | ||
4 - custom | ||
with 4 goes CPU boost and GPU boost power |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does 4 - custom
mean exactly? Does this set the laptop for maximum CPU/GPU performance? Would 4 - turbo
or 4 - max
make more sense name wise?
Seems a bit confusing to me having both fans and CPU governors mixed into one. Unless the fans make different sounds depending on which one is selected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With 4 on https://github.com/rnd-ash/razer-laptop-control you can set CPU und GPU seperatly from each other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does it work in this context (fan_id, fan_mode, game_mode)
? Is fan 1 = CPU and fan 2 = GPU? Does this control the CPU/GPU frequency of that component or only the noise profile?
Still unclear with 4's purpose. Please could you show screenshots from Synapse of how these options work? 📸
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set fan mode | ||
:param fan_id: might change fans separately if more than one available (ususally 0x00) | ||
:param fan_mode: 0x00: automatic 0x01: manual | ||
:param game_mode: This argument is for power mode of the CPU, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth validating this field, so it's not too dynamic that bad/unknown data could be sent (6
for instance).
For example, the reactive has a time and needs to be one of REACTIVE_
values.
Maybe the Infos can be found in this project: https://github.com/rnd-ash/razer-laptop-control |
Razer Blade 15 Base (Early 2021) Infos from Synapse Windows I know that the Laptop have two fans one CPU and one GPU. |
fan_id is wrong its 0x01 and 0x02 sys/devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8:1.2/0003:1532:026F.0009 dir heavy_check_mark |
I hope somebody would be willing to take another look at this at some point-- fan control would be a game changer for linux on balde devices. If I knew anything about drivers, I'd be in here trying to help. |
I can take a look at this. I am the current maintainer of the razer-laptop-control. Python is not my strong side... |
I'm happy to try to help with any Python stuff if the driver itself is in good shape. That's definitly more in my comfort zone. |
There some something posted in #892 (comment), just linking so it's not hidden forever. |
This adds two new functions: fan mode and fan speed
Functionality as observed on BLADE_EARLY_2020_BASE:
fan speed can only vary between 0x2b - 0x36, the value seems to be RPM/100