Skip to content

Commit

Permalink
[SEM-442] Check bom number to change display type when upgrading
Browse files Browse the repository at this point in the history
  • Loading branch information
Jipolie01 committed Dec 30, 2024
1 parent a0325c6 commit 7c60fbb
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions initramfs/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ BOOT_PARTITION="${EMMC_DEV}p1"
SYSTEM_UPDATE_ENTRYPOINT="start_update.sh"
UPDATE_DEVICES="/dev/mmcblk[0-9]p[0-9]"

#uc2 : UltiController 2 (UM3,UM3E) This UltiController is not considered here anymore
#uc3 : UltiController 3 (S5,S5r2,S3)
#uc4 : UltiController 4 (Colorado)
DISPLAY_TYPE="uc4"
UM_SPLASH="umsplash.fb"
FB_DEVICE="/dev/fb0"

Expand Down Expand Up @@ -346,9 +342,24 @@ find_and_run_update()
echo "Warning: unable to unmount '${UPDATE_IMG_MOUNT}'."
fi

echo "Got '${SYSTEM_UPDATE_ENTRYPOINT}' script, trying to execute."
if ! "${update_tmpfs_mount}/${SYSTEM_UPDATE_ENTRYPOINT}" "${update_tmpfs_mount}/${UPDATE_IMAGE}" "${EMMC_DEV}" "${DISPLAY_TYPE}" "${SOFTWARE_INSTALL_MODE}"; then
echo "Error, update failed: executing '${update_tmpfs_mount}/${SYSTEM_UPDATE_ENTRYPOINT} ${update_tmpfs_mount}/${UPDATE_IMAGE} ${EMMC_DEV} ${DISPLAY_TYPE} ${SOFTWARE_INSTALL_MODE}'."

# Read the article number from the I2C device
art_num=$(i2ctransfer -y 1 w2@0x57 0x01 0x00 r4)
echo "---> Article number read from EEPROM: >${art_num}<"

# Convert the hexadecimal article number to a single decimal number
# Assuming art_num is in the format "0x00 0x03 0x78 0x34"
art_num_hex=""
for hex in $art_num; do
art_num_hex="${art_num_hex}${hex#0x}" # Remove the "0x" prefix
done
art_num_dec=$(printf "%d\n" "0x$art_num_hex")

echo "---> Article number in decimal: >${art_num_dec}<"

echo "Got '${SYSTEM_UPDATE_ENTRYPOINT}' script, trying to execute, with art_num_dec=${art_num_dec}."
if ! "${update_tmpfs_mount}/${SYSTEM_UPDATE_ENTRYPOINT}" "${update_tmpfs_mount}/${UPDATE_IMAGE}" "${EMMC_DEV}" "${art_num_dec}" "${SOFTWARE_INSTALL_MODE}"; then
echo "Error, update failed: executing '${update_tmpfs_mount}/${SYSTEM_UPDATE_ENTRYPOINT} ${update_tmpfs_mount}/${UPDATE_IMAGE} ${EMMC_DEV} ${art_num_dec} ${SOFTWARE_INSTALL_MODE}'."
critical_error
break
fi
Expand Down

0 comments on commit 7c60fbb

Please sign in to comment.