Skip to content

Instantly share code, notes, and snippets.

@Steve-Tech
Created April 26, 2024 00:41
Show Gist options
  • Save Steve-Tech/376e9ab634248056bfd50dfed9b13e1c to your computer and use it in GitHub Desktop.
Save Steve-Tech/376e9ab634248056bfd50dfed9b13e1c to your computer and use it in GitHub Desktop.
Read a CrOS fan speed using the memmap, for Framework Laptops (AMD, but could be adjusted for other laptops)
# Requires portio and usually root access
# If you're using a venv, run it something like `sudo .venv/bin/python ec-lpc-memmap.py`
import portio
EC_LPC_ADDR_MEMMAP = 0xE00 # will be 0x900 on most other models
EC_MEMMAP_SIZE = 255
EC_MEMMAP_FAN = 0x10
if portio.ioperm(EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE, True):
print("Permission denied. Try running as root.")
exit(1)
print(portio.inw(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_FAN))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment