Parse customization ID better in Wacom updater

Previously Wacom's firmware updater was using the raw customization_id
from VPD to differentiate devices because this was how we did it in a
hack a long time ago for the first Zerg device.  Unfortunately it turns
out that the customization_id may well change between EVT/DVT/MP which
would cause the fw updater to stop working.  In this CL we take
advantage of the fact that the customization_id is supposed to be of the
form "OEM-BOARD" and we parse out just the board name which should be
consistent, and use that only instead.

BUG=chrome-os-partner:61372
TEST=built and deployed on an Electro -- the update worked smoothly
using only the second half of the customization_id

Change-Id: If6720b3d06f412f5714d7ea0196b10ee8c5b55e3
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/425705
Reviewed-by: Benson Leung <bleung@google.com>
diff --git a/scripts/chromeos-touch-common.sh b/scripts/chromeos-touch-common.sh
index 0004249..89b85c8 100644
--- a/scripts/chromeos-touch-common.sh
+++ b/scripts/chromeos-touch-common.sh
@@ -225,6 +225,23 @@
   # Get the "customization id" from the Chromebook's VPD.  This ID is
   # mandatory for Zerg systems (where 2 different devices use the same build)
   # and can be used to differentiate them.  If the entry doesn't exist, this
-  # will simply not print anything.
+  # will simply not print anything.  Note that is is only required to remain
+  # constant *after* a machine has reached MP -- if you don't know what you're
+  # doing you're probably better off using get_board_name which wraps this.
   vpd_get_value customization_id
 }
+
+get_board_name_from_vpd() {
+  # Get the name of this specific board.  This is done to differentiate which
+  # board is being used, and the board name is determined by looking at the
+  # customization_id in VPD which is supposed to be of the format:
+  # "${OEM_NAME}-${BOARD_NAME}"  By stripping off the OEM name we allow the
+  # customization_id to change to mask the OEM name during early stages of
+  # development without having to modify the firmware filenames.
+  local customization_id="$(get_customization_id)"
+  if [ -z "${customization_id}" ]; then
+    echo ""
+  fi
+
+  echo "${customization_id##*-}"
+}
diff --git a/scripts/chromeos-wacom-touch-firmware-update.sh b/scripts/chromeos-wacom-touch-firmware-update.sh
index 526256b..40ec17b 100755
--- a/scripts/chromeos-wacom-touch-firmware-update.sh
+++ b/scripts/chromeos-wacom-touch-firmware-update.sh
@@ -105,8 +105,9 @@
   local update_type=""
   local update_needed=""
 
-  local customization_id="$(get_customization_id)"
-  local fw_link="$(find_fw_link_path "${customization_id}" "${FW_LINK_BASE}")"
+  local board_name="$(get_board_name_from_vpd)"
+  log_msg "Board name detected from VPD as '${board_name}'"
+  local fw_link="$(find_fw_link_path "${board_name}" "${FW_LINK_BASE}")"
   log_msg "Attempting to Load FW: '${fw_link}'"
 
   active_fw_ver="$(get_active_fw_version)"