Revert "Revert "Use storage functions from chromeos-common.sh""
This reverts commit a25acc76489408f9ed0ab65e4320698284fa1f33.
Identical to commit c057c2eb6cebb54b99e311c801b231a481d2e8d2
TEST=Unit test.
TEST=Autotest hardware_DiskFirmwareUpgrade.
BUG=chromium:348619
Powerwash issue fixed.
CQ-DEPEND=CL:193424,CL:193425,CL:193426,CL:193429,CL:193449,CL:193451,CL:193452,CL:193453,CL:193454,CL:193455,CL:193470,CL:193471,CL:193473,CL:193474,CL:193490
Change-Id: I5e5949dd5b4d8a9949ff69805156adebcaa6defc
Reviewed-on: https://chromium-review.googlesource.com/193428
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Commit-Queue: Puthikorn Voravootivat <puthik@chromium.org>
diff --git a/scripts/chromeos-disk-firmware-update.sh b/scripts/chromeos-disk-firmware-update.sh
index 0401bdb..ffd1b9e 100755
--- a/scripts/chromeos-disk-firmware-update.sh
+++ b/scripts/chromeos-disk-firmware-update.sh
@@ -9,6 +9,7 @@
#
. /usr/share/misc/shflags
+. /usr/share/misc/chromeos-common.sh
# Temperaray directory to put device information
DEFINE_string 'tmp_dir' '' "Use existing temporary directory."
@@ -38,33 +39,6 @@
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
-# disk_get_sata_devices
-#
-# look for the name of the SATA devices to update
-# We expect no devices [emmc machines] or one [sda or
-# maybe sdb if a usb stick is present].
-# Multiple entries is unexecpted.
-#
-# returns a list of devices "sda sdb ..."
-#
-disk_get_sata_devices() {
- for device in /sys/block/sd*; do
- if [ ! -e "${device}" ]; then
- break
- fi
- removable=$(cat "${device}/removable")
- vendor=$(cat "${device}/device/vendor")
- if [ "${vendor%% *}" = "ATA" -a ${removable} -eq 0 ]; then
- echo "$(basename "${device}")"
- fi
- done
-}
-
-# TODO(gwendal): not implemented.
-disk_get_emmc_devices() {
- echo ""
-}
-
# disk_fw_select - Select the proper disk firmware to use.
#
# This code reuse old installer disk firmware upgrade code.
@@ -327,7 +301,7 @@
# remove unnecessary lines
sed '/^#/d;/^[[:space:]]*$/d' "${disk_rules_raw}" > "${disk_rules}"
- disk_upgrade_devices "${disk_rules}" $(disk_get_sata_devices)
+ disk_upgrade_devices "${disk_rules}" $(list_fixed_ata_disks)
rc=$?
if [ ${erase_tmp_dir} -eq ${FLAGS_TRUE} ]; then
diff --git a/tests/chromeos-disk-firmware-test.sh b/tests/chromeos-disk-firmware-test.sh
index 9468bab..4dcacf9 100755
--- a/tests/chromeos-disk-firmware-test.sh
+++ b/tests/chromeos-disk-firmware-test.sh
@@ -30,8 +30,8 @@
declare -i id_idx
declare -i hdparm_fw_rc=0
-unset disk_get_sata_devices
-disk_get_sata_devices() {
+unset list_fixed_ata_disks
+list_fixed_ata_disks() {
echo "sda"
}