Use the new product_id sysfs for Melfas updates
Previously the Melfas updater used the hw_version sysfs entry to
identify the specific touch IC that it's trying to update. This has
been replaced by the new and improved product_id sysfs entry that
compliments a driver change that now suffixes the firmware filename
with the product ID when it requests the binary from /lib/firmware.
With this CL, the Melfas firmwares should now follow the typical
ChromeOS firmware naming convention with a product_id at the end of the
filename.
BUG=chrome-os-partner:56704
TEST=emerged and deployed on a Reks. Rebooting triggers updates
correctly with the new filename format. Everything went smoothly
when I updated to and back from old firmwares.
Change-Id: I95a3770e67f590158c0d7dbed47102423ea59e82
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/411290
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
diff --git a/scripts/chromeos-melfas-touch-firmware-update.sh b/scripts/chromeos-melfas-touch-firmware-update.sh
index b7c3cc1..87e08b3 100644
--- a/scripts/chromeos-melfas-touch-firmware-update.sh
+++ b/scripts/chromeos-melfas-touch-firmware-update.sh
@@ -10,11 +10,9 @@
DEFINE_string 'device' '' "device name" 'd'
FW_DIR="/lib/firmware"
-FW_LINK_NAME="melfas_mip4.fw"
-FW_LINK_PATH="${FW_DIR}/${FW_LINK_NAME}"
+FW_LINK_NAME_BASE="melfas_mip4.fw"
FW_VERSION_SYSFS="fw_version"
-PRODUCT_ID_SYSFS="hw_version"
-CORRUPTED_FW_PRODUCT_ID="T4H0_BOOTLOADER"
+PRODUCT_ID_SYSFS="product_id"
# Parse command line
FLAGS "$@" || exit 1
@@ -44,6 +42,7 @@
local touch_device_path=""
local active_product_id=""
local active_fw_version=""
+ local fw_link_path=""
local fw_path=""
local fw_filename=""
local fw_name=""
@@ -67,9 +66,11 @@
active_product_id="$(cat ${touch_device_path}/${PRODUCT_ID_SYSFS})"
# Make sure there is a FW that looks like it's for the same product ID
- log_msg "Attempting to load FW: '${FW_LINK_PATH}'"
- fw_path="$(readlink "${FW_LINK_PATH}")"
- if [ ! -e "${FW_LINK_PATH}" ] ||
+ fw_link_path="$(find_fw_link_path "${active_product_id}" \
+ "${FW_LINK_NAME_BASE}")"
+ fw_path="$(readlink "${fw_link_path}")"
+ log_msg "Attempting to load FW: '${fw_link_path}'"
+ if [ ! -e "${fw_link_path}" ] ||
[ ! -e "${fw_path}" ]; then
die "No valid firmware for ${trackpad_device_name} found."
fi
@@ -83,12 +84,7 @@
[ "${product_id}" != "${active_product_id}" ]; then
log_msg "Current product id: ${active_product_id}"
log_msg "Updater product id: ${product_id}"
-
- if [ "${active_product_id}" = "${CORRUPTED_FW_PRODUCT_ID}" ]; then
- log_msg "Corrupted FW detected, attempting to continue anyway."
- else
- die "Touch firmware updater: Product ID mismatch!"
- fi
+ die "Touch firmware updater: Product ID mismatch!"
fi
# Get the current FW version that's loaded on the touch IC