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

Fixes for ASUS Crosshair VIII Hero #540

Merged
merged 2 commits into from
Sep 19, 2021

Conversation

zeule
Copy link
Contributor

@zeule zeule commented Sep 13, 2021

This implements bank switching for the EC controller and uses that to read water temperatures. The sensors in the Nuvoton chips that were thought to be water temperatures turned out to be QFan sources and are removed for now.

Also supplies correct default fan and controls names.

I plan to use ASUS WMI functions to read EC (and maybe Nuvoton) state to avoid race between LHM and ASUS AISuite and perhaps firmware when reading data. However, calling those methods in Windows did not work from the first attempt and hence this PR brings EC bank switching using the direct port write method, which is potentially dangerous (but other 3rd-party monitoring software use it anyway), and reduces the IEmbeddedControllerIO to the only function, available in the ASUS DSDT code.

@zeule zeule force-pushed the c8h-fixes branch 2 times, most recently from 6e05565 to bb1cf3f Compare September 13, 2021 14:08
@ReggX
Copy link
Contributor

ReggX commented Sep 13, 2021

Testing on my Dark Hero board, looks good so far, BUT:
image

Only T-Sensor is plugged in, Water In and Out are both unplugged.

216 (0xD8) seems to be some kind of default value. I remember having that value appear in my logs for short bursts of time (1 second) sporadically when I ran both LHM and HWinfo simultaneously. Back then I concluded that it probably is some race condition since it doesn't happen with only of them running.

216°C sounds like something well beyond the max temperature of most water cooling sensors anyways, so I'd argue that the reading 0xD8 should just be discarded and ignored.

@zeule
Copy link
Contributor Author

zeule commented Sep 13, 2021

Testing on my Dark Hero board, looks good so far, BUT…

Probably means they moved the sensor in Dark Hero. I'll remove it then. Maybe they are in place of the chipset fan?

@zeule
Copy link
Contributor Author

zeule commented Sep 13, 2021

Maybe you could take the T sensor and plug it in the water headers please, to test the register addresses? For C8H such re-plugging worked without power-cycling the board (which is naturally non-surprising, as the sensor is just a thermistor).

@ReggX
Copy link
Contributor

ReggX commented Sep 13, 2021

image

Looks like 216 is the default value for non-connected probes. And all three work as expected when connected.

(Small sidenote: I did forget that I still had FanControl running in the background. With all my fans being controlled by T-Sensor, they shot up straight to 100% while I was busy switching plugs. Made me jump a little 🤣)

@zeule
Copy link
Contributor Author

zeule commented Sep 13, 2021

Thank you! I will add 0xd8 as the placeholder value for these two water sensors then.

@ReggX
Copy link
Contributor

ReggX commented Sep 13, 2021

two

All three of them jump to 216 as seen in the screenshot above.

@zeule
Copy link
Contributor Author

zeule commented Sep 13, 2021

two

All three of them jump to 216 as seen in the screenshot above.

My bad... Thanks!

@zeule
Copy link
Contributor Author

zeule commented Sep 13, 2021

Added blank values for EC temperature sensors that can possibly be not plugged in (T Sensor and water).

@ReggX
Copy link
Contributor

ReggX commented Sep 14, 2021

Looks good, the sensors stop and resume as expected 👍
image

@zeule
Copy link
Contributor Author

zeule commented Sep 14, 2021

Looks good, the sensors stop and resume as expected 👍

Great! Thank you for testing!

@kedema
Copy link
Contributor

kedema commented Sep 17, 2021

I just tried it on the Formula, everything seems ok! Thanks for your work!
Screenshot - 17_09_2021 , 19_51_30

@zeule
Copy link
Contributor Author

zeule commented Sep 17, 2021

I just tried it on the Formula, everything seems ok!

Thank you for testing this out! Added the Formula board to the Linux driver.

Copy link
Collaborator

@PhyxionNL PhyxionNL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest looks good, although I can't test this myself.


protected EmbeddedController(List<EmbeddedControllerSource> sources, ISettings settings) : base("Embedded Controller", new Identifier("lpc", "ec"), settings)
{
_sources = sources.ToArray();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make _sources a list instead? Seems rather pointless to allocate an array here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to highlight that the _sources length does not change after creation. Is there a better way?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can make _source IReadOnlyList.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, but from my point of view that is over complicated. Besides, I pass arrays to the EC reader object, so would need to convert on each call should I choose to leave the List here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_sources only seems to be used in Update to access the instances, so all you need to do change private readonly EmbeddedControllerSource[] _sources; to private readonly IReadOnlyList<EmbeddedControllerSource> _sources; 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For whatever reason I misread _sources for _registers, sorry. Yes, will replace with IReadOnlyList then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good now to merge?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please.

{
return ReadLoop<byte>(register, ReadByteOp);
}
if (registers.Length > data.Length) throw new ArgumentException("data buffer length has to be greater or equal to the registers array length");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw on new line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced with Trace.Assert

This implements bank switching for the EC controller and uses that to read water temperatures. The sensors in the Nuvoton chips that were thought to be water temperatures turned out to be QFan sources and are removed for now.
@PhyxionNL PhyxionNL merged commit c0fe150 into LibreHardwareMonitor:master Sep 19, 2021
@zeule
Copy link
Contributor Author

zeule commented Sep 20, 2021

Thank you for testing and reviewing!

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

Successfully merging this pull request may close these issues.

None yet

4 participants