Skip to content
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

How temperatures are changed #57

Closed
Greifent opened this issue Aug 1, 2020 · 9 comments
Closed

How temperatures are changed #57

Greifent opened this issue Aug 1, 2020 · 9 comments
Assignees
Labels
question Further information is requested

Comments

@Greifent
Copy link

Greifent commented Aug 1, 2020

Additional context
I was looking at the source code but since my understanding of bash is not good I couldn't figure it out: how are the temperatures set? And which system variable is used to read the temperature of the computer and select the correct fan speed?
This is for a thing that I would like to add on the GUI.
Thanks

@Greifent Greifent added the question Further information is requested label Aug 1, 2020
@dominiksalvet
Copy link
Owner

Hello @Greifent! 👋

how are the temperatures set?

The lowest level of setting temperatures in asus-fan-control is write_acpi_temp() function. It sets a single temperature at a given address with a given value. This function is called by write_temps() several times.

The write_temps() function gets the base address and a list of temperature values. It sets the temperature at the base address with the first temperature of the list and continues with base address + 1 and the second temperature of the list. That repeats for all values of the list.

This is how the temperatures are actually set to ACPI/hardware. All wrapper functions just check temperature values, and their number based on model information stored in models file. If there is no record for a device (not tested ones), it will use defaults from UX430UA model.

Did you know you can enable execution tracing? E.g. for sudo asus-fan-control get-temps, you can use sudo sh -x /usr/local/bin/asus-fan-control get-temps and you will see every step the program does. How handy! 🚀


And which system variable is used to read the temperature of the computer and select the correct fan speed?

Did I answer this above with the models file? If not, please clarify this question. BTW, there are functions with similar yet opposite effects as the ones above – read_acpi_temp() and read_temps().

@Greifent
Copy link
Author

Greifent commented Aug 3, 2020

Thanks, that helped clarifying what the acpi do.
I meant: how the computer know the current temperature inside? Which sensor does it use? There is a way to know the temperature that the program use?

@dominiksalvet
Copy link
Owner

Ah I see. Asus-fan-control uses ACPI entry points \_SB.PCI0.LPCB.EC0.RRAM for read and \_SB.PCI0.LPCB.EC0.WRAM for write. Those entry points are used in the mentioned write_acpi_temp() and read_acpi_temp() functions. For more information, I suggest you to see the daringer/asus-fan#44 (comment) and maybe other posts in the referred issue as well.

@Greifent
Copy link
Author

Greifent commented Aug 3, 2020

Thanks!
Edit: I thought it worked in another way, I'll look if I can find a way to do what i have in mind

@dominiksalvet
Copy link
Owner

Please close this issue once you feel it is resolved. 😸

We can continue in the discussion if an associated question arises and we can reopen the issue then.

@dominiksalvet
Copy link
Owner

dominiksalvet commented Aug 3, 2020

I thought it worked in another way, I'll look if I can find a way to do what i have in mind

BTW, all you need should be asus-fan-control API and hence you wouldn't need to know these details... That also prevents from breaking afc-gui after modification of asus-fan-control internals. This is the reason why public APIs exist.

@Greifent Greifent closed this as completed Aug 3, 2020
@Greifent
Copy link
Author

What do you mean with asus-fan-control API?
I had in mind to show the live temperature of the computer in the GUI, I think that we misunderstood each other

@dominiksalvet
Copy link
Owner

By API I mean the functionality accessible from a terminal. E.g., asus-fan-control help, asus-fan-control get-temps, etc. are part of the asus-fan-control API.

@Greifent
Copy link
Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants