Skip to content

Check busy bit#21

Draft
JohnAZoidberg wants to merge 2 commits intomainfrom
check-busy-bit
Draft

Check busy bit#21
JohnAZoidberg wants to merge 2 commits intomainfrom
check-busy-bit

Conversation

@JohnAZoidberg
Copy link
Member

No description provided.

The EC has a busy bit and sample ID which tells us when it's currerntly
updating samples and if the data is from the current or the previous
sample.

Without checking this we risk reading incomplete/invalid data.
So now we're implementing the logic to report data only after the EC has
finished updating and we're still reading the same sample.

Signed-off-by: Daniel Schaefer <dhs@frame.work>
CrosEcReadMemU8 returns 0 on IOCTL failure but we never check this. If
the memmap read fails, the buffers stay uninitialized/unchanged, which
makes the busy bit logic fail and the sensor report the wrong data.

Add an EC_READ_U8 helper macro to checks for failure and jump to Exit
with STATUS_IO_DEVICE_ERROR, so that broken EC communication is properly
reported instead of producing invalid readings.

Signed-off-by: Daniel Schaefer <dhs@frame.work>
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.

1 participant