summaryrefslogtreecommitdiff
path: root/libopie2/opiecore
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore') (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,36 +1,36 @@
/*
-                 This file is part of the Opie Project
-              Copyright (C) The Opie Team <opie-devel@handhelds.org>
- =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
+                 This file is part of the Opie Project
+              Copyright (C) 2002,2003,2004 The Opie Team <opie-devel@handhelds.org>
+ =.
.=l.
-           .>+-=
- _;:,     .>    :=|. This program is free software; you can
-.> <`_,   >  .   <= redistribute it and/or modify it under
-:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
-.="- .-=="i,     .._ License as published by the Free Software
- - .   .-<_>     .<> Foundation; either version 2 of the License,
-     ._= =}       : or (at your option) any later version.
-    .%`+i>       _;_.
-    .i_,=:_.      -<s. This program is distributed in the hope that
-     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
-    : ..    .:,     . . . without even the implied warranty of
-    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
-  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.=       =       ; Library General Public License for more
-++=   -.     .`     .: details.
- :     =  ...= . :.=-
- -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
-    --        :-=` this library; see the file COPYING.LIB.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "odevice_zaurus.h"
/* QT */
#include <qapplication.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qwindowsystem_qws.h>
@@ -126,25 +126,25 @@ struct z_button z_buttons_c700 [] = {
//
// Only question right now is: Do we really need to do it? Because as soon
// as the OpenZaurus kernel is ready, there will be a unified interface for all
// Zaurus models (concerning apm, backlight, buttons, etc.)
//
// Comments? - mickeyl.
void Zaurus::init(const QString& cpu_info)
{
// Set the time to wait until the system is realy suspended
// the delta between apm --suspend and sleeping
setAPMTimeOut( 15000 );
-
+
// generic distribution code already scanned /etc/issue at that point -
// embedix releases contain "Embedix <version> | Linux for Embedded Devices"
if ( d->m_sysverstr.contains( "embedix", false ) )
{
d->m_vendorstr = "Sharp";
d->m_vendor = Vendor_Sharp;
d->m_systemstr = "Zaurus";
d->m_system = System_Zaurus;
m_embedix = true;
}
else
{
@@ -229,24 +229,28 @@ void Zaurus::init(const QString& cpu_info)
if ( m_embedix )
qDebug( "Zaurus::init() - Using the Embedix HAL on a %s", (const char*) d->m_modelstr );
else
qDebug( "Zaurus::init() - Using the OpenZaurus HAL on a %s", (const char*) d->m_modelstr );
}
void Zaurus::initButtons()
{
if ( d->m_buttons )
return;
+ if ( isQWS( ) ) {
+ addPreHandler(this);
+ }
+
d->m_buttons = new QValueList <ODeviceButton>;
struct z_button * pz_buttons;
int buttoncount;
switch ( d->m_model ) {
case Model_Zaurus_SLC3000: // fallthrough
case Model_Zaurus_SLC7x0:
pz_buttons = z_buttons_c700;
buttoncount = ARRAY_SIZE(z_buttons_c700);
break;
default:
pz_buttons = z_buttons;
@@ -582,12 +586,51 @@ OHingeStatus Zaurus::readHingeSensor() const
}
else
{
// corgi keyboard is event source 0 in OZ kernel 2.6
OInputDevice* keyboard = OInputSystem::instance()->device( "event0" );
if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP0 ) ) return CASE_LANDSCAPE;
else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP1 ) ) return CASE_PORTRAIT;
else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP2 ) ) return CASE_CLOSED;
qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" );
return CASE_UNKNOWN;
}
}
+
+/*
+ * Take code from iPAQ device.
+ * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction.
+ * I hope that is ok - Alwin
+ */
+bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
+{
+ Transformation rot;
+ int newkeycode = keycode;
+
+
+ if (d->m_model!=Model_Zaurus_SLC3000 && d->m_model!=Model_Zaurus_SLC7x0) return false;
+ rot = rotation();
+ if (rot==Rot0) return false;
+
+ /* map cursor keys depending on the hinge status */
+ switch ( keycode ) {
+ // Rotate cursor keys
+ case Key_Left :
+ case Key_Right:
+ case Key_Up :
+ case Key_Down :
+ {
+ if (rot==Rot90) {
+ newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4;
+ }
+ }
+ break;
+
+ }
+ if (newkeycode!=keycode) {
+ if ( newkeycode != Key_unknown ) {
+ QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
+ }
+ return true;
+ }
+ return false;
+}
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,46 +1,49 @@
/*
-                 This file is part of the Opie Project
-              Copyright (C) The Opie Team <opie-devel@handhelds.org>
- =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
+                 This file is part of the Opie Project
+              Copyright (C) 2002,2003,2004 The Opie Team <opie-devel@handhelds.org>
+ =.
.=l.
-           .>+-=
- _;:,     .>    :=|. This program is free software; you can
-.> <`_,   >  .   <= redistribute it and/or modify it under
-:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
-.="- .-=="i,     .._ License as published by the Free Software
- - .   .-<_>     .<> Foundation; either version 2 of the License,
-     ._= =}       : or (at your option) any later version.
-    .%`+i>       _;_.
-    .i_,=:_.      -<s. This program is distributed in the hope that
-     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
-    : ..    .:,     . . . without even the implied warranty of
-    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
-  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.=       =       ; Library General Public License for more
-++=   -.     .`     .: details.
- :     =  ...= . :.=-
- -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
-    --        :-=` this library; see the file COPYING.LIB.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ODEVICE_ZAURUS
#define ODEVICE_ZAURUS
#include "odevice_abstractmobiledevice.h"
+/* QT */
+#include <qwindowsystem_qws.h>
+
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif
// _IO and friends are only defined in kernel headers ...
#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
#define OD_IO(type,number) OD_IOC(0,type,number,0)
#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
// Audio
@@ -75,32 +78,32 @@
#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int )
#define APM_EVT_POWER_BUTTON (1 << 0)
// Brightness Embedix
#define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl"
#define SHARP_FL_IOCTL_ON 1
#define SHARP_FL_IOCTL_OFF 2
#define SHARP_FL_IOCTL_STEP_CONTRAST 100
#define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101
#define SHARP_FL_IOCTL_GET_STEP 102
// Vesa Standard
-#define FB_BLANK_UNBLANK 0
-#define FB_BLANK_POWERDOWN 4
+#define FB_BLANK_UNBLANK 0
+#define FB_BLANK_POWERDOWN 4
namespace Opie {
namespace Core {
namespace Internal {
-class Zaurus : public OAbstractMobileDevice
+class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter
{
protected:
virtual void init(const QString&);
virtual void initButtons();
public:
virtual bool setDisplayBrightness( int b );
virtual bool setDisplayStatus( bool on );
virtual int displayBrightnessResolution() const;
virtual void playAlarmSound();
virtual void playKeySound();
@@ -110,24 +113,25 @@ class Zaurus : public OAbstractMobileDevice
virtual QValueList <OLedState> ledStateList ( OLed led ) const;
virtual OLedState ledState( OLed led ) const;
virtual bool setLedState( OLed led, OLedState st );
virtual bool hasHingeSensor() const;
virtual OHingeStatus readHingeSensor() const;
virtual Transformation rotation() const;
virtual ODirection direction() const;
protected:
virtual void buzzer( int snd );
+ virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
OLedState m_leds[1];
bool m_embedix;
};
struct z_button {
Qt::Key code;
char *utext;
char *pix;
char *fpressedservice;
char *fpressedaction;
char *fheldservice;