Merge lp:~kvalo/indicator-network/indicator-network-debug into lp:~indicator-applet-developers/indicator-network/indicator-network

Proposed by Kalle Valo
Status: Merged
Merged at revision: 70
Proposed branch: lp:~kvalo/indicator-network/indicator-network-debug
Merge into: lp:~indicator-applet-developers/indicator-network/indicator-network
Diff against target: 96 lines (+85/-1)
2 files modified
scripts/Makefile.am (+2/-1)
scripts/indicator-network-debug (+83/-0)
To merge this branch: bzr merge lp:~kvalo/indicator-network/indicator-network-debug
Reviewer Review Type Date Requested Status
David Barth Approve
Review via email: mp+33498@code.launchpad.net

Description of the change

Add a script which makes it easy to get debug messages from all the relevant network components in user space.

To post a comment you must log in.
Revision history for this message
David Barth (dbarth) wrote :

Good idea!

review: Approve
Revision history for this message
Kalle Valo (kvalo) wrote :

The idea came from kamstrup.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/Makefile.am'
2--- scripts/Makefile.am 2010-06-23 12:32:24 +0000
3+++ scripts/Makefile.am 2010-08-24 09:07:41 +0000
4@@ -1,2 +1,3 @@
5 dist_bin_SCRIPTS = cmcc indicator-network-settings \
6- indicator-network-mobile-wizard
7+ indicator-network-mobile-wizard \
8+ indicator-network-debug
9
10=== added file 'scripts/indicator-network-debug'
11--- scripts/indicator-network-debug 1970-01-01 00:00:00 +0000
12+++ scripts/indicator-network-debug 2010-08-24 09:07:41 +0000
13@@ -0,0 +1,83 @@
14+#!/bin/sh
15+
16+set -x
17+
18+usage() {
19+ echo "Usage: indicator-network-debug start|stop"
20+ exit 1
21+}
22+
23+connman() {
24+ if [ -x /etc/init.d/connman ]; then
25+ /etc/init.d/connman $1
26+ fi
27+}
28+
29+ofono() {
30+ if [ -x /etc/init.d/ofono ]; then
31+ /etc/init.d/ofono $1
32+ fi
33+}
34+
35+run() {
36+ cmd=$1; shift
37+ args=$@
38+
39+ if [ -x $cmd ]; then
40+ $cmd $args
41+ fi
42+}
43+
44+start() {
45+ connman stop
46+ ofono stop
47+ killall -q wpa_supplicant
48+
49+ sleep 3
50+
51+ # just to be sure
52+ killall -q connmand ofonod wpa_supplicant
53+
54+ run /sbin/wpa_supplicant -B -u -s -ddd
55+ export OFONO_AT_DEBUG=1
56+ run /usr/sbin/ofonod -d
57+ run /usr/sbin/connmand -d
58+}
59+
60+stop() {
61+ # just to be sure
62+ killall -q connmand ofonod wpa_supplicant
63+
64+ sleep 3
65+
66+ # just to be sure
67+ killall -q connmand ofonod wpa_supplicant
68+
69+ ofono start
70+ connman start
71+
72+ # wpasupplicant is started with dbus activation
73+}
74+
75+if [ "$#" != 1 ]; then
76+ usage
77+fi
78+
79+if [ `id -u` != 0 ]; then
80+ echo "Must be root."
81+ exit 3
82+fi
83+
84+case $1 in
85+ start)
86+ start
87+ ;;
88+ stop)
89+ stop
90+ ;;
91+ *)
92+ echo "Invalid commmand"
93+ usage
94+ exit 2
95+ ;;
96+esac

Subscribers

People subscribed via source and target branches