OLD | NEW |
(Empty) | |
| 1 #!/bin/dash |
| 2 # Copyright (c) 2009 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 |
| 6 # Library for talking to ModemManager from sh. Copied (ugh) from flimflam. |
| 7 |
| 8 MM=${MM:-/org/chromium/ModemManager} |
| 9 IDBUS=org.freedesktop.DBus |
| 10 IDBUS_PROPERTIES=$IDBUS.Properties |
| 11 IMM=org.freedesktop.ModemManager |
| 12 IMODEM=$IMM.Modem |
| 13 IMODEM_SIMPLE=$IMODEM.Simple |
| 14 IMODEM_CDMA=$IMODEM.Cdma |
| 15 IMODEM_GSM=$IMODEM.Gsm |
| 16 IMODEM_GSM_CARD=$IMODEM_GSM.Card |
| 17 IMODEM_GSM_NETWORK=$IMODEM_GSM.Network |
| 18 IMODEM_GOBI=org.chromium.ModemManager.Modem.Gobi |
| 19 IMODEMS="$IMODEM $IMODEM_SIMPLE $IMODEM_CDMA $IMODEM_GSM $IMODEM_GOBI" |
| 20 DEST=`echo $MM | sed -e 's!^/!!g' -e 's!/!.!g'` |
| 21 |
| 22 MTYPE_GSM=1 |
| 23 MTYPE_CDMA=2 |
| 24 |
| 25 dbus () { |
| 26 local obj=$1 |
| 27 local method=$2 |
| 28 shift 2 |
| 29 |
| 30 dbus-send --system --print-reply --fixed \ |
| 31 --dest=$DEST "$obj" "$method" $* |
| 32 } |
| 33 |
| 34 modems () { |
| 35 dbus $MM $IMM.EnumerateDevices | awk '{print $2}' |
| 36 } |
| 37 |
| 38 modemprops () { |
| 39 local modem=$1 |
| 40 for i in $IMODEMS; do |
| 41 dbus $modem $IDBUS_PROPERTIES.GetAll string:$i 2>/dev/null \ |
| 42 | awk '/[^[:space:]] [^[:space:]]/ {print $N}' |
| 43 done |
| 44 } |
| 45 |
| 46 modemprop () { |
| 47 local modem=$1 |
| 48 local prop=$2 |
| 49 modemprops $modem | grep /$prop | awk '{print $2}' |
| 50 } |
| 51 |
| 52 modem_activation_state () { |
| 53 local modem=$1 |
| 54 if [ -n $modem ] ; then |
| 55 dbus $modem $IMODEM_SIMPLE.GetStatus |\ |
| 56 awk '/\/activation_state/ {print $2}' |
| 57 fi |
| 58 } |
OLD | NEW |