1*4f2df630SAndroid Build Coastguard Worker#!/bin/bash 2*4f2df630SAndroid Build Coastguard Worker# Copyright 2023 The ChromiumOS Authors 3*4f2df630SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be 4*4f2df630SAndroid Build Coastguard Worker# found in the LICENSE file. 5*4f2df630SAndroid Build Coastguard Worker# 6*4f2df630SAndroid Build Coastguard Worker# Wrapper script for retrieving and interpreting AP RO verification status of 7*4f2df630SAndroid Build Coastguard Worker# a ChromeOS device connected to the host over CCD. 8*4f2df630SAndroid Build Coastguard Worker 9*4f2df630SAndroid Build Coastguard Workerset -uo pipefail 10*4f2df630SAndroid Build Coastguard Worker 11*4f2df630SAndroid Build Coastguard WorkerPROGRAM="explain_ap_ro_verification_status" 12*4f2df630SAndroid Build Coastguard Workerif ! command -v "${PROGRAM}" > /dev/null 2>&1; then 13*4f2df630SAndroid Build Coastguard Worker echo "The '${PROGRAM}' utility is not installed, run update_chroot" 14*4f2df630SAndroid Build Coastguard Worker exit 1 15*4f2df630SAndroid Build Coastguard Workerfi 16*4f2df630SAndroid Build Coastguard Worker 17*4f2df630SAndroid Build Coastguard Workerstatus="$(gsctool -W 2>&1 | awk '/expanded_aprov_status:/ {print "0x"$2}' )" 18*4f2df630SAndroid Build Coastguard Worker# shellcheck disable=SC2181 19*4f2df630SAndroid Build Coastguard Workerif [[ $? != 0 ]]; then 20*4f2df630SAndroid Build Coastguard Worker echo "Failed to retrieve status, is your DUT CCD connected?" >&2 21*4f2df630SAndroid Build Coastguard Worker exit 1 22*4f2df630SAndroid Build Coastguard Workerfi 23*4f2df630SAndroid Build Coastguard Worker 24*4f2df630SAndroid Build Coastguard Worker"${PROGRAM}" "${status}" 25