Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(854)

Unified Diff: mm.sh

Issue 6728027: Move modem command to the modem-utilities repository (Closed) Base URL: ssh://gitrw.chromium.org:9222/modem-utilities.git@master
Patch Set: Remove crud. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « inherit-review-settings-ok ('k') | modem » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mm.sh
diff --git a/mm.sh b/mm.sh
new file mode 100644
index 0000000000000000000000000000000000000000..b70ffed5ff44582c1870969afca4dad599cb5406
--- /dev/null
+++ b/mm.sh
@@ -0,0 +1,58 @@
+#!/bin/dash
+# Copyright (c) 2009 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.
+
+# Library for talking to ModemManager from sh. Copied (ugh) from flimflam.
+
+MM=${MM:-/org/chromium/ModemManager}
+IDBUS=org.freedesktop.DBus
+IDBUS_PROPERTIES=$IDBUS.Properties
+IMM=org.freedesktop.ModemManager
+IMODEM=$IMM.Modem
+IMODEM_SIMPLE=$IMODEM.Simple
+IMODEM_CDMA=$IMODEM.Cdma
+IMODEM_GSM=$IMODEM.Gsm
+IMODEM_GSM_CARD=$IMODEM_GSM.Card
+IMODEM_GSM_NETWORK=$IMODEM_GSM.Network
+IMODEM_GOBI=org.chromium.ModemManager.Modem.Gobi
+IMODEMS="$IMODEM $IMODEM_SIMPLE $IMODEM_CDMA $IMODEM_GSM $IMODEM_GOBI"
+DEST=`echo $MM | sed -e 's!^/!!g' -e 's!/!.!g'`
+
+MTYPE_GSM=1
+MTYPE_CDMA=2
+
+dbus () {
+ local obj=$1
+ local method=$2
+ shift 2
+
+ dbus-send --system --print-reply --fixed \
+ --dest=$DEST "$obj" "$method" $*
+}
+
+modems () {
+ dbus $MM $IMM.EnumerateDevices | awk '{print $2}'
+}
+
+modemprops () {
+ local modem=$1
+ for i in $IMODEMS; do
+ dbus $modem $IDBUS_PROPERTIES.GetAll string:$i 2>/dev/null \
+ | awk '/[^[:space:]] [^[:space:]]/ {print $N}'
+ done
+}
+
+modemprop () {
+ local modem=$1
+ local prop=$2
+ modemprops $modem | grep /$prop | awk '{print $2}'
+}
+
+modem_activation_state () {
+ local modem=$1
+ if [ -n $modem ] ; then
+ dbus $modem $IMODEM_SIMPLE.GetStatus |\
+ awk '/\/activation_state/ {print $2}'
+ fi
+}
« no previous file with comments | « inherit-review-settings-ok ('k') | modem » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698