Skip to content

Commit 8f3450a

Browse files
committed
Add option to upgrade touchpad firmware for EVE
Signed-off-by: Matt DeVillier <[email protected]>
1 parent 4821073 commit 8f3450a

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

firmware.sh

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,57 @@ the touchpad firmware, otherwise the touchpad will not work."
453453
fi
454454
}
455455

456+
#######################
457+
# Upgrade Touchpad FW #
458+
#######################
459+
function upgrade_touchpad_fw()
460+
{
461+
# offer to upgrade touchpad firmware on EVE
462+
if [[ "${device^^}" = "EVE" ]]; then
463+
echo_green "\nUpgrade Touchpad Firmware"
464+
echo_yellow "If you plan to restore ChromeOS on your Pixelbook, it is necessary to upgrade
465+
the touchpad firmware, otherwise the touchpad will not work."
466+
echo_yellow "You should do this after restoring the stock firmware, but before rebooting."
467+
read -rep "Do you wish to upgrade the touchpad firmware now? [y/N] "
468+
if [[ "$REPLY" = "y" || "$REPLY" = "Y" ]] ; then
469+
# ensure firmware write protect disabled
470+
[[ "$wpEnabled" = true ]] && { exit_red "\nHardware write-protect enabled, cannot upgrade touchpad firmware."; return 1; }
471+
# download TP firmware
472+
echo_yellow "\nDownloading touchpad firmware\n(${touchpad_eve_fw_stock})"
473+
$CURL -s -LO "${other_source}${touchpad_eve_fw_stock}"
474+
$CURL -s -LO "${other_source}${touchpad_eve_fw_stock}.sha1"
475+
#verify checksum on downloaded file
476+
if sha1sum -c ${touchpad_eve_fw_stock}.sha1 > /dev/null 2>&1; then
477+
# flash TP firmware
478+
echo_green "Flashing touchpad firmware -- do not touch the touchpad while updating!"
479+
if ${flashromcmd/${flashrom_programmer}} -p ec:type=tp -i EC_RW -w ${touchpad_eve_fw_stock} -o /tmp/flashrom.log >/dev/null 2>&1; then
480+
echo_green "Touchpad firmware successfully upgraded."
481+
echo_yellow "Please reboot your Pixelbook now."
482+
else
483+
# try with older eve flashrom
484+
[[ "$isChromeOS" == "true" ]] && tpPath="/usr/local/bin" || tpPath="/tmp"
485+
(
486+
cd $tpPath
487+
$CURL -sLO "${util_source}flashrom_eve_tp"
488+
chmod +x flashrom_eve_tp
489+
)
490+
if $tpPath/flashrom_eve_tp -p ec:type=tp -i EC_RW -w ${touchpad_eve_fw_stock} -o /tmp/flashrom.log >/dev/null 2>&1; then
491+
echo_green "Touchpad firmware successfully upgraded."
492+
echo_yellow "Please reboot your Pixelbook now."
493+
else
494+
echo_red "Error flashing touchpad firmware:"
495+
cat /tmp/flashrom.log
496+
echo_yellow "\nThis function sometimes doesn't work under Linux, in which case it is\nrecommended to try under ChromeOS."
497+
fi
498+
fi
499+
else
500+
echo_red "Touchpad firmware download checksum fail; download corrupted, cannot flash."
501+
fi
502+
fi
503+
read -rep "Press [Enter] to return to the main menu."
504+
fi
505+
}
506+
456507
##########################
457508
# Restore Stock Firmware #
458509
##########################
@@ -950,6 +1001,7 @@ function stock_menu() {
9501001
fi
9511002
if [[ "${device^^}" = "EVE" ]]; then
9521003
echo -e "${MENU}**${WP_TEXT} [WP]${NUMBER} D)${MENU} Downgrade Touchpad Firmware ${NORMAL}"
1004+
echo -e "${MENU}**${WP_TEXT} [WP]${NUMBER} U)${MENU} Upgrade Touchpad Firmware ${NORMAL}"
9531005
fi
9541006
if [[ "$unlockMenu" = true || ( "$isFullRom" = false && "$isBootStub" = false ) ]]; then
9551007
echo -e "${MENU}**${WP_TEXT} [WP]${NUMBER} 3)${MENU} Set Boot Options (GBB flags) ${NORMAL}"
@@ -993,6 +1045,12 @@ function stock_menu() {
9931045
menu_fwupdate
9941046
;;
9951047

1048+
[uU]) if [[ "${device^^}" = "EVE" ]]; then
1049+
upgrade_touchpad_fw
1050+
fi
1051+
menu_fwupdate
1052+
;;
1053+
9961054
3) if [[ "$unlockMenu" = true || "$isChromeOS" = true || "$isUnsupported" = false \
9971055
&& "$isFullRom" = false && "$isBootStub" = false ]]; then
9981056
set_boot_options
@@ -1066,6 +1124,7 @@ function uefi_menu() {
10661124
fi
10671125
if [[ "${device^^}" = "EVE" ]]; then
10681126
echo -e "${MENU}**${WP_TEXT} [WP]${NUMBER} D)${MENU} Downgrade Touchpad Firmware ${NORMAL}"
1127+
echo -e "${MENU}**${WP_TEXT} [WP]${NUMBER} U)${MENU} Upgrade Touchpad Firmware ${NORMAL}"
10691128
fi
10701129
if [[ "$unlockMenu" = true || "$isUEFI" = true ]]; then
10711130
echo -e "${MENU}**${WP_TEXT} ${NUMBER} C)${MENU} Clear UEFI NVRAM ${NORMAL}"
@@ -1098,6 +1157,13 @@ function uefi_menu() {
10981157
uefi_menu
10991158
;;
11001159

1160+
[uU]) if [[ "${device^^}" = "EVE" ]]; then
1161+
upgrade_touchpad_fw
1162+
fi
1163+
uefi_menu
1164+
;;
1165+
1166+
11011167
[rR]) echo -e "\nRebooting...\n";
11021168
cleanup
11031169
reboot

sources.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,3 +366,4 @@ export coreboot_uefi_librem_14="coreboot_edk2-librem_14-mrchromebox_20240914.rom
366366

367367
# other
368368
export touchpad_eve_fw="rose_v1.1.8546-ee1861e9e.bin"
369+
export touchpad_eve_fw_stock="rose_v2.0.653-dfd8046c6.bin"

0 commit comments

Comments
 (0)