summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp2
-rw-r--r--core/launcher/main.cpp132
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
@@ -622,4 +622,6 @@ void Desktop::togglePower()
622 blankScreen(); 622 blankScreen();
623 623
624 qDebug ( "OPIE suspending\n" );
625
624 ODevice::inst ( )-> suspend ( ); 626 ODevice::inst ( )-> suspend ( );
625 627
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
@@ -42,118 +42,8 @@
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
49static 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
59void 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
112static 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
139static 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
149void 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
159void initEnvironment() 49void initEnvironment()
@@ -274,15 +164,5 @@ private:
274int initApplication( int argc, char ** argv ) 164int 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();
@@ -333,4 +213,6 @@ int initApplication( int argc, char ** argv )
333 delete d; 213 delete d;
334 214
215 ODevice::inst ( )-> setPowerButtonHandler ( ODevice::KERNEL );
216
335 return rv; 217 return rv;
336} 218}
@@ -361,5 +243,4 @@ void handle_sigterm ( int /* sig */ )
361int main( int argc, char ** argv ) 243int main( int argc, char ** argv )
362{ 244{
363#ifndef SINGLE_APP
364 ::signal( SIGCHLD, SIG_IGN ); 245 ::signal( SIGCHLD, SIG_IGN );
365 246
@@ -372,14 +253,11 @@ int main( int argc, char ** argv )
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;