Skip to content

Commit

Permalink
add overlay updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed May 13, 2024
1 parent da4e088 commit b335d99
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions core/tools/blueos_startup_update/blueos_startup_update
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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])
Expand Down

0 comments on commit b335d99

Please sign in to comment.