summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-13 14:47:33 (UTC)
committer alwin <alwin>2005-03-13 14:47:33 (UTC)
commit826bc5ef2aa34877fd8816ddfc4156f865dc9149 (patch) (unidiff)
tree1862353f2954b81a2f1d8b5b522e147a43f46d55
parenteaec48ce99bc4e2f4e53dbd539a031b3ed993fb3 (diff)
downloadopie-826bc5ef2aa34877fd8816ddfc4156f865dc9149.zip
opie-826bc5ef2aa34877fd8816ddfc4156f865dc9149.tar.gz
opie-826bc5ef2aa34877fd8816ddfc4156f865dc9149.tar.bz2
inserted a keyevent-filter just used by CL3000 and C7x0/C8x0.
That way I map the cursor keys depending on hinge-status, eg, on portrait mode scrolling wheel down the cursor key will realy key down and not key left. If this is the wrong place, please correct and tell me - I had tooked this idea and code from iPAQ (but it works fine this moment).
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp89
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.h54
2 files changed, 95 insertions, 48 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 67dfa41..89b9258 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -1,368 +1,372 @@
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) 2002,2003,2004 The Opie Team <opie-devel@handhelds.org>
4 =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> 4 =.
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 <opie2/oinputsystem.h> 39#include <opie2/oinputsystem.h>
40#include <qpe/config.h> 40#include <qpe/config.h>
41#include <qpe/resource.h> 41#include <qpe/resource.h>
42#include <qpe/sound.h> 42#include <qpe/sound.h>
43#include <qpe/qcopenvelope_qws.h> 43#include <qpe/qcopenvelope_qws.h>
44 44
45/* STD */ 45/* STD */
46#include <fcntl.h> 46#include <fcntl.h>
47#include <math.h> 47#include <math.h>
48#include <stdlib.h> 48#include <stdlib.h>
49#include <signal.h> 49#include <signal.h>
50#include <sys/ioctl.h> 50#include <sys/ioctl.h>
51#include <sys/time.h> 51#include <sys/time.h>
52#include <unistd.h> 52#include <unistd.h>
53#ifndef QT_NO_SOUND 53#ifndef QT_NO_SOUND
54#include <linux/soundcard.h> 54#include <linux/soundcard.h>
55#endif 55#endif
56 56
57using namespace Opie::Core; 57using namespace Opie::Core;
58using namespace Opie::Core::Internal; 58using namespace Opie::Core::Internal;
59 59
60struct z_button z_buttons [] = { 60struct z_button z_buttons [] = {
61 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 61 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
62 "devicebuttons/z_calendar", 62 "devicebuttons/z_calendar",
63 "datebook", "nextView()", 63 "datebook", "nextView()",
64 "today", "raise()" }, 64 "today", "raise()" },
65 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 65 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
66 "devicebuttons/z_contact", 66 "devicebuttons/z_contact",
67 "addressbook", "raise()", 67 "addressbook", "raise()",
68 "addressbook", "beamBusinessCard()" }, 68 "addressbook", "beamBusinessCard()" },
69 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 69 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
70 "devicebuttons/z_home", 70 "devicebuttons/z_home",
71 "QPE/Launcher", "home()", 71 "QPE/Launcher", "home()",
72 "buttonsettings", "raise()" }, 72 "buttonsettings", "raise()" },
73 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 73 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
74 "devicebuttons/z_menu", 74 "devicebuttons/z_menu",
75 "QPE/TaskBar", "toggleMenu()", 75 "QPE/TaskBar", "toggleMenu()",
76 "QPE/TaskBar", "toggleStartMenu()" }, 76 "QPE/TaskBar", "toggleStartMenu()" },
77 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 77 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
78 "devicebuttons/z_mail", 78 "devicebuttons/z_mail",
79 "opiemail", "raise()", 79 "opiemail", "raise()",
80 "opiemail", "newMail()" }, 80 "opiemail", "newMail()" },
81}; 81};
82 82
83struct z_button z_buttons_c700 [] = { 83struct z_button z_buttons_c700 [] = {
84 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 84 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
85 "devicebuttons/z_calendar", 85 "devicebuttons/z_calendar",
86 "datebook", "nextView()", 86 "datebook", "nextView()",
87 "today", "raise()" }, 87 "today", "raise()" },
88 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 88 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
89 "devicebuttons/z_contact", 89 "devicebuttons/z_contact",
90 "addressbook", "raise()", 90 "addressbook", "raise()",
91 "addressbook", "beamBusinessCard()" }, 91 "addressbook", "beamBusinessCard()" },
92 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 92 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
93 "devicebuttons/z_home", 93 "devicebuttons/z_home",
94 "QPE/Launcher", "home()", 94 "QPE/Launcher", "home()",
95 "buttonsettings", "raise()" }, 95 "buttonsettings", "raise()" },
96 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 96 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
97 "devicebuttons/z_menu", 97 "devicebuttons/z_menu",
98 "QPE/TaskBar", "toggleMenu()", 98 "QPE/TaskBar", "toggleMenu()",
99 "QPE/TaskBar", "toggleStartMenu()" }, 99 "QPE/TaskBar", "toggleStartMenu()" },
100 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 100 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
101 "devicebuttons/z_mail", 101 "devicebuttons/z_mail",
102 "opiemail", "raise()", 102 "opiemail", "raise()",
103 "opiemail", "newMail()" }, 103 "opiemail", "newMail()" },
104 104
105 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), 105 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"),
106 "devicebuttons/z_hinge1", 106 "devicebuttons/z_hinge1",
107 "QPE/Rotation", "rotateDefault()", 107 "QPE/Rotation", "rotateDefault()",
108 "QPE/Rotation", "rotateDefault()" }, 108 "QPE/Rotation", "rotateDefault()" },
109 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), 109 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"),
110 "devicebuttons/z_hinge2", 110 "devicebuttons/z_hinge2",
111 "QPE/Rotation", "rotateDefault()", 111 "QPE/Rotation", "rotateDefault()",
112 "QPE/Rotation", "rotateDefault()" }, 112 "QPE/Rotation", "rotateDefault()" },
113 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), 113 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"),
114 "devicebuttons/z_hinge3", 114 "devicebuttons/z_hinge3",
115 "QPE/Rotation", "rotateDefault()", 115 "QPE/Rotation", "rotateDefault()",
116 "QPE/Rotation", "rotateDefault()" }, 116 "QPE/Rotation", "rotateDefault()" },
117}; 117};
118 118
119// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus 119// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
120// class up into individual classes. We need three classes 120// class up into individual classes. We need three classes
121// 121//
122// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) 122// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000)
123// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) 123// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600)
124// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000) 124// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000)
125// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) 125// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000)
126// 126//
127// Only question right now is: Do we really need to do it? Because as soon 127// Only question right now is: Do we really need to do it? Because as soon
128// as the OpenZaurus kernel is ready, there will be a unified interface for all 128// as the OpenZaurus kernel is ready, there will be a unified interface for all
129// Zaurus models (concerning apm, backlight, buttons, etc.) 129// Zaurus models (concerning apm, backlight, buttons, etc.)
130// 130//
131// Comments? - mickeyl. 131// Comments? - mickeyl.
132 132
133void Zaurus::init(const QString& cpu_info) 133void Zaurus::init(const QString& cpu_info)
134{ 134{
135 // Set the time to wait until the system is realy suspended 135 // Set the time to wait until the system is realy suspended
136 // the delta between apm --suspend and sleeping 136 // the delta between apm --suspend and sleeping
137 setAPMTimeOut( 15000 ); 137 setAPMTimeOut( 15000 );
138 138
139 // generic distribution code already scanned /etc/issue at that point - 139 // generic distribution code already scanned /etc/issue at that point -
140 // embedix releases contain "Embedix <version> | Linux for Embedded Devices" 140 // embedix releases contain "Embedix <version> | Linux for Embedded Devices"
141 if ( d->m_sysverstr.contains( "embedix", false ) ) 141 if ( d->m_sysverstr.contains( "embedix", false ) )
142 { 142 {
143 d->m_vendorstr = "Sharp"; 143 d->m_vendorstr = "Sharp";
144 d->m_vendor = Vendor_Sharp; 144 d->m_vendor = Vendor_Sharp;
145 d->m_systemstr = "Zaurus"; 145 d->m_systemstr = "Zaurus";
146 d->m_system = System_Zaurus; 146 d->m_system = System_Zaurus;
147 m_embedix = true; 147 m_embedix = true;
148 } 148 }
149 else 149 else
150 { 150 {
151 d->m_vendorstr = "OpenZaurus Team"; 151 d->m_vendorstr = "OpenZaurus Team";
152 d->m_systemstr = "OpenZaurus"; 152 d->m_systemstr = "OpenZaurus";
153 d->m_system = System_OpenZaurus; 153 d->m_system = System_OpenZaurus;
154 // sysver already gathered 154 // sysver already gathered
155 155
156 // OpenZaurus sometimes uses the embedix kernel, check if this is one 156 // OpenZaurus sometimes uses the embedix kernel, check if this is one
157 FILE *uname = popen("uname -r", "r"); 157 FILE *uname = popen("uname -r", "r");
158 QFile f; 158 QFile f;
159 QString line; 159 QString line;
160 if ( f.open(IO_ReadOnly, uname) ) { 160 if ( f.open(IO_ReadOnly, uname) ) {
161 QTextStream ts ( &f ); 161 QTextStream ts ( &f );
162 line = ts. readLine(); 162 line = ts. readLine();
163 int loc = line. find ( "embedix" ); 163 int loc = line. find ( "embedix" );
164 if ( loc != -1 ) 164 if ( loc != -1 )
165 m_embedix = true; 165 m_embedix = true;
166 else 166 else
167 m_embedix = false; 167 m_embedix = false;
168 f.close(); 168 f.close();
169 } 169 }
170 pclose(uname); 170 pclose(uname);
171 } 171 }
172 172
173 // check the Zaurus model 173 // check the Zaurus model
174 QString model; 174 QString model;
175 int loc = cpu_info.find( ":" ); 175 int loc = cpu_info.find( ":" );
176 if ( loc != -1 ) 176 if ( loc != -1 )
177 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); 177 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace();
178 else 178 else
179 model = cpu_info; 179 model = cpu_info;
180 180
181 if ( model == "SHARP Corgi" ) { 181 if ( model == "SHARP Corgi" ) {
182 d->m_model = Model_Zaurus_SLC7x0; 182 d->m_model = Model_Zaurus_SLC7x0;
183 d->m_modelstr = "Zaurus SL-C700"; 183 d->m_modelstr = "Zaurus SL-C700";
184 } else if ( model == "SHARP Shepherd" ) { 184 } else if ( model == "SHARP Shepherd" ) {
185 d->m_model = Model_Zaurus_SLC7x0; 185 d->m_model = Model_Zaurus_SLC7x0;
186 d->m_modelstr = "Zaurus SL-C750"; 186 d->m_modelstr = "Zaurus SL-C750";
187 } else if ( model == "SHARP Husky" ) { 187 } else if ( model == "SHARP Husky" ) {
188 d->m_model = Model_Zaurus_SLC7x0; 188 d->m_model = Model_Zaurus_SLC7x0;
189 d->m_modelstr = "Zaurus SL-C760 or SL-C860"; 189 d->m_modelstr = "Zaurus SL-C760 or SL-C860";
190 } else if ( model == "SHARP Boxer" ) { 190 } else if ( model == "SHARP Boxer" ) {
191 d->m_model = Model_Zaurus_SLC7x0; 191 d->m_model = Model_Zaurus_SLC7x0;
192 d->m_modelstr = "Zaurus SL-C760 or SL-C860"; 192 d->m_modelstr = "Zaurus SL-C760 or SL-C860";
193 } else if ( model == "SHARP Poodle" ) { 193 } else if ( model == "SHARP Poodle" ) {
194 d->m_model = Model_Zaurus_SLB600; 194 d->m_model = Model_Zaurus_SLB600;
195 d->m_modelstr = "Zaurus SL-B500 or SL-5600"; 195 d->m_modelstr = "Zaurus SL-B500 or SL-5600";
196 } else if ( model == "Sharp-Collie" || model == "Collie" ) { 196 } else if ( model == "Sharp-Collie" || model == "Collie" ) {
197 d->m_model = Model_Zaurus_SL5500; 197 d->m_model = Model_Zaurus_SL5500;
198 d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; 198 d->m_modelstr = "Zaurus SL-5500 or SL-5000d";
199 } else if ( model == "SHARP Tosa" ) { 199 } else if ( model == "SHARP Tosa" ) {
200 d->m_model = Model_Zaurus_SL6000; 200 d->m_model = Model_Zaurus_SL6000;
201 d->m_modelstr = "Zaurus SL-6000"; 201 d->m_modelstr = "Zaurus SL-6000";
202 } else if ( model == "SHARP Spitz" ) { 202 } else if ( model == "SHARP Spitz" ) {
203 d->m_model = Model_Zaurus_SLC3000; 203 d->m_model = Model_Zaurus_SLC3000;
204 d->m_modelstr = "Zaurus SL-C3000"; 204 d->m_modelstr = "Zaurus SL-C3000";
205 } else { 205 } else {
206 d->m_model = Model_Zaurus_SL5500; 206 d->m_model = Model_Zaurus_SL5500;
207 d->m_modelstr = "Unknown Zaurus"; 207 d->m_modelstr = "Unknown Zaurus";
208 } 208 }
209 209
210 // set initial rotation 210 // set initial rotation
211 switch( d->m_model ) { 211 switch( d->m_model ) {
212 case Model_Zaurus_SL6000: // fallthrough 212 case Model_Zaurus_SL6000: // fallthrough
213 case Model_Zaurus_SLA300: 213 case Model_Zaurus_SLA300:
214 d->m_rotation = Rot0; 214 d->m_rotation = Rot0;
215 break; 215 break;
216 case Model_Zaurus_SLC3000: // fallthrough 216 case Model_Zaurus_SLC3000: // fallthrough
217 case Model_Zaurus_SLC7x0: 217 case Model_Zaurus_SLC7x0:
218 d->m_rotation = rotation(); 218 d->m_rotation = rotation();
219 d->m_direction = direction(); 219 d->m_direction = direction();
220 break; 220 break;
221 case Model_Zaurus_SLB600: // fallthrough 221 case Model_Zaurus_SLB600: // fallthrough
222 case Model_Zaurus_SL5000: // fallthrough 222 case Model_Zaurus_SL5000: // fallthrough
223 case Model_Zaurus_SL5500: // fallthrough 223 case Model_Zaurus_SL5500: // fallthrough
224 default: 224 default:
225 d->m_rotation = Rot270; 225 d->m_rotation = Rot270;
226 break; 226 break;
227 } 227 }
228 m_leds[0] = Led_Off; 228 m_leds[0] = Led_Off;
229 229
230 if ( m_embedix ) 230 if ( m_embedix )
231 qDebug( "Zaurus::init() - Using the Embedix HAL on a %s", (const char*) d->m_modelstr ); 231 qDebug( "Zaurus::init() - Using the Embedix HAL on a %s", (const char*) d->m_modelstr );
232 else 232 else
233 qDebug( "Zaurus::init() - Using the OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); 233 qDebug( "Zaurus::init() - Using the OpenZaurus HAL on a %s", (const char*) d->m_modelstr );
234} 234}
235 235
236void Zaurus::initButtons() 236void Zaurus::initButtons()
237{ 237{
238 if ( d->m_buttons ) 238 if ( d->m_buttons )
239 return; 239 return;
240 240
241 if ( isQWS( ) ) {
242 addPreHandler(this);
243 }
244
241 d->m_buttons = new QValueList <ODeviceButton>; 245 d->m_buttons = new QValueList <ODeviceButton>;
242 246
243 struct z_button * pz_buttons; 247 struct z_button * pz_buttons;
244 int buttoncount; 248 int buttoncount;
245 switch ( d->m_model ) { 249 switch ( d->m_model ) {
246 case Model_Zaurus_SLC3000: // fallthrough 250 case Model_Zaurus_SLC3000: // fallthrough
247 case Model_Zaurus_SLC7x0: 251 case Model_Zaurus_SLC7x0:
248 pz_buttons = z_buttons_c700; 252 pz_buttons = z_buttons_c700;
249 buttoncount = ARRAY_SIZE(z_buttons_c700); 253 buttoncount = ARRAY_SIZE(z_buttons_c700);
250 break; 254 break;
251 default: 255 default:
252 pz_buttons = z_buttons; 256 pz_buttons = z_buttons;
253 buttoncount = ARRAY_SIZE(z_buttons); 257 buttoncount = ARRAY_SIZE(z_buttons);
254 break; 258 break;
255 } 259 }
256 260
257 for ( int i = 0; i < buttoncount; i++ ) { 261 for ( int i = 0; i < buttoncount; i++ ) {
258 struct z_button *zb = pz_buttons + i; 262 struct z_button *zb = pz_buttons + i;
259 ODeviceButton b; 263 ODeviceButton b;
260 264
261 b.setKeycode( zb->code ); 265 b.setKeycode( zb->code );
262 b.setUserText( QObject::tr( "Button", zb->utext )); 266 b.setUserText( QObject::tr( "Button", zb->utext ));
263 b.setPixmap( Resource::loadPixmap( zb->pix )); 267 b.setPixmap( Resource::loadPixmap( zb->pix ));
264 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); 268 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction ));
265 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); 269 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction ));
266 d->m_buttons->append( b ); 270 d->m_buttons->append( b );
267 } 271 }
268 272
269 reloadButtonMapping(); 273 reloadButtonMapping();
270} 274}
271 275
272 276
273 277
274typedef struct sharp_led_status { 278typedef struct sharp_led_status {
275 int which; /* select which LED status is wanted. */ 279 int which; /* select which LED status is wanted. */
276 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 280 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
277} sharp_led_status; 281} sharp_led_status;
278 282
279void Zaurus::buzzer( int sound ) 283void Zaurus::buzzer( int sound )
280{ 284{
281#ifndef QT_NO_SOUND 285#ifndef QT_NO_SOUND
282 Sound *snd = 0; 286 Sound *snd = 0;
283 287
284 // All devices except SL5500 have a DSP device 288 // All devices except SL5500 have a DSP device
285 if ( d->m_model != Model_Zaurus_SL5000 289 if ( d->m_model != Model_Zaurus_SL5000
286 && d->m_model != Model_Zaurus_SL5500 ) { 290 && d->m_model != Model_Zaurus_SL5500 ) {
287 291
288 switch ( sound ){ 292 switch ( sound ){
289 case SHARP_BUZ_TOUCHSOUND: { 293 case SHARP_BUZ_TOUCHSOUND: {
290 static Sound touch_sound("touchsound"); 294 static Sound touch_sound("touchsound");
291 snd = &touch_sound; 295 snd = &touch_sound;
292 } 296 }
293 break; 297 break;
294 case SHARP_BUZ_KEYSOUND: { 298 case SHARP_BUZ_KEYSOUND: {
295 static Sound key_sound( "keysound" ); 299 static Sound key_sound( "keysound" );
296 snd = &key_sound; 300 snd = &key_sound;
297 } 301 }
298 break; 302 break;
299 case SHARP_BUZ_SCHEDULE_ALARM: 303 case SHARP_BUZ_SCHEDULE_ALARM:
300 default: { 304 default: {
301 static Sound alarm_sound("alarm"); 305 static Sound alarm_sound("alarm");
302 snd = &alarm_sound; 306 snd = &alarm_sound;
303 } 307 }
304 break; 308 break;
305 } 309 }
306 } 310 }
307 311
308 // If a soundname is defined, we expect that this device has 312 // If a soundname is defined, we expect that this device has
309 // sound capabilities.. Otherwise we expect to have the buzzer 313 // sound capabilities.. Otherwise we expect to have the buzzer
310 // device.. 314 // device..
311 if ( snd && snd->isFinished() ){ 315 if ( snd && snd->isFinished() ){
312 changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); 316 changeMixerForAlarm( 0, "/dev/sound/mixer", snd );
313 snd->play(); 317 snd->play();
314 } else if( !snd ) { 318 } else if( !snd ) {
315 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); 319 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
316 320
317 if ( fd >= 0 ) { 321 if ( fd >= 0 ) {
318 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 322 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
319 ::close ( fd ); 323 ::close ( fd );
320 } 324 }
321 325
322 } 326 }
323#endif 327#endif
324} 328}
325 329
326 330
327void Zaurus::playAlarmSound() 331void Zaurus::playAlarmSound()
328{ 332{
329 buzzer( SHARP_BUZ_SCHEDULE_ALARM ); 333 buzzer( SHARP_BUZ_SCHEDULE_ALARM );
330} 334}
331 335
332void Zaurus::playTouchSound() 336void Zaurus::playTouchSound()
333{ 337{
334 buzzer( SHARP_BUZ_TOUCHSOUND ); 338 buzzer( SHARP_BUZ_TOUCHSOUND );
335} 339}
336 340
337void Zaurus::playKeySound() 341void Zaurus::playKeySound()
338{ 342{
339 buzzer( SHARP_BUZ_KEYSOUND ); 343 buzzer( SHARP_BUZ_KEYSOUND );
340} 344}
341 345
342 346
343QValueList <OLed> Zaurus::ledList() const 347QValueList <OLed> Zaurus::ledList() const
344{ 348{
345 QValueList <OLed> vl; 349 QValueList <OLed> vl;
346 vl << Led_Mail; 350 vl << Led_Mail;
347 return vl; 351 return vl;
348} 352}
349 353
350QValueList <OLedState> Zaurus::ledStateList( OLed l ) const 354QValueList <OLedState> Zaurus::ledStateList( OLed l ) const
351{ 355{
352 QValueList <OLedState> vl; 356 QValueList <OLedState> vl;
353 357
354 if ( l == Led_Mail ) 358 if ( l == Led_Mail )
355 vl << Led_Off << Led_On << Led_BlinkSlow; 359 vl << Led_Off << Led_On << Led_BlinkSlow;
356 return vl; 360 return vl;
357} 361}
358 362
359OLedState Zaurus::ledState( OLed which ) const 363OLedState Zaurus::ledState( OLed which ) const
360{ 364{
361 if ( which == Led_Mail ) 365 if ( which == Led_Mail )
362 return m_leds [0]; 366 return m_leds [0];
363 else 367 else
364 return Led_Off; 368 return Led_Off;
365} 369}
366 370
367bool Zaurus::setLedState( OLed which, OLedState st ) 371bool Zaurus::setLedState( OLed which, OLedState st )
368{ 372{
@@ -466,128 +470,167 @@ bool Zaurus::setDisplayStatus( bool on )
466 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); 470 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK );
467 if ( fd ) 471 if ( fd )
468 { 472 {
469 int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; 473 int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF;
470 res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); 474 res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 );
471 ::close ( fd ); 475 ::close ( fd );
472 } 476 }
473 } 477 }
474 else 478 else
475 { 479 {
476 int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK ); 480 int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK );
477 if ( fd ) 481 if ( fd )
478 { 482 {
479 char buf[10]; 483 char buf[10];
480 buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; 484 buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
481 buf[1] = '\0'; 485 buf[1] = '\0';
482 res = ( ::write( fd, &buf[0], 2 ) == 0 ); 486 res = ( ::write( fd, &buf[0], 2 ) == 0 );
483 ::close( fd ); 487 ::close( fd );
484 } 488 }
485 } 489 }
486 return res; 490 return res;
487} 491}
488 492
489Transformation Zaurus::rotation() const 493Transformation Zaurus::rotation() const
490{ 494{
491 qDebug( "Zaurus::rotation()" ); 495 qDebug( "Zaurus::rotation()" );
492 Transformation rot; 496 Transformation rot;
493 497
494 switch ( d->m_model ) { 498 switch ( d->m_model ) {
495 case Model_Zaurus_SLC3000: // fallthrough 499 case Model_Zaurus_SLC3000: // fallthrough
496 case Model_Zaurus_SLC7x0: 500 case Model_Zaurus_SLC7x0:
497 { 501 {
498 OHingeStatus hs = readHingeSensor(); 502 OHingeStatus hs = readHingeSensor();
499 qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); 503 qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs );
500 504
501 if ( m_embedix ) 505 if ( m_embedix )
502 { 506 {
503 if ( hs == CASE_PORTRAIT ) rot = Rot0; 507 if ( hs == CASE_PORTRAIT ) rot = Rot0;
504 else if ( hs == CASE_UNKNOWN ) rot = Rot0; 508 else if ( hs == CASE_UNKNOWN ) rot = Rot0;
505 else rot = Rot270; 509 else rot = Rot270;
506 } 510 }
507 else 511 else
508 { 512 {
509 if ( hs == CASE_PORTRAIT ) rot = Rot90; 513 if ( hs == CASE_PORTRAIT ) rot = Rot90;
510 else if ( hs == CASE_UNKNOWN ) rot = Rot0; 514 else if ( hs == CASE_UNKNOWN ) rot = Rot0;
511 else rot = Rot0; 515 else rot = Rot0;
512 } 516 }
513 } 517 }
514 break; 518 break;
515 case Model_Zaurus_SL6000: 519 case Model_Zaurus_SL6000:
516 case Model_Zaurus_SLB600: 520 case Model_Zaurus_SLB600:
517 case Model_Zaurus_SLA300: 521 case Model_Zaurus_SLA300:
518 case Model_Zaurus_SL5500: 522 case Model_Zaurus_SL5500:
519 case Model_Zaurus_SL5000: 523 case Model_Zaurus_SL5000:
520 default: 524 default:
521 rot = d->m_rotation; 525 rot = d->m_rotation;
522 break; 526 break;
523 } 527 }
524 528
525 return rot; 529 return rot;
526} 530}
527ODirection Zaurus::direction() const 531ODirection Zaurus::direction() const
528{ 532{
529 ODirection dir; 533 ODirection dir;
530 534
531 switch ( d->m_model ) { 535 switch ( d->m_model ) {
532 case Model_Zaurus_SLC3000: // fallthrough 536 case Model_Zaurus_SLC3000: // fallthrough
533 case Model_Zaurus_SLC7x0: { 537 case Model_Zaurus_SLC7x0: {
534 OHingeStatus hs = readHingeSensor(); 538 OHingeStatus hs = readHingeSensor();
535 if ( hs == CASE_PORTRAIT ) dir = CCW; 539 if ( hs == CASE_PORTRAIT ) dir = CCW;
536 else if ( hs == CASE_UNKNOWN ) dir = CCW; 540 else if ( hs == CASE_UNKNOWN ) dir = CCW;
537 else dir = CW; 541 else dir = CW;
538 } 542 }
539 break; 543 break;
540 case Model_Zaurus_SL6000: 544 case Model_Zaurus_SL6000:
541 case Model_Zaurus_SLA300: 545 case Model_Zaurus_SLA300:
542 case Model_Zaurus_SLB600: 546 case Model_Zaurus_SLB600:
543 case Model_Zaurus_SL5500: 547 case Model_Zaurus_SL5500:
544 case Model_Zaurus_SL5000: 548 case Model_Zaurus_SL5000:
545 default: dir = d->m_direction; 549 default: dir = d->m_direction;
546 break; 550 break;
547 } 551 }
548 return dir; 552 return dir;
549 553
550} 554}
551 555
552bool Zaurus::hasHingeSensor() const 556bool Zaurus::hasHingeSensor() const
553{ 557{
554 return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000; 558 return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000;
555} 559}
556 560
557OHingeStatus Zaurus::readHingeSensor() const 561OHingeStatus Zaurus::readHingeSensor() const
558{ 562{
559 if (m_embedix) 563 if (m_embedix)
560 { 564 {
561 int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); 565 int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK);
562 if (handle == -1) 566 if (handle == -1)
563 { 567 {
564 qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror 568 qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror
565 return CASE_UNKNOWN; 569 return CASE_UNKNOWN;
566 } 570 }
567 else 571 else
568 { 572 {
569 int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); 573 int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION);
570 ::close (handle); 574 ::close (handle);
571 if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE ) 575 if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE )
572 { 576 {
573 qDebug( "Zaurus::readHingeSensor() - result = %d", retval ); 577 qDebug( "Zaurus::readHingeSensor() - result = %d", retval );
574 return static_cast<OHingeStatus>( retval ); 578 return static_cast<OHingeStatus>( retval );
575 } 579 }
576 else 580 else
577 { 581 {
578 qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); 582 qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" );
579 return CASE_UNKNOWN; 583 return CASE_UNKNOWN;
580 } 584 }
581 } 585 }
582 } 586 }
583 else 587 else
584 { 588 {
585 // corgi keyboard is event source 0 in OZ kernel 2.6 589 // corgi keyboard is event source 0 in OZ kernel 2.6
586 OInputDevice* keyboard = OInputSystem::instance()->device( "event0" ); 590 OInputDevice* keyboard = OInputSystem::instance()->device( "event0" );
587 if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP0 ) ) return CASE_LANDSCAPE; 591 if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP0 ) ) return CASE_LANDSCAPE;
588 else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP1 ) ) return CASE_PORTRAIT; 592 else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP1 ) ) return CASE_PORTRAIT;
589 else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP2 ) ) return CASE_CLOSED; 593 else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP2 ) ) return CASE_CLOSED;
590 qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); 594 qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" );
591 return CASE_UNKNOWN; 595 return CASE_UNKNOWN;
592 } 596 }
593} 597}
598
599/*
600 * Take code from iPAQ device.
601 * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction.
602 * I hope that is ok - Alwin
603 */
604bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
605{
606 Transformation rot;
607 int newkeycode = keycode;
608
609
610 if (d->m_model!=Model_Zaurus_SLC3000 && d->m_model!=Model_Zaurus_SLC7x0) return false;
611 rot = rotation();
612 if (rot==Rot0) return false;
613
614 /* map cursor keys depending on the hinge status */
615 switch ( keycode ) {
616 // Rotate cursor keys
617 case Key_Left :
618 case Key_Right:
619 case Key_Up :
620 case Key_Down :
621 {
622 if (rot==Rot90) {
623 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4;
624 }
625 }
626 break;
627
628 }
629 if (newkeycode!=keycode) {
630 if ( newkeycode != Key_unknown ) {
631 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
632 }
633 return true;
634 }
635 return false;
636}
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h
index 6e6ca46..1fb0cd9 100644
--- a/libopie2/opiecore/device/odevice_zaurus.h
+++ b/libopie2/opiecore/device/odevice_zaurus.h
@@ -1,139 +1,143 @@
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) 2002,2003,2004 The Opie Team <opie-devel@handhelds.org>
4 =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> 4 =.
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#ifndef ODEVICE_ZAURUS 30#ifndef ODEVICE_ZAURUS
31#define ODEVICE_ZAURUS 31#define ODEVICE_ZAURUS
32 32
33#include "odevice_abstractmobiledevice.h" 33#include "odevice_abstractmobiledevice.h"
34 34
35/* QT */
36#include <qwindowsystem_qws.h>
37
35#ifndef ARRAY_SIZE 38#ifndef ARRAY_SIZE
36#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 39#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
37#endif 40#endif
38 41
39// _IO and friends are only defined in kernel headers ... 42// _IO and friends are only defined in kernel headers ...
40#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 43#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
41#define OD_IO(type,number) OD_IOC(0,type,number,0) 44#define OD_IO(type,number) OD_IOC(0,type,number,0)
42#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) 45#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
43#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) 46#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
44#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) 47#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
45 48
46// Audio 49// Audio
47#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 50#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
48 51
49#define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 52#define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
50#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 53#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
51 54
52#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 55#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
53#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 56#define SHARP_BUZ_KEYSOUND 2 /* key sound */
54#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 57#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
55 58
56#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) 59#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
57#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 60#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
58#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 61#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
59#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 62#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
60#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 63#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
61 64
62// LED 65// LED
63#define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 66#define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
64#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) 67#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1)
65#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ 68#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */
66 69
67#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ 70#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */
68#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ 71#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */
69#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ 72#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */
70 73
71// Rotation and Power Management 74// Rotation and Power Management
72#define SHARP_IOCTL_GET_ROTATION 0x413c 75#define SHARP_IOCTL_GET_ROTATION 0x413c
73 76
74#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) 77#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int )
75#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) 78#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int )
76#define APM_EVT_POWER_BUTTON (1 << 0) 79#define APM_EVT_POWER_BUTTON (1 << 0)
77 80
78// Brightness Embedix 81// Brightness Embedix
79#define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl" 82#define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl"
80#define SHARP_FL_IOCTL_ON 1 83#define SHARP_FL_IOCTL_ON 1
81#define SHARP_FL_IOCTL_OFF 2 84#define SHARP_FL_IOCTL_OFF 2
82#define SHARP_FL_IOCTL_STEP_CONTRAST 100 85#define SHARP_FL_IOCTL_STEP_CONTRAST 100
83#define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101 86#define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101
84#define SHARP_FL_IOCTL_GET_STEP 102 87#define SHARP_FL_IOCTL_GET_STEP 102
85 88
86// Vesa Standard 89// Vesa Standard
87 #define FB_BLANK_UNBLANK 0 90#define FB_BLANK_UNBLANK 0
88 #define FB_BLANK_POWERDOWN 4 91#define FB_BLANK_POWERDOWN 4
89 92
90namespace Opie { 93namespace Opie {
91namespace Core { 94namespace Core {
92namespace Internal { 95namespace Internal {
93 96
94class Zaurus : public OAbstractMobileDevice 97class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter
95{ 98{
96 protected: 99 protected:
97 virtual void init(const QString&); 100 virtual void init(const QString&);
98 virtual void initButtons(); 101 virtual void initButtons();
99 102
100 public: 103 public:
101 virtual bool setDisplayBrightness( int b ); 104 virtual bool setDisplayBrightness( int b );
102 virtual bool setDisplayStatus( bool on ); 105 virtual bool setDisplayStatus( bool on );
103 virtual int displayBrightnessResolution() const; 106 virtual int displayBrightnessResolution() const;
104 107
105 virtual void playAlarmSound(); 108 virtual void playAlarmSound();
106 virtual void playKeySound(); 109 virtual void playKeySound();
107 virtual void playTouchSound(); 110 virtual void playTouchSound();
108 111
109 virtual QValueList <OLed> ledList() const; 112 virtual QValueList <OLed> ledList() const;
110 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 113 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
111 virtual OLedState ledState( OLed led ) const; 114 virtual OLedState ledState( OLed led ) const;
112 virtual bool setLedState( OLed led, OLedState st ); 115 virtual bool setLedState( OLed led, OLedState st );
113 116
114 virtual bool hasHingeSensor() const; 117 virtual bool hasHingeSensor() const;
115 virtual OHingeStatus readHingeSensor() const; 118 virtual OHingeStatus readHingeSensor() const;
116 119
117 virtual Transformation rotation() const; 120 virtual Transformation rotation() const;
118 virtual ODirection direction() const; 121 virtual ODirection direction() const;
119 122
120 protected: 123 protected:
121 virtual void buzzer( int snd ); 124 virtual void buzzer( int snd );
125 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
122 126
123 OLedState m_leds[1]; 127 OLedState m_leds[1];
124 bool m_embedix; 128 bool m_embedix;
125}; 129};
126 130
127struct z_button { 131struct z_button {
128 Qt::Key code; 132 Qt::Key code;
129 char *utext; 133 char *utext;
130 char *pix; 134 char *pix;
131 char *fpressedservice; 135 char *fpressedservice;
132 char *fpressedaction; 136 char *fpressedaction;
133 char *fheldservice; 137 char *fheldservice;
134 char *fheldaction; 138 char *fheldaction;
135}; 139};
136} 140}
137} 141}
138} 142}
139#endif 143#endif