author | spiralman <spiralman> | 2002-10-18 21:12:01 (UTC) |
---|---|---|
committer | spiralman <spiralman> | 2002-10-18 21:12:01 (UTC) |
commit | 55a3c031fa5eba00a89ae5efa9b1d791eba9b9e7 (patch) (unidiff) | |
tree | 09ee76bc52599d269faa21630ea39f2731c53154 /noncore/tools/opie-sh/scripts/stowctrl.sh | |
parent | a680c9464bbdea863b623b0449a15146ccaf66c0 (diff) | |
download | opie-55a3c031fa5eba00a89ae5efa9b1d791eba9b9e7.zip opie-55a3c031fa5eba00a89ae5efa9b1d791eba9b9e7.tar.gz opie-55a3c031fa5eba00a89ae5efa9b1d791eba9b9e7.tar.bz2 |
added stowawayctrl script
Diffstat (limited to 'noncore/tools/opie-sh/scripts/stowctrl.sh') (more/less context) (ignore whitespace changes)
-rwxr-xr-x | noncore/tools/opie-sh/scripts/stowctrl.sh | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/noncore/tools/opie-sh/scripts/stowctrl.sh b/noncore/tools/opie-sh/scripts/stowctrl.sh new file mode 100755 index 0000000..475c3a3 --- a/dev/null +++ b/noncore/tools/opie-sh/scripts/stowctrl.sh | |||
@@ -0,0 +1,84 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | #stowctrl.sh - modified usbnetctrl.sh from gonz by spiralman spiralman@softhome.net | ||
4 | # usbnetctrl.sh - a demonstration of opie-sh | ||
5 | # | ||
6 | # Copyright (C) 2002 gonz@directbox.com | ||
7 | # | ||
8 | # This program is free software; you can redistribute it and/or modify | ||
9 | # it under the terms of the GNU General Public License as published by | ||
10 | # the Free Software Foundation; either version 2, or (at your option) | ||
11 | # any later version. | ||
12 | # | ||
13 | # This program is distributed in the hope that it will be useful, | ||
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | # GNU General Public License for more details. | ||
17 | # | ||
18 | # 20020524-1 - code beautification, added icons and reset | ||
19 | # 20020517-2 - bugfixed fullscreen, added info about ifconfig | ||
20 | # 20020517-1 - added about, fullscreen and icon | ||
21 | |||
22 | OPIE_SH=/opt/QtPalmtop/bin/opie-sh | ||
23 | |||
24 | ###################################################################### | ||
25 | # subroutines | ||
26 | |||
27 | about() { | ||
28 | ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/stowctrl.png>" | ||
29 | echo "<h3>About</h3>" | ||
30 | echo "This little App should make it easy for you to " | ||
31 | echo "activate / deactivate the stowaway keyboard (on ipaq)" | ||
32 | echo "<p>" | ||
33 | ) | $OPIE_SH -t "stowaway control" -f & | ||
34 | SCREENCLEAN=$! | ||
35 | sleep 1 | ||
36 | } | ||
37 | |||
38 | startup() { | ||
39 | echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/stowctrl.png>" > /tmp/sout | ||
40 | echo "<h3>stowaway up</h3>" >> /tmp/sout | ||
41 | modprobe h3600_stowaway >> /tmp/sout | ||
42 | cat /dev/stowaway & | ||
43 | echo $! > /tmp/stowcatpid | ||
44 | $OPIE_SH -t Output -f /tmp/sout | ||
45 | rm /tmp/sout | ||
46 | } | ||
47 | |||
48 | stopit() { | ||
49 | ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/stowctrl.png>" | ||
50 | echo "<h3>stowaway down</h3>" | ||
51 | read THECAT < /tmp/stowcatpid | ||
52 | kill $THECAT | ||
53 | rmmod h3600_stowaway | ||
54 | ) 2>&1 | $OPIE_SH -t Output -f | ||
55 | } | ||
56 | |||
57 | |||
58 | cleanup() { | ||
59 | kill $SCREENCLEAN | ||
60 | rm -f /tmp/qcop-msg-stowctrl.sh | ||
61 | } | ||
62 | |||
63 | |||
64 | yesorno() { | ||
65 | $OPIE_SH -m -t "Stowaway Up/Down" -M "What to do with the Stowaway: " \ | ||
66 | -g -0 Up -1 Down -2 Restart | ||
67 | RETURNCODE=$? | ||
68 | |||
69 | case $RETURNCODE in | ||
70 | -1) echo error... | ||
71 | cleanup | ||
72 | exit ;; | ||
73 | 0) startup ;; | ||
74 | 1) stopit ;; | ||
75 | 2) stopit ; sleep 1 ; startup ;; | ||
76 | esac | ||
77 | } | ||
78 | |||
79 | ###################################################################### | ||
80 | # main | ||
81 | |||
82 | about | ||
83 | yesorno | ||
84 | cleanup | ||