-rwxr-xr-x | noncore/tools/opie-sh/scripts/usbnetctrl.sh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/tools/opie-sh/scripts/usbnetctrl.sh b/noncore/tools/opie-sh/scripts/usbnetctrl.sh index a12f74b..417435e 100755 --- a/noncore/tools/opie-sh/scripts/usbnetctrl.sh +++ b/noncore/tools/opie-sh/scripts/usbnetctrl.sh | |||
@@ -11,67 +11,71 @@ | |||
11 | # | 11 | # |
12 | # This program is distributed in the hope that it will be useful, | 12 | # This program is distributed in the hope that it will be useful, |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | # GNU General Public License for more details. | 15 | # GNU General Public License for more details. |
16 | # | 16 | # |
17 | # 20020524-1 - code beautification, added icons and reset | 17 | # 20020524-1 - code beautification, added icons and reset |
18 | # 20020517-2 - bugfixed fullscreen, added info about ifconfig | 18 | # 20020517-2 - bugfixed fullscreen, added info about ifconfig |
19 | # 20020517-1 - added about, fullscreen and icon | 19 | # 20020517-1 - added about, fullscreen and icon |
20 | 20 | ||
21 | OPIE_SH=/opt/QtPalmtop/bin/opie-sh | 21 | OPIE_SH=/opt/QtPalmtop/bin/opie-sh |
22 | 22 | ||
23 | ###################################################################### | 23 | ###################################################################### |
24 | # subroutines | 24 | # subroutines |
25 | 25 | ||
26 | about() { | 26 | about() { |
27 | ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/usbnetctrl.png>" | 27 | ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/usbnetctrl.png>" |
28 | echo "<h3>About</h3>" | 28 | echo "<h3>About</h3>" |
29 | echo "This little App should make it easy for you to " | 29 | echo "This little App should make it easy for you to " |
30 | echo "activate / deactivate the usbnet-driver (on ipaq)" | 30 | echo "activate / deactivate the usbnet-driver (on ipaq)" |
31 | echo "<p>" | 31 | echo "<p>" |
32 | echo "To use it at first, you need to change the ifconfig" | 32 | echo "To use it at first, you need to change the ifconfig" |
33 | echo "line in /opt/QtPalmtop/bin/usbnetctrl.sh." | 33 | echo "line in /opt/QtPalmtop/bin/usbnetctrl.sh." |
34 | ) | $OPIE_SH -t "usbnet control" -f & | 34 | ) | $OPIE_SH -t "usbnet control" -f & |
35 | SCREENCLEAN=$! | 35 | SCREENCLEAN=$! |
36 | sleep 1 | 36 | sleep 1 |
37 | } | 37 | } |
38 | 38 | ||
39 | startup() { | 39 | startup() { |
40 | ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/usbnetctrl.png>" | 40 | ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/usbnetctrl.png>" |
41 | echo "<h3>usbnet up</h3>" | 41 | echo "<h3>usbnet up</h3>" |
42 | modprobe usb-eth | 42 | modprobe usb-eth |
43 | ) 2>&1 | $OPIE_SH -t Output -f | ||
44 | |||
45 | $OPIE_SH -m -I -t "Usbnet Control" -M "Please connect the<br>ipaq to the cradle<br>and press OK" | ||
43 | 46 | ||
44 | ifconfig usbf 10.3.0.226 netmask 255.255.255.0 \ | 47 | ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/usbnetctrl.png>" |
45 | broadcast 10.3.0.255 | 48 | echo "<h3>usbnet up</h3>" |
49 | ifconfig usbf up 192.168.0.1 netmask 255.255.255.0 | ||
46 | 50 | ||
47 | ) 2>&1 | $OPIE_SH -t Output -f | 51 | ) 2>&1 | $OPIE_SH -t Output -f |
48 | if [ -f /root/masq.sh ] | 52 | if [ -f /root/masq.sh ] |
49 | then sh /root/masq.sh | 53 | then sh /root/masq.sh |
50 | fi | 54 | fi |
51 | } | 55 | } |
52 | 56 | ||
53 | stopit() { | 57 | stopit() { |
54 | ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/usbnetctrl.png>" | 58 | ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/usbnetctrl.png>" |
55 | echo "<h3>usbnet down</h3>" | 59 | echo "<h3>usbnet down</h3>" |
56 | ifconfig usbf down | 60 | ifconfig usbf down |
57 | sleep 1 | 61 | sleep 1 |
58 | rmmod usb-eth | 62 | rmmod usb-eth |
59 | rmmod sa1100usb_core | 63 | rmmod sa1100usb_core |
60 | ) 2>&1 | $OPIE_SH -t Output -f | 64 | ) 2>&1 | $OPIE_SH -t Output -f |
61 | } | 65 | } |
62 | 66 | ||
63 | 67 | ||
64 | cleanup() { | 68 | cleanup() { |
65 | kill $SCREENCLEAN | 69 | kill $SCREENCLEAN |
66 | rm -f /tmp/qcop-msg-usbnetctrl.sh | 70 | rm -f /tmp/qcop-msg-usbnetctrl.sh |
67 | } | 71 | } |
68 | 72 | ||
69 | 73 | ||
70 | yesorno() { | 74 | yesorno() { |
71 | $OPIE_SH -m -t "USB-Net start/stop" -M "What to do with usbnet: " \ | 75 | $OPIE_SH -m -t "USB-Net start/stop" -M "What to do with usbnet: " \ |
72 | -g -0 Start -1 Stop -2 Restart | 76 | -g -0 Start -1 Stop -2 Restart |
73 | RETURNCODE=$? | 77 | RETURNCODE=$? |
74 | 78 | ||
75 | case $RETURNCODE in | 79 | case $RETURNCODE in |
76 | -1) echo error... | 80 | -1) echo error... |
77 | cleanup | 81 | cleanup |