Diffstat (limited to 'noncore/tools/opie-sh/scripts/microkbd.sh') (more/less context) (ignore whitespace changes)
-rwxr-xr-x | noncore/tools/opie-sh/scripts/microkbd.sh | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/noncore/tools/opie-sh/scripts/microkbd.sh b/noncore/tools/opie-sh/scripts/microkbd.sh new file mode 100755 index 0000000..d602ea5 --- a/dev/null +++ b/noncore/tools/opie-sh/scripts/microkbd.sh | |||
@@ -0,0 +1,87 @@ | |||
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=$OPIEDIR/bin/opie-sh | ||
23 | |||
24 | ###################################################################### | ||
25 | # subroutines | ||
26 | |||
27 | about() { | ||
28 | ( echo "<img src=opie-sh-scripts/kbdctrl>" | ||
29 | echo "<h3>About</h3>" | ||
30 | echo "This little App should make it easy for you to " | ||
31 | echo "activate / deactivate the micro keyboard (on ipaq)" | ||
32 | echo "<p>" | ||
33 | ) | $OPIE_SH -t "microkbd control" -f & | ||
34 | SCREENCLEAN=$! | ||
35 | sleep 1 | ||
36 | } | ||
37 | |||
38 | startup() { | ||
39 | echo "<img src=opie-sh-scripts/kbdctrl>" > /tmp/sout | ||
40 | echo "<h3>keyboard up</h3>" >> /tmp/sout | ||
41 | telinit 4 | ||
42 | modprobe h3600_microkbd >> /tmp/sout | ||
43 | cat /dev/microkbd/iconcepts & | ||
44 | echo $! > /tmp/kbdcatpid | ||
45 | $OPIE_SH -t Output -f /tmp/sout | ||
46 | rm /tmp/sout | ||
47 | qcop QPE/System 'suspend()' | ||
48 | } | ||
49 | |||
50 | stopit() { | ||
51 | ( echo "<img src=opie-sh-scripts/kbdctrl>" | ||
52 | echo "<h3>keyboard down</h3>" | ||
53 | read THECAT < /tmp/kbdcatpid | ||
54 | kill $THECAT | ||
55 | rmmod h3600_microkbd | ||
56 | telinit 2 | ||
57 | ) 2>&1 | $OPIE_SH -t Output -f | ||
58 | } | ||
59 | |||
60 | |||
61 | cleanup() { | ||
62 | kill $SCREENCLEAN | ||
63 | rm -f /tmp/qcop-msg-microkbd.sh | ||
64 | } | ||
65 | |||
66 | |||
67 | yesorno() { | ||
68 | $OPIE_SH -m -t "MicroKbd Up/Down" -M "What to do with the Micro Keyboard: " \ | ||
69 | -g -0 Up -1 Down -2 Restart | ||
70 | RETURNCODE=$? | ||
71 | |||
72 | case $RETURNCODE in | ||
73 | -1) echo error... | ||
74 | cleanup | ||
75 | exit ;; | ||
76 | 0) startup ;; | ||
77 | 1) stopit ;; | ||
78 | 2) stopit ; sleep 1 ; startup ;; | ||
79 | esac | ||
80 | } | ||
81 | |||
82 | ###################################################################### | ||
83 | # main | ||
84 | |||
85 | about | ||
86 | yesorno | ||
87 | cleanup | ||