author | sandman <sandman> | 2002-09-05 21:24:48 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-09-05 21:24:48 (UTC) |
commit | 70f3ed196a462eda3dd6554daddf210438aacc8a (patch) (unidiff) | |
tree | e19256fdc5ceaa5c0b4d1492e15fc42ee87d7692 | |
parent | baea6aaf4f0c9672a4383470a9389bca1a20bdba (diff) | |
download | opie-70f3ed196a462eda3dd6554daddf210438aacc8a.zip opie-70f3ed196a462eda3dd6554daddf210438aacc8a.tar.gz opie-70f3ed196a462eda3dd6554daddf210438aacc8a.tar.bz2 |
- remove obsolete cassiopeia and single-floppy code
- use the new ODevice setPowerButtonHandler() to set and reset power
button handling
-rw-r--r-- | core/launcher/desktop.cpp | 2 | ||||
-rw-r--r-- | core/launcher/main.cpp | 132 |
2 files changed, 7 insertions, 127 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index bf19280..dee5535 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -620,8 +620,10 @@ void Desktop::togglePower() | |||
620 | 620 | ||
621 | if ( wasloggedin ) | 621 | if ( wasloggedin ) |
622 | blankScreen(); | 622 | blankScreen(); |
623 | 623 | ||
624 | qDebug ( "OPIE suspending\n" ); | ||
625 | |||
624 | ODevice::inst ( )-> suspend ( ); | 626 | ODevice::inst ( )-> suspend ( ); |
625 | 627 | ||
626 | QWSServer::screenSaverActivate ( false ); | 628 | QWSServer::screenSaverActivate ( false ); |
627 | 629 | ||
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 5cf624b..ca0bbe4 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp | |||
@@ -40,122 +40,12 @@ | |||
40 | #include <stdio.h> | 40 | #include <stdio.h> |
41 | #include <signal.h> | 41 | #include <signal.h> |
42 | #include <unistd.h> | 42 | #include <unistd.h> |
43 | 43 | ||
44 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 44 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) |
45 | #include "../calibrate/calibrate.h" | 45 | #include "../calibrate/calibrate.h" |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | #ifdef QT_QWS_CASSIOPEIA | ||
49 | static void ignoreMessage( QtMsgType, const char * ) | ||
50 | { | ||
51 | } | ||
52 | #include <sys/mount.h> | ||
53 | #include <sys/types.h> | ||
54 | #include <sys/stat.h> | ||
55 | #include <sys/time.h> | ||
56 | #include <fcntl.h> | ||
57 | #include <qdatetime.h> | ||
58 | |||
59 | void initCassiopeia() | ||
60 | { | ||
61 | // MIPSEL-specific init - make sure /proc exists for shm | ||
62 | /* | ||
63 | if ( mount("/dev/ram0", "/", "ext2", MS_REMOUNT | MS_MGC_VAL, 0 ) ) { | ||
64 | perror("Remounting - / read/write"); | ||
65 | } | ||
66 | */ | ||
67 | if ( mount("none", "/tmp", "ramfs", 0, 0 ) ) { | ||
68 | perror("mounting ramfs /tmp"); | ||
69 | } else { | ||
70 | fprintf( stderr, "mounted /tmp\n" ); | ||
71 | } | ||
72 | if ( mount("none", "/home", "ramfs", 0, 0 ) ) { | ||
73 | perror("mounting ramfs /home"); | ||
74 | } else { | ||
75 | fprintf( stderr, "mounted /home\n" ); | ||
76 | } | ||
77 | if ( mount("none","/proc","proc",0,0) ) { | ||
78 | perror("Mounting - /proc"); | ||
79 | } else { | ||
80 | fprintf( stderr, "mounted /proc\n" ); | ||
81 | } | ||
82 | if ( mount("none","/mnt","shm",0,0) ) { | ||
83 | perror("Mounting - shm"); | ||
84 | } | ||
85 | setenv( "QTDIR", "/", 1 ); | ||
86 | setenv( "OPIEDIR", "/", 1 ); | ||
87 | setenv( "HOME", "/home", 1 ); | ||
88 | mkdir( "/home/Documents", 0755 ); | ||
89 | |||
90 | // set a reasonable starting date | ||
91 | QDateTime dt( QDate( 2001, 3, 15 ) ); | ||
92 | QDateTime now = QDateTime::currentDateTime(); | ||
93 | int change = now.secsTo( dt ); | ||
94 | |||
95 | time_t t = ::time(0); | ||
96 | t += change; | ||
97 | stime(&t); | ||
98 | |||
99 | qInstallMsgHandler(ignoreMessage); | ||
100 | } | ||
101 | #endif | ||
102 | |||
103 | #ifdef QPE_OWNAPM | ||
104 | #include <sys/ioctl.h> | ||
105 | #include <sys/types.h> | ||
106 | #include <fcntl.h> | ||
107 | #include <unistd.h> | ||
108 | #include <errno.h> | ||
109 | #include <linux/ioctl.h> | ||
110 | #include <qpe/global.h> | ||
111 | |||
112 | static void disableAPM() | ||
113 | { | ||
114 | |||
115 | int fd, cur_val, ret; | ||
116 | char *device = "/dev/apm_bios"; | ||
117 | |||
118 | fd = open (device, O_WRONLY); | ||
119 | |||
120 | if (fd == -1) { | ||
121 | perror(device); | ||
122 | return; | ||
123 | } | ||
124 | |||
125 | cur_val = ioctl(fd, APM_IOCGEVTSRC, 0); | ||
126 | if (cur_val == -1) { | ||
127 | perror("ioctl"); | ||
128 | exit(errno); | ||
129 | } | ||
130 | |||
131 | ret = ioctl(fd, APM_IOCSEVTSRC, cur_val & ~APM_EVT_POWER_BUTTON); | ||
132 | if (ret == -1) { | ||
133 | perror("ioctl"); | ||
134 | return; | ||
135 | } | ||
136 | close(fd); | ||
137 | } | ||
138 | |||
139 | static void initAPM() | ||
140 | { | ||
141 | // So that we have to do it ourself, but better. | ||
142 | disableAPM(); | ||
143 | } | ||
144 | #endif | ||
145 | |||
146 | #ifdef QT_DEMO_SINGLE_FLOPPY | ||
147 | #include <sys/mount.h> | ||
148 | |||
149 | void initFloppy() | ||
150 | { | ||
151 | mount("none","/proc","proc",0,0); | ||
152 | setenv( "QTDIR", "/", 0 ); | ||
153 | setenv( "HOME", "/root", 0 ); | ||
154 | setenv( "QWS_SIZE", "240x320", 0 ); | ||
155 | } | ||
156 | #endif | ||
157 | |||
158 | 48 | ||
159 | void initEnvironment() | 49 | void initEnvironment() |
160 | { | 50 | { |
161 | Config config("locale"); | 51 | Config config("locale"); |
@@ -272,19 +162,9 @@ private: | |||
272 | 162 | ||
273 | 163 | ||
274 | int initApplication( int argc, char ** argv ) | 164 | int initApplication( int argc, char ** argv ) |
275 | { | 165 | { |
276 | #ifdef QT_QWS_CASSIOPEIA | 166 | ODevice::inst ( )-> setPowerButtonHandler ( ODevice::OPIE ); |
277 | initCassiopeia(); | ||
278 | #endif | ||
279 | |||
280 | #ifdef QPE_OWNAPM | ||
281 | initAPM(); | ||
282 | #endif | ||
283 | |||
284 | #ifdef QT_DEMO_SINGLE_FLOPPY | ||
285 | initFloppy(); | ||
286 | #endif | ||
287 | 167 | ||
288 | initEnvironment(); | 168 | initEnvironment(); |
289 | 169 | ||
290 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) | 170 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) |
@@ -331,8 +211,10 @@ int initApplication( int argc, char ** argv ) | |||
331 | int rv = a.exec(); | 211 | int rv = a.exec(); |
332 | 212 | ||
333 | delete d; | 213 | delete d; |
334 | 214 | ||
215 | ODevice::inst ( )-> setPowerButtonHandler ( ODevice::KERNEL ); | ||
216 | |||
335 | return rv; | 217 | return rv; |
336 | } | 218 | } |
337 | 219 | ||
338 | static const char *pidfile_path = "/var/run/opie.pid"; | 220 | static const char *pidfile_path = "/var/run/opie.pid"; |
@@ -359,9 +241,8 @@ void handle_sigterm ( int /* sig */ ) | |||
359 | } | 241 | } |
360 | 242 | ||
361 | int main( int argc, char ** argv ) | 243 | int main( int argc, char ** argv ) |
362 | { | 244 | { |
363 | #ifndef SINGLE_APP | ||
364 | ::signal( SIGCHLD, SIG_IGN ); | 245 | ::signal( SIGCHLD, SIG_IGN ); |
365 | 246 | ||
366 | ::signal ( SIGTERM, handle_sigterm ); | 247 | ::signal ( SIGTERM, handle_sigterm ); |
367 | ::signal ( SIGINT, handle_sigterm ); | 248 | ::signal ( SIGINT, handle_sigterm ); |
@@ -370,18 +251,15 @@ int main( int argc, char ** argv ) | |||
370 | ::setpgid ( 0, 0 ); | 251 | ::setpgid ( 0, 0 ); |
371 | 252 | ||
372 | ::atexit ( remove_pidfile ); | 253 | ::atexit ( remove_pidfile ); |
373 | create_pidfile ( ); | 254 | create_pidfile ( ); |
374 | #endif | ||
375 | 255 | ||
376 | int retVal = initApplication ( argc, argv ); | 256 | int retVal = initApplication ( argc, argv ); |
377 | 257 | ||
378 | #ifndef SINGLE_APP | ||
379 | // Kill them. Kill them all. | 258 | // Kill them. Kill them all. |
380 | ::kill ( 0, SIGTERM ); | 259 | ::kill ( 0, SIGTERM ); |
381 | ::sleep( 1 ); | 260 | ::sleep ( 1 ); |
382 | ::kill ( 0, SIGKILL ); | 261 | ::kill ( 0, SIGKILL ); |
383 | #endif | ||
384 | 262 | ||
385 | return retVal; | 263 | return retVal; |
386 | } | 264 | } |
387 | 265 | ||