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,56 +1,56 @@
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
@@ -106,65 +106,65 @@ struct z_button z_buttons_c700 [] = {
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);
@@ -209,64 +209,68 @@ void Zaurus::init(const QString& cpu_info)
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
@@ -562,32 +566,71 @@ OHingeStatus Zaurus::readHingeSensor() const
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