blob: 9a5a5d043074b862bad8803dc7517de03ac764d2 [file] [log] [blame]
#! /bin/sh
# Copyright 2015 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.
# This script obtains the EC version
# Attempts to insert i2c-dev as it may not be done during init on all platforms
if ! modprobe i2c-dev; then
exit 0
rm -f ${EC_INFO_FILE}
for ec_type in ec pd sh; do
if out=$(mosys -l ${ec_type} info 2> /dev/null); then
# If a sub-command is not available on a platform, mosys will fail with
# a non-zero exit code (EXIT_FAILURE) and print the help menu. For example,
# this will happen if a "mosys smbios" sub-command is run on ARM since ARM
# platforms do not support SMBIOS. Write the output of mosys command only
# if the command succeeded.
echo "${out}" >> ${EC_INFO_FILE}