summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp46
1 files changed, 25 insertions, 21 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 59f1592..780d130 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -1,194 +1,198 @@
1/* 1/*
2 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 Copyright (C) The Opie Team <opie-devel@handhelds.org> 3              Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> 4 =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
5 .=l. 5 .=l.
6 .>+-= 6           .>+-=
7_;:, .> :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11- . .-<_> .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13 .%`+i> _;_. 13    .%`+i>       _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++= -. .` .: details. 20++=   -.     .`     .: details.
21: = ...= . :.=- 21 :     =  ...= . :.=-
22-. .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice_zaurus.h" 30#include "odevice_zaurus.h"
31 31
32/* QT */ 32/* QT */
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
37 37
38/* OPIE */ 38/* OPIE */
39#include <qpe/config.h> 39#include <qpe/config.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41#include <qpe/sound.h> 41#include <qpe/sound.h>
42#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
43 43
44/* STD */ 44/* STD */
45#include <fcntl.h> 45#include <fcntl.h>
46#include <math.h> 46#include <math.h>
47#include <stdlib.h> 47#include <stdlib.h>
48#include <signal.h> 48#include <signal.h>
49#include <sys/ioctl.h> 49#include <sys/ioctl.h>
50#include <sys/time.h> 50#include <sys/time.h>
51#include <unistd.h> 51#include <unistd.h>
52#ifndef QT_NO_SOUND 52#ifndef QT_NO_SOUND
53#include <linux/soundcard.h> 53#include <linux/soundcard.h>
54#endif 54#endif
55 55
56using namespace Opie::Core; 56using namespace Opie::Core;
57using namespace Opie::Core::Internal; 57using namespace Opie::Core::Internal;
58 58
59struct z_button z_buttons [] = { 59struct z_button z_buttons [] = {
60 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 60 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
61 "devicebuttons/z_calendar", 61 "devicebuttons/z_calendar",
62 "datebook", "nextView()", 62 "datebook", "nextView()",
63 "today", "raise()" }, 63 "today", "raise()" },
64 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 64 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
65 "devicebuttons/z_contact", 65 "devicebuttons/z_contact",
66 "addressbook", "raise()", 66 "addressbook", "raise()",
67 "addressbook", "beamBusinessCard()" }, 67 "addressbook", "beamBusinessCard()" },
68 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 68 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
69 "devicebuttons/z_home", 69 "devicebuttons/z_home",
70 "QPE/Launcher", "home()", 70 "QPE/Launcher", "home()",
71 "buttonsettings", "raise()" }, 71 "buttonsettings", "raise()" },
72 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 72 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
73 "devicebuttons/z_menu", 73 "devicebuttons/z_menu",
74 "QPE/TaskBar", "toggleMenu()", 74 "QPE/TaskBar", "toggleMenu()",
75 "QPE/TaskBar", "toggleStartMenu()" }, 75 "QPE/TaskBar", "toggleStartMenu()" },
76 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 76 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
77 "devicebuttons/z_mail", 77 "devicebuttons/z_mail",
78 "opiemail", "raise()", 78 "opiemail", "raise()",
79 "opiemail", "newMail()" }, 79 "opiemail", "newMail()" },
80}; 80};
81 81
82struct z_button z_buttons_c700 [] = { 82struct z_button z_buttons_c700 [] = {
83 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 83 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
84 "devicebuttons/z_calendar", 84 "devicebuttons/z_calendar",
85 "datebook", "nextView()", 85 "datebook", "nextView()",
86 "today", "raise()" }, 86 "today", "raise()" },
87 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 87 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
88 "devicebuttons/z_contact", 88 "devicebuttons/z_contact",
89 "addressbook", "raise()", 89 "addressbook", "raise()",
90 "addressbook", "beamBusinessCard()" }, 90 "addressbook", "beamBusinessCard()" },
91 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 91 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
92 "devicebuttons/z_home", 92 "devicebuttons/z_home",
93 "QPE/Launcher", "home()", 93 "QPE/Launcher", "home()",
94 "buttonsettings", "raise()" }, 94 "buttonsettings", "raise()" },
95 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 95 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
96 "devicebuttons/z_menu", 96 "devicebuttons/z_menu",
97 "QPE/TaskBar", "toggleMenu()", 97 "QPE/TaskBar", "toggleMenu()",
98 "QPE/TaskBar", "toggleStartMenu()" }, 98 "QPE/TaskBar", "toggleStartMenu()" },
99 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
100 "devicebuttons/z_mail",
101 "opiemail", "raise()",
102 "opiemail", "newMail()" },
99 { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"), 103 { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
100 "devicebuttons/z_hinge", 104 "devicebuttons/z_hinge",
101 "QPE/Rotation", "rotateDefault()", 105 "QPE/Rotation", "rotateDefault()",
102 "QPE/Dummy", "doNothing()" }, 106 "QPE/Dummy", "doNothing()" },
103}; 107};
104 108
105// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus 109// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
106// class up into individual classes. We need three classes 110// class up into individual classes. We need three classes
107// 111//
108// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) 112// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000)
109// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) 113// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600)
110// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000) 114// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000)
111// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) 115// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000)
112// 116//
113// Only question right now is: Do we really need to do it? Because as soon 117// Only question right now is: Do we really need to do it? Because as soon
114// as the OpenZaurus kernel is ready, there will be a unified interface for all 118// as the OpenZaurus kernel is ready, there will be a unified interface for all
115// Zaurus models (concerning apm, backlight, buttons, etc.) 119// Zaurus models (concerning apm, backlight, buttons, etc.)
116// 120//
117// Comments? - mickeyl. 121// Comments? - mickeyl.
118 122
119void Zaurus::init(const QString& cpu_info) 123void Zaurus::init(const QString& cpu_info)
120{ 124{
121 // generic distribution code already scanned /etc/issue at that point - 125 // generic distribution code already scanned /etc/issue at that point -
122 // embedix releases contain "Embedix <version> | Linux for Embedded Devices" 126 // embedix releases contain "Embedix <version> | Linux for Embedded Devices"
123 if ( d->m_sysverstr.contains( "embedix", false ) ) 127 if ( d->m_sysverstr.contains( "embedix", false ) )
124 { 128 {
125 d->m_vendorstr = "Sharp"; 129 d->m_vendorstr = "Sharp";
126 d->m_vendor = Vendor_Sharp; 130 d->m_vendor = Vendor_Sharp;
127 d->m_systemstr = "Zaurus"; 131 d->m_systemstr = "Zaurus";
128 d->m_system = System_Zaurus; 132 d->m_system = System_Zaurus;
129 m_embedix = true; 133 m_embedix = true;
130 } 134 }
131 else 135 else
132 { 136 {
133 d->m_vendorstr = "OpenZaurus Team"; 137 d->m_vendorstr = "OpenZaurus Team";
134 d->m_systemstr = "OpenZaurus"; 138 d->m_systemstr = "OpenZaurus";
135 d->m_system = System_OpenZaurus; 139 d->m_system = System_OpenZaurus;
136 // sysver already gathered 140 // sysver already gathered
137 141
138 // OpenZaurus sometimes uses the embedix kernel, check if this is one 142 // OpenZaurus sometimes uses the embedix kernel, check if this is one
139 FILE *uname = popen("uname -r", "r"); 143 FILE *uname = popen("uname -r", "r");
140 QFile f; 144 QFile f;
141 QString line; 145 QString line;
142 if ( f.open(IO_ReadOnly, uname) ) { 146 if ( f.open(IO_ReadOnly, uname) ) {
143 QTextStream ts ( &f ); 147 QTextStream ts ( &f );
144 line = ts. readLine(); 148 line = ts. readLine();
145 int loc = line. find ( "embedix" ); 149 int loc = line. find ( "embedix" );
146 if ( loc != -1 ) 150 if ( loc != -1 )
147 m_embedix = true; 151 m_embedix = true;
148 else 152 else
149 m_embedix = false; 153 m_embedix = false;
150 f.close(); 154 f.close();
151 } 155 }
152 pclose(uname); 156 pclose(uname);
153 } 157 }
154 158
155 // check the Zaurus model 159 // check the Zaurus model
156 QString model; 160 QString model;
157 int loc = cpu_info.find( ":" ); 161 int loc = cpu_info.find( ":" );
158 if ( loc != -1 ) 162 if ( loc != -1 )
159 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); 163 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace();
160 else 164 else
161 model = cpu_info; 165 model = cpu_info;
162 166
163 if ( model == "SHARP Corgi" ) { 167 if ( model == "SHARP Corgi" ) {
164 d->m_model = Model_Zaurus_SLC7x0; 168 d->m_model = Model_Zaurus_SLC7x0;
165 d->m_modelstr = "Zaurus SL-C700"; 169 d->m_modelstr = "Zaurus SL-C700";
166 } else if ( model == "SHARP Shepherd" ) { 170 } else if ( model == "SHARP Shepherd" ) {
167 d->m_model = Model_Zaurus_SLC7x0; 171 d->m_model = Model_Zaurus_SLC7x0;
168 d->m_modelstr = "Zaurus SL-C750"; 172 d->m_modelstr = "Zaurus SL-C750";
169 } else if ( model == "SHARP Husky" ) { 173 } else if ( model == "SHARP Husky" ) {
170 d->m_model = Model_Zaurus_SLC7x0; 174 d->m_model = Model_Zaurus_SLC7x0;
171 d->m_modelstr = "Zaurus SL-C760 or SL-C860"; 175 d->m_modelstr = "Zaurus SL-C760 or SL-C860";
172 } else if ( model == "SHARP Boxer" ) { 176 } else if ( model == "SHARP Boxer" ) {
173 d->m_model = Model_Zaurus_SLC7x0; 177 d->m_model = Model_Zaurus_SLC7x0;
174 d->m_modelstr = "Zaurus SL-C760 or SL-C860"; 178 d->m_modelstr = "Zaurus SL-C760 or SL-C860";
175 } else if ( model == "SHARP Poodle" ) { 179 } else if ( model == "SHARP Poodle" ) {
176 d->m_model = Model_Zaurus_SLB600; 180 d->m_model = Model_Zaurus_SLB600;
177 d->m_modelstr = "Zaurus SL-B500 or SL-5600"; 181 d->m_modelstr = "Zaurus SL-B500 or SL-5600";
178 } else if ( model == "Sharp-Collie" || model == "Collie" ) { 182 } else if ( model == "Sharp-Collie" || model == "Collie" ) {
179 d->m_model = Model_Zaurus_SL5500; 183 d->m_model = Model_Zaurus_SL5500;
180 d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; 184 d->m_modelstr = "Zaurus SL-5500 or SL-5000d";
181 } else if ( model == "SHARP Tosa" ) { 185 } else if ( model == "SHARP Tosa" ) {
182 d->m_model = Model_Zaurus_SL6000; 186 d->m_model = Model_Zaurus_SL6000;
183 d->m_modelstr = "Zaurus SL-6000"; 187 d->m_modelstr = "Zaurus SL-6000";
184 } else if ( model == "SHARP Spitz" ) { 188 } else if ( model == "SHARP Spitz" ) {
185 d->m_model = Model_Zaurus_SLC3000; 189 d->m_model = Model_Zaurus_SLC3000;
186 d->m_modelstr = "Zaurus SL-C3000"; 190 d->m_modelstr = "Zaurus SL-C3000";
187 } else { 191 } else {
188 d->m_model = Model_Zaurus_SL5500; 192 d->m_model = Model_Zaurus_SL5500;
189 d->m_modelstr = "Unknown Zaurus"; 193 d->m_modelstr = "Unknown Zaurus";
190 } 194 }
191 195
192 // set initial rotation 196 // set initial rotation
193 switch( d->m_model ) { 197 switch( d->m_model ) {
194 case Model_Zaurus_SL6000: // fallthrough 198 case Model_Zaurus_SL6000: // fallthrough