blob: aad2c48464c7707d33c1b39374da383d240499be [file] [log] [blame]
David Rochbergcd28bbb2010-10-25 16:25:271#!/bin/sh
2# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6usage () {
7 cat >&2 <<EOF
8$0: Convenience wrapper around dbus-send specialized for calling
9cromo interfaces.
10
11Usage:
12 $0: [modem id] [command] [remaining arguments]
13
14Examples:
15 $0 Fictitious/0 Simple.GetStatus
16 will get status from modem /org/chromium/ModemManager/Fictitious/0
17
18 $0 Gobi/2 Gobi.SetCarrier string:'Ficticious Carrier'
19 will set modem /org/chromium/ModemManager/Gobi/2 to use 'Fictitious Carrier'
20EOF
21}
22
23log_and_execute () {
24 echo >&2 Running "$@"
25 "$@"
26}
27
28if [ -z "$1" -o -z "$2" ] ; then
29 usage
30 exit 1
31fi
32
33MODEM="$1"
34COMMAND="$2"
35shift 2
36
37log_and_execute dbus-send --system --print-reply --fixed \
38 --dest=org.chromium.ModemManager \
39 /org/chromium/ModemManager/"$MODEM" \
40 org.freedesktop.ModemManager.Modem."$COMMAND" \
41 "$@"