summaryrefslogtreecommitdiff
path: root/noncore/tools/opie-sh/scripts/usbnetctrl.sh
Unidiff
Diffstat (limited to 'noncore/tools/opie-sh/scripts/usbnetctrl.sh') (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/tools/opie-sh/scripts/usbnetctrl.sh90
1 files changed, 90 insertions, 0 deletions
diff --git a/noncore/tools/opie-sh/scripts/usbnetctrl.sh b/noncore/tools/opie-sh/scripts/usbnetctrl.sh
new file mode 100755
index 0000000..a12f74b
--- a/dev/null
+++ b/noncore/tools/opie-sh/scripts/usbnetctrl.sh
@@ -0,0 +1,90 @@
1#!/bin/sh
2
3# usbnetctrl.sh - a demonstration of opie-sh
4#
5# Copyright (C) 2002 gonz@directbox.com
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2, or (at your option)
10# any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# 20020524-1 - code beautification, added icons and reset
18# 20020517-2 - bugfixed fullscreen, added info about ifconfig
19# 20020517-1 - added about, fullscreen and icon
20
21OPIE_SH=/opt/QtPalmtop/bin/opie-sh
22
23######################################################################
24# subroutines
25
26about() {
27 ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/usbnetctrl.png>"
28 echo "<h3>About</h3>"
29 echo "This little App should make it easy for you to "
30 echo "activate / deactivate the usbnet-driver (on ipaq)"
31 echo "<p>"
32 echo "To use it at first, you need to change the ifconfig"
33 echo "line in /opt/QtPalmtop/bin/usbnetctrl.sh."
34 ) | $OPIE_SH -t "usbnet control" -f &
35 SCREENCLEAN=$!
36 sleep 1
37}
38
39startup() {
40 ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/usbnetctrl.png>"
41 echo "<h3>usbnet up</h3>"
42 modprobe usb-eth
43
44 ifconfig usbf 10.3.0.226 netmask 255.255.255.0 \
45 broadcast 10.3.0.255
46
47 ) 2>&1 | $OPIE_SH -t Output -f
48 if [ -f /root/masq.sh ]
49 then sh /root/masq.sh
50 fi
51}
52
53stopit() {
54 ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/usbnetctrl.png>"
55 echo "<h3>usbnet down</h3>"
56 ifconfig usbf down
57 sleep 1
58 rmmod usb-eth
59 rmmod sa1100usb_core
60 ) 2>&1 | $OPIE_SH -t Output -f
61}
62
63
64cleanup() {
65 kill $SCREENCLEAN
66 rm -f /tmp/qcop-msg-usbnetctrl.sh
67}
68
69
70yesorno() {
71 $OPIE_SH -m -t "USB-Net start/stop" -M "What to do with usbnet: " \
72 -g -0 Start -1 Stop -2 Restart
73 RETURNCODE=$?
74
75 case $RETURNCODE in
76 -1) echo error...
77 cleanup
78 exit ;;
79 0) startup ;;
80 1) stopit ;;
81 2) stopit ; sleep 1 ; startup ;;
82 esac
83}
84
85######################################################################
86# main
87
88about
89yesorno
90cleanup