diff --git a/core/tools/blueos_startup_update/blueos_startup_update b/core/tools/blueos_startup_update/blueos_startup_update index 49da553dc..b7a37d967 100755 --- a/core/tools/blueos_startup_update/blueos_startup_update +++ b/core/tools/blueos_startup_update/blueos_startup_update @@ -404,6 +404,43 @@ def ensure_user_data_structure_is_in_place() -> bool: # This patch doesn't require restart to take effect return False + +def load_pi5_overlays_in_runtime() -> bool: + is_pi5 = False + with open('/proc/cpuinfo', 'r') as f: + if 'Raspberry Pi 5' in f.read(): + is_pi5 = True + if not is_pi5: + return False + commands = [ + # serial ports, checked individually + "dtoverlay uart0-pi5", # serial1, /dev/ttyAMA0 + "dtoverlay uart3-pi5", # serial4, /dev/ttyAMA3 + "dtoverlay uart4-pi5", # serial5, /dev/ttyAMA4 + "dtoverlay uart2-pi5", # serial3, /dev/ttyAMA2 + + # i2c-6: bar30 and friends + "dtoverlay i2c-gpio i2c_gpio_sda=22 i2c_gpio_scl=23 bus=6 i2c_gpio_delay_us=0", + + # i2c1: ADS1115, AK09915, BME280 + "dtoverlay i2c1-pi5 baudrate=400000", + + # i2c3: PCA + "dtoverlay i2c3-pi5 baudrate=400000", + + # SPI1: MMC5983 + "dtoverlay spi1-3cs", + + # SPI0: LED + "dtoverlay spi0-led", + + #symlink for i2c4 + "ln -s /dev/i2c-3 /dev/i2c-4" + ] + for command in commands: + logger.info(run_command(f"sudo {command}", False)) + return False + def run_command_is_working(): output = run_command("uname -a", check=False) @@ -434,6 +471,7 @@ def main() -> int: ensure_user_data_structure_is_in_place, ensure_nginx_permissions, #create_dns_conf_host_link, + load_pi5_overlays_in_runtime, ] logger.info("The following patches will be applied if needed:", [patch_to_apply.__name__ for patch_to_apply in patches_to_apply])