1# Copyright 2014 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5from autotest_lib.client.common_lib import error
6from autotest_lib.client.cros.cellular import mm
7
8
9def ClearGobiModemFaultInjection():
10    """If a Gobi modem is present, try to clear its fault-injection state."""
11    try:
12        modem_manager, modem_path = mm.PickOneModem('Gobi')
13    except error.TestError:
14        # Did not find a Gobi modem. Simply return.
15        return
16
17    modem = modem_manager.GetModem(modem_path).GobiModem()
18    if modem:
19        modem.InjectFault('ClearFaults', 1)
20