Merge pull request #250 from makermelissa/fix_i2smic

Fix i2smic
This commit is contained in:
Melissa LeBlanc-Williams 2023-05-19 16:23:43 -07:00 committed by GitHub
commit d49b6e9d95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,5 @@
import platform
try:
from adafruit_shell import Shell
except ImportError:
@ -5,6 +7,12 @@ except ImportError:
shell = Shell()
def is_kernel_userspace_mismatch():
"""
Check if the userspace is 64-bit
"""
return platform.machine() == "aarch64" and platform.architecture()[0] == "32bit"
def main():
shell.clear()
print("""This script downloads and installs
@ -23,6 +31,13 @@ I2S microphone support.
else:
shell.bail("Unsupported Pi board detected.")
if shell.is_arm64() and is_kernel_userspace_mismatch():
print("Unable to compile driver because kernel space is 64-bit, but user space is 32-bit.")
if shell.prompt("Add parameter to /boot/config.txt to use 32-bit kernel?"):
shell.reconfig("/boot/config.txt", "^.*arm_64bit.*$", "arm_64bit=0")
shell.prompt_reboot()
else:
shell.bail("Unable to continue while mismatch is present.")
auto_load = (
not shell.argument_exists('noautoload') and
shell.prompt("Auto load module at boot?", force_arg="autoload"))