| #!/bin/sh |
| # Copyright 2018 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| ECTOOL="/usr/sbin/ectool" |
| |
| usage() { |
| echo "Print CBI values" |
| echo "syntax: cbi_info" |
| } |
| |
| error() { |
| echo "$0: ERROR: $*" >&2 |
| } |
| |
| # Print cbi value using ectool. |
| # On error, it prints error message but doesn't return error code. |
| get_cbi() { |
| local type="$1" |
| echo "[${type}]" |
| if ! "${ECTOOL}" cbi get "${type}"; then |
| error "Failed to read type ${type}" |
| fi |
| } |
| |
| main() { |
| if [ $# -ne 0 ]; then |
| usage |
| return 1 |
| fi |
| |
| if [ ! -x "${ECTOOL}" ]; then |
| error "ectool not found" |
| return 0 |
| fi |
| |
| get_cbi 0 |
| get_cbi 1 |
| get_cbi 2 |
| get_cbi 3 |
| get_cbi 4 |
| get_cbi 5 |
| get_cbi 6 |
| get_cbi 7 |
| } |
| |
| main "$@" |