author | spiralman <spiralman> | 2002-10-18 21:24:25 (UTC) |
---|---|---|
committer | spiralman <spiralman> | 2002-10-18 21:24:25 (UTC) |
commit | eea247f2664f0c70247399b2f4d969ddb00df7ba (patch) (unidiff) | |
tree | fe4e62a4ce136a94c82cae6a84a51b952e076b20 | |
parent | 2ebb8c91374774171582f1a8ee4dbf4009a70615 (diff) | |
download | opie-eea247f2664f0c70247399b2f4d969ddb00df7ba.zip opie-eea247f2664f0c70247399b2f4d969ddb00df7ba.tar.gz opie-eea247f2664f0c70247399b2f4d969ddb00df7ba.tar.bz2 |
fixed usbnetctrl.sh to work with fam 0.6 (interface is now created after the ipaq is connected to the cradle)
-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 | |||
@@ -1,90 +1,94 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | # usbnetctrl.sh - a demonstration of opie-sh | 3 | # usbnetctrl.sh - a demonstration of opie-sh |
4 | # | 4 | # |
5 | # Copyright (C) 2002 gonz@directbox.com | 5 | # Copyright (C) 2002 gonz@directbox.com |
6 | # | 6 | # |
7 | # This program is free software; you can redistribute it and/or modify | 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 | 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) | 9 | # the Free Software Foundation; either version 2, or (at your option) |
10 | # any later version. | 10 | # any later version. |
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 |
78 | exit ;; | 82 | exit ;; |
79 | 0) startup ;; | 83 | 0) startup ;; |
80 | 1) stopit ;; | 84 | 1) stopit ;; |
81 | 2) stopit ; sleep 1 ; startup ;; | 85 | 2) stopit ; sleep 1 ; startup ;; |
82 | esac | 86 | esac |
83 | } | 87 | } |
84 | 88 | ||
85 | ###################################################################### | 89 | ###################################################################### |
86 | # main | 90 | # main |
87 | 91 | ||
88 | about | 92 | about |
89 | yesorno | 93 | yesorno |
90 | cleanup | 94 | cleanup |