-rw-r--r-- | core/launcher/main.cpp | 130 |
1 files changed, 4 insertions, 126 deletions
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 | |||
@@ -43,3 +43,3 @@ | |||
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" |
@@ -47,112 +47,2 @@ | |||
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 | ||
@@ -275,13 +165,3 @@ 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 | ||
@@ -334,2 +214,4 @@ int initApplication( int argc, char ** argv ) | |||
334 | 214 | ||
215 | ODevice::inst ( )-> setPowerButtonHandler ( ODevice::KERNEL ); | ||
216 | |||
335 | return rv; | 217 | return rv; |
@@ -362,3 +244,2 @@ int main( int argc, char ** argv ) | |||
362 | { | 244 | { |
363 | #ifndef SINGLE_APP | ||
364 | ::signal( SIGCHLD, SIG_IGN ); | 245 | ::signal( SIGCHLD, SIG_IGN ); |
@@ -373,3 +254,2 @@ int main( int argc, char ** argv ) | |||
373 | create_pidfile ( ); | 254 | create_pidfile ( ); |
374 | #endif | ||
375 | 255 | ||
@@ -377,3 +257,2 @@ int main( int argc, char ** argv ) | |||
377 | 257 | ||
378 | #ifndef SINGLE_APP | ||
379 | // Kill them. Kill them all. | 258 | // Kill them. Kill them all. |
@@ -382,3 +261,2 @@ int main( int argc, char ** argv ) | |||
382 | ::kill ( 0, SIGKILL ); | 261 | ::kill ( 0, SIGKILL ); |
383 | #endif | ||
384 | 262 | ||