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

Add guide for address discovery #152

Merged
merged 22 commits into from
Nov 2, 2024
Merged

Add guide for address discovery #152

merged 22 commits into from
Nov 2, 2024

Conversation

mutchiko
Copy link
Contributor

No description provided.

glpnk added a commit to mutchiko/msi-ec that referenced this pull request Aug 21, 2024
@glpnk
Copy link
Contributor

glpnk commented Aug 21, 2024

@teackot what can you say?

@teackot
Copy link
Collaborator

teackot commented Aug 21, 2024

The ec_sys module isn't present on all distributions, for example Fedora doesn't ship it. We have a debug mode in our driver, which dumps the EC ram contents in /sys/devices/platform/msi-ec/debug/ec_dump

@glpnk
Copy link
Contributor

glpnk commented Aug 21, 2024

Hi, @teackot, can you check this EC dump method on your devices with both generations. It should workon WMI1 devices, because used in DSDT tables. It reads address 0xFC000080

sudo dd if=/dev/mem bs=1 skip=4227860480 count=256 | hexdump -C

Basically I'm interested is it works on wmi2

@teackot
Copy link
Collaborator

teackot commented Aug 21, 2024

Hi! Yep it works on my WMI2 Summit E14, gives me a correct EC dump. I'll test in on my P14 a little later

Edit: also works on my P14

@glpnk
Copy link
Contributor

glpnk commented Aug 21, 2024

Nice, I'll add this to guide too

Copy link
Collaborator

@teackot teackot left a comment

Choose a reason for hiding this comment

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

I left some suggestions on how to improve the guide

docs/device_support_guide.md Outdated Show resolved Hide resolved
docs/device_support_guide.md Outdated Show resolved Hide resolved
docs/device_support_guide.md Outdated Show resolved Hide resolved
docs/device_support_guide.md Outdated Show resolved Hide resolved
docs/device_support_guide.md Outdated Show resolved Hide resolved
docs/device_support_guide.md Outdated Show resolved Hide resolved
docs/device_support_guide.md Outdated Show resolved Hide resolved
docs/device_support_guide.md Outdated Show resolved Hide resolved
docs/device_support_guide.md Outdated Show resolved Hide resolved
docs/device_support_guide.md Outdated Show resolved Hide resolved
@glpnk
Copy link
Contributor

glpnk commented Aug 21, 2024

@teackot I'm thinking about splitting guide into 2 or 3 parts:

  • main - Disclaimers, info about known values, other info
  • Windows - Disclaimer + Windows guide
  • Linux - Disclaimer + debug mode + ec_sys + raw memory read

@teackot
Copy link
Collaborator

teackot commented Aug 22, 2024

So the main one will describe the base principle, the danger, info about the dump, and where and what to look for (aka the known values), etc? This does sound like it should be in this guide.

If by splitting you mean to split it into separate files I don't think there is much need, and a single page might be better

I'm thinking of a format like this:

  1. Base info (main guide)
  2. Table of contents
  3. Windows
  4. Linux

@glpnk
Copy link
Contributor

glpnk commented Aug 22, 2024

Okay, known values I'll keep for contribution guide, for example.

I'm thinking of a format like this:

Base info (main guide)
Table of contents
Windows
Linux

Okay, single file guide sounds good. But what we can add to Table of contents?

Also, can you start new review and add Alerts tags

My own guide making attempt here https://github.com/glpnk/msi-ec/tree/docs/more-docs/docs

@teackot
Copy link
Collaborator

teackot commented Aug 22, 2024

We can put the known values into its own section, since it is likely going to be big.

  1. Base info
  2. Table of contents
  3. Windows
  4. Linux
  5. Known values

All sections after the TOC go into it (win, lin, known)

Copy link
Collaborator

@teackot teackot left a comment

Choose a reason for hiding this comment

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

Alerts

docs/device_support_guide.md Outdated Show resolved Hide resolved
docs/device_support_guide.md Outdated Show resolved Hide resolved
@glpnk
Copy link
Contributor

glpnk commented Aug 22, 2024

Main problem of Markdown is indents in lists

Github don't render Alerts as part of lists, but we can add pictures inside Alerts
image

@teackot
Copy link
Collaborator

teackot commented Aug 22, 2024

We can remove the "9. Here you should see a table of all the values your Embedded Chip has in its memory." entry and put the alert it the "reading the table" section.

It can go like this:

## Windows method

### Preparation

1. Install
2. Update
3. MSI apps
4. AMD/Nvidia
5. Test the app
6. Download RWEverything
7. Launch
8. EC page
9. Refrest rate

### Reading the table

Here you will see a table of all the values your Embedded Controller has in its memory.

CAUTION: do not edit

This is how you find the address

This is how you interpret it

Example

...

This way the list won't have anything that breaks the indentation

@glpnk
Copy link
Contributor

glpnk commented Aug 22, 2024

Yeah, because we have a second method of reading EC on Win we can split guide to few steps as you said, and apps

UPD: I changed heading levels because heading-3 looks unnoticeable

@glpnk glpnk force-pushed the main branch 2 times, most recently from e8c72f9 to b7516f4 Compare August 22, 2024 17:08
`/dev/mem` may not be supported on some distros. For details, see `man mem`.

> [!WARNING]
> Reading random parts of the system memory can reveal your secrets, so check the dump before you post it to Github.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

and how do i check if the dump i made doesn't include sensitive info? let's call this method "experimental" until we make sure it works no less than 90% of the time.

Copy link
Contributor

Choose a reason for hiding this comment

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

true, only by comparing with reference dump, like matching the location of the ec name

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, chance of getting reading error is higher than accidentally dump some confidential info. And maybe this memory area newer mapped to system RAM

Copy link
Collaborator

@teackot teackot Aug 22, 2024

Choose a reason for hiding this comment

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

Let's mark it as "Not recommended" and put the warning at the top of this method's section, so it can be the last resort if the two previous methods didn't work for any reason

## Windows method (recommended):
# Table of contents (rough)

+ FW naming and WMI versioning explanation(?) (TODO)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is outside the scope of this guide, you've already done a good write up on that topic, so lets keep it outside this guide

Copy link
Collaborator

Choose a reason for hiding this comment

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

Right, this is just a guide on how to obtain and interpret the dump

Copy link
Contributor

Choose a reason for hiding this comment

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

Guide about naming and wmi versions is short, and some people got confused between BIOS and EC names in the past.
And it will be useful to describe known addresses

Copy link
Collaborator

Choose a reason for hiding this comment

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

Alright, adding it here as a draft wouldn't hurt, we'll see how well it fits here when the guide is near finished

Comment on lines 160 to 151
If you need dump in binary form:

* `cat /sys/kernel/debug/ec/ec0/io > ec_dump.bin`
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think anyone does. At least, we don't need binaries submitted here, so let's exclude this part

@glpnk glpnk force-pushed the main branch 2 times, most recently from 5812524 to 73ca0ed Compare August 23, 2024 15:18

# Contribution

## Firmware naming
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a solid explanation , but it's better to put it in another documentation

Copy link
Contributor

Choose a reason for hiding this comment

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

We probably don't need more then 1 guide now

Copy link
Collaborator

Choose a reason for hiding this comment

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

These should probably be in a separate guide.

Some people have been requesting a guide on adding a config to the code and I think it also doesn't belong in this file.

We can make a file with a "Contribution" guide that:

  1. refers people to this guide if they want to contribute by discovering their laptops' configs (this is a separate file because it is big)
  2. provides some specific info like FW naming and generations
  3. explains how to add a config to the code

@glpnk
Copy link
Contributor

glpnk commented Aug 24, 2024

@teackot do you have access to https://github.com/BeardOverflow/msi-ec/graphs/traffic ? Can you make screenshot of Referring sites block? Maybe this will help us focus on the most popular sites that bring people to this project.

At least I think about the Arch Wiki

@teackot
Copy link
Collaborator

teackot commented Aug 25, 2024

Here it is

image

Most visits are from search engines and Phoronix articles

docs/device_support_guide.md Outdated Show resolved Hide resolved
docs/device_support_guide.md Outdated Show resolved Hide resolved
mutchiko and others added 4 commits August 26, 2024 19:54
risk management? damage control? whatever you want to call it.

if you don't like tip formatting make sure not to make it another ```important``` section, using the same color doesn't attract attention.
@teackot
Copy link
Collaborator

teackot commented Oct 19, 2024

What's left to do here? I think we need to direct people to the issue tracker at the end of the "Windows method" section (like we do in the "Linux method" section) and remove the "Contribution" section (to later move it to a different file as described in this comment), and this PR is good to go

forgot to create a new branch before i uploaded the file
@mutchiko
Copy link
Contributor Author

@teackot only thing left is is to decide where to put links to the guide, my initial thoughts:
1- in the first/second section of the readme
2- on top of the supported devices list
3- in the issue template

and this is just enough to attract people's attention.

more clarification for step 4

EC lockup is when the EC doesn't respond to some MSI settings changes, mainly when changing shift mode and the refresh speed is faster than 400ms in RWEvrything
@glpnk
Copy link
Contributor

glpnk commented Oct 19, 2024

Now I think that Table of content section looks confusing, we probably need to move 2nd level bullet points to guide.

About contribution section - I think info about generations might be useful, but we can call it like Additional info

now it makes more sense to have it as part of the guide
@glpnk
Copy link
Contributor

glpnk commented Oct 19, 2024

2- on top of the supported devices list

Something like this

image

3- in the issue template

Above Laptop model probably

image

@mutchiko
Copy link
Contributor Author

@glpnk for number 2 lets change the wording to "If your device is not in the list, read this guide to get it supported and add it to the list"

helpful in case people outside github share the link with each other

@glpnk
Copy link
Contributor

glpnk commented Oct 20, 2024

I'm not committed this change, so it's just draft

because people might figure out the addresses but in the end forget to report them.
@mutchiko
Copy link
Contributor Author

Im thinking about adding an explanation about mic/speaker mute LEDs in the Additional Info section;
just to tell people that they exist and how they work on linux, but we don't have a way to trigger them, yet.

@glpnk
Copy link
Contributor

glpnk commented Oct 22, 2024

LEDs controlled by kernel triggers, which are controlled by audio card drivers. Bluetooth audio works in userspace, so it can't be used as trigger

@mutchiko
Copy link
Contributor Author

@teackot the guide is ready, please go ahead and merge it.

@teackot
Copy link
Collaborator

teackot commented Nov 2, 2024

Thank you very much for writing this important guide!

@teackot teackot merged commit be6f715 into BeardOverflow:main Nov 2, 2024
@teackot
Copy link
Collaborator

teackot commented Nov 2, 2024

And with this, all the open PRs are finally merged

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.

3 participants