• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2012 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
5import dbus
6import json
7
8from autotest_lib.client.bin import test
9from autotest_lib.client.common_lib import error
10
11class platform_DebugDaemonGetModemStatus(test.test):
12    version = 1
13
14    def run_once(self, *args, **kwargs):
15        bus = dbus.SystemBus()
16        proxy = bus.get_object('org.chromium.debugd', '/org/chromium/debugd')
17        self.iface = dbus.Interface(proxy,
18                                    dbus_interface='org.chromium.debugd')
19        result = self.iface.GetModemStatus()
20        modems = json.loads(result)
21        ok = False
22        for m in modems:
23            if 'path' in m:
24                print 'Found modem: %s' % m['path']
25                ok = True
26        if not ok:
27            raise error.TestFail('No modems found: %s' % result)
28