Skip to content

Instantly share code, notes, and snippets.

@lazd
Last active January 6, 2020 06:40
Show Gist options
  • Save lazd/16d89b72c905624cc5d6d37aeff0056a to your computer and use it in GitHub Desktop.
Save lazd/16d89b72c905624cc5d6d37aeff0056a to your computer and use it in GitHub Desktop.
Goodix kext functions
VOODOOKEXTDIR="~/Library/Developer/Xcode/DerivedData/VoodooI2C-hkujhbyvdpyfqxdamhidwpiudbmp/Build/Products/Release"
KEXTDIR="/Volumes/EFI/EFI/CLOVER/kexts/Other/"
function mktmp() {
mkdir -p ~/tmp
}
function dumpklog() {
if [ $# -eq 0 ]; then
time=3m
else
time=$1
fi
mktmp
sudo log show --predicate "processID == 0" --last $time --debug --info > ~/tmp/kernellog.txt
}
function streamgoodixlog() {
sudo log stream --predicate "processID == 0" --debug --info | grep Goodix
}
function klog() {
dumpklog $1
subl ~/tmp/kernellog.txt
}
function loadgoodix() {
mktmp
sudo rm -rf ~/tmp/VoodooI2C*.kext
cp -r $VOODOOKEXTDIR/VoodooI2C*.kext ~/tmp/
sudo chown -R root:wheel ~/tmp/VoodooI2C*.kext
sudo kextutil -d ~/tmp/VoodooI2C.kext ~/tmp/VoodooI2CGoodix.kext
lsgoodix
}
function loggoodix() {
dumpklog $1
cat ~/tmp/kernellog.txt | grep Goodix
}
function unloadgoodix() {
sudo kextunload -b net.lazd.VoodooI2CGoodix
}
function lsgoodix() {
kextstat | grep Goodix
}
function debuggoodix() {
atos -arch x86_64 -o ~/tmp/VoodooI2CGoodix.kext/Contents/MacOS/VoodooI2CGoodix -l $1 $2
}
function installgoodix() {
efi &&
rm -rf $KEXTDIR/VoodooI2CGoodix.kext $KEXTDIR/VoodooI2C.kext $KEXTDIR/VoodooI2CHID.kext &&
cp -r $VOODOOKEXTDIR/VoodooI2CGoodix.kext $VOODOOKEXTDIR/VoodooI2C.kext $VOODOOKEXTDIR/VoodooI2CHID.kext $KEXTDIR/ &&
echo "Installed!"
}
function uninstallgoodix() {
efi &&
rm -rf $KEXTDIR/VoodooI2CGoodix.kext &&
echo "Uninstalled!"
}
function efi() {
LOCALMOUNTPOINT="/Volumes/EFI"
if mount | grep "on $LOCALMOUNTPOINT" > /dev/null; then
echo "EFI already mounted"
else
echo "Mounting EFI..."
sudo mkdir -p /Volumes/EFI
sudo mount -t msdos /dev/disk0s1 /Volumes/EFI &&
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment