From 78182b04e8c2ac01740affafe3f7aa803e8975e4 Mon Sep 17 00:00:00 2001 From: Martin Kepplinger Date: Mon, 14 Jan 2019 14:41:11 +0100 Subject: [PATCH] x230: external_install_bottom: fix automatic detection of chip in fact, detecting MX25L6406E/MX25L6408E has not worked. only EN25QH64 was detected because the former got overwritten. fix the logic and detect either one. Fixes #52 Closes #54 --- x230/external_install_bottom.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/x230/external_install_bottom.sh b/x230/external_install_bottom.sh index bd8ac36..efcc6da 100755 --- a/x230/external_install_bottom.sh +++ b/x230/external_install_bottom.sh @@ -153,14 +153,20 @@ if [ ! "$have_chipname" -gt 0 ] ; then CHIPNAME="" chip_found=0 - CHIPNAME=$(cat "${TEMP_DIR}"/chips | grep Found | grep "MX25L6406E/MX25L6408E" | grep -oP '"\K[^"\047]+(?=["\047])' || true) - if [ ! -z "${CHIPNAME}" ] ; then - chip_found=1 + if [ ! "$chip_found" -gt 0 ] ; then + CHIPNAME=$(cat "${TEMP_DIR}"/chips | grep Found | grep "MX25L6406E/MX25L6408E" | grep -oP '"\K[^"\047]+(?=["\047])' || true) + if [ ! -z "${CHIPNAME}" ] ; then + chip_found=1 + fi fi - CHIPNAME=$(cat "${TEMP_DIR}"/chips | grep Found | grep "EN25QH64" | grep -o '".*"' || true) - if [ ! -z "${CHIPNAME}" ] ; then - chip_found=1 + + if [ ! "$chip_found" -gt 0 ] ; then + CHIPNAME=$(cat "${TEMP_DIR}"/chips | grep Found | grep "EN25QH64" | grep -o '".*"' || true) + if [ ! -z "${CHIPNAME}" ] ; then + chip_found=1 + fi fi + if [ ! "$chip_found" -gt 0 ] ; then echo "chip not detected." flashrom -p ${programmer} || true