Skip to content

Instantly share code, notes, and snippets.

@dch
Created January 29, 2015 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dch/ce22b1f84dd23be6a4f7 to your computer and use it in GitHub Desktop.
Save dch/ce22b1f84dd23be6a4f7 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# dumpACPItables, get all Tables from Mac OS X ioreg.
#
# 06-19-2009 AlainTox714
#
# path: /usr/local/bin
#
ACPIdir="/Users/${USER}/Desktop/ACPI_tables"
[ "$(whoami)" == "root" ] && ACPIdir="/Users/${SUDO_USER}/Desktop/ACPI_tables"
if [ ! -d ${ACPIdir} ]; then
mkdir "${ACPIdir}"
else
rm -rf "${ACPIdir}"/*.*
fi
# Dump ACPI Tables from ioreg
ACPI_Tables="$(ioreg -lw0 | grep 'ACPI Tables' | cut -f2 -d '{' | tr -d '}' | tr ',' '\012')"
iaslOK=
if [ -n "$(which iasl)" ]; then
iaslOK=1
cd "${ACPIdir}"
fi
# Extract Tables from Dump
for table in ${ACPI_Tables}; do
tableName=$(echo $table | cut -f1 -d '=' | tr -d '"')
printf "${tableName} \n"
tableData=$(echo "$table" | cut -f2 -d '<' | tr -d '>')
echo "$tableData" | xxd -r -p > "${ACPIdir}/${tableName}.aml"
if [ -n "${iaslOK}" ]; then
iasl -d "${tableName}.aml" 1>/dev/null 2>&1
fi
done
@ameisehaufen
Copy link

bash ioreg -l | grep -Ei acpi
is not returning anything in Mojave, do you know how to fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment