summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-01-13 18:32:19 (UTC)
committer mickeyl <mickeyl>2004-01-13 18:32:19 (UTC)
commit061ccf5b9d384b1f24d203e96f1f04ccf1dcf133 (patch) (unidiff)
treeec1fc064f001edba92e58116cdc35fc909b5cdd6
parent59f7fa0a480bf921a67ad42fc1fe018b1be44192 (diff)
downloadopie-061ccf5b9d384b1f24d203e96f1f04ccf1dcf133.zip
opie-061ccf5b9d384b1f24d203e96f1f04ccf1dcf133.tar.gz
opie-061ccf5b9d384b1f24d203e96f1f04ccf1dcf133.tar.bz2
- rewrite device detection
- cleanup - split odevice stuff into header and cpp files - Note for next buildsystem: Don't link all header files but distinguish between public and private headers, e.g. odevice.h is public while odevice_ipaq.h is private.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp71
-rw-r--r--libopie2/opiecore/device/odevice.h4
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp55
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.h84
-rw-r--r--libopie2/opiecore/device/odevice_jornada.cpp76
-rw-r--r--libopie2/opiecore/device/odevice_jornada.h50
-rw-r--r--libopie2/opiecore/device/odevice_ramses.cpp50
-rw-r--r--libopie2/opiecore/device/odevice_ramses.h72
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp56
-rw-r--r--libopie2/opiecore/device/odevice_simpad.h81
-rw-r--r--libopie2/opiecore/device/odevice_yopy.cpp107
-rw-r--r--libopie2/opiecore/device/odevice_yopy.h62
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp103
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.h96
-rw-r--r--libopie2/opiecore/opiecore.pro6
15 files changed, 532 insertions, 441 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index 0f88c3c..6c8432f 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -27,7 +27,12 @@
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice.h" 30#include "odevice_ipaq.h"
31#include "odevice_jornada.h"
32#include "odevice_ramses.h"
33#include "odevice_simpad.h"
34#include "odevice_yopy.h"
35#include "odevice_zaurus.h"
31 36
32/* QT */ 37/* QT */
33#include <qapplication.h> 38#include <qapplication.h>
@@ -53,52 +58,46 @@
53#include <linux/soundcard.h> 58#include <linux/soundcard.h>
54#endif 59#endif
55 60
56#ifndef ARRAY_SIZE 61const char* PATH_PROC_CPUINFO = "/proc/cpuinfo";
57#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
58#endif
59
60// _IO and friends are only defined in kernel headers ...
61
62#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
63
64#define OD_IO(type,number) OD_IOC(0,type,number,0)
65#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
66#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
67#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
68 62
69using namespace Opie; 63using namespace Opie;
70 64
71class iPAQ;
72class Zaurus;
73class SIMpad;
74class Ramses;
75class Jornada;
76
77ODevice *ODevice::inst() 65ODevice *ODevice::inst()
78{ 66{
79 static ODevice *dev = 0; 67 static ODevice *dev = 0;
80 68
81 // rewrite this to only use /proc/devinfo or so 69 // rewrite this to only use /proc/cpuinfo or so
82 70
83 /* 71 if ( !dev )
84 if ( !dev ) { 72 {
85 if ( QFile::exists ( "/proc/hal/model" )) 73 QFile f( PATH_PROC_CPUINFO );
86 dev = new iPAQ(); 74 if ( f.open( IO_ReadOnly ) )
87 else if ( Zaurus::isZaurus() ) 75 {
88 dev = new Zaurus(); 76 QTextStream s( &f );
89 else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" )) 77 while ( !s.atEnd() )
90 dev = new SIMpad(); 78 {
91 else if ( QFile::exists ( "/proc/sys/board/name" )) 79 QString line;
92 dev = new Ramses(); 80 line = s.readLine();
93 else if ( Yopy::isYopy() ) 81 if ( line.startsWith( "Hardware" ) )
94 dev = new Yopy(); 82 {
95 else if ( Jornada::isJornada() ) 83 qDebug( "ODevice() - found '%s'", (const char*) line );
96 dev = new Jornada(); 84 if ( line.contains( "sharp", false ) ) dev = new Zaurus();
85 else if ( line.contains( "ipaq", false ) ) dev = new iPAQ();
86 else if ( line.contains( "simpad", false ) ) dev = new SIMpad();
87 else if ( line.contains( "jornada", false ) ) dev = new Jornada();
88 else if ( line.contains( "ramses", false ) ) dev = new Ramses();
89 else qWarning( "ODevice() - unknown hardware - using default." );
90 break;
91 }
92 }
93 }
97 else 94 else
98 dev = new ODevice(); 95 {
96 qWarning( "ODevice() - can't open '%s' - unknown hardware - using default." );
97 }
98 if ( !dev ) dev = new ODevice();
99 dev->init(); 99 dev->init();
100 } 100 }
101 */
102 return dev; 101 return dev;
103} 102}
104 103
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index bde6411..8ae7ffa 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -30,7 +30,9 @@
30#ifndef ODEVICE_H_ 30#ifndef ODEVICE_H_
31#define ODEVICE_H_ 31#define ODEVICE_H_
32 32
33/* OPIE */
33#include <opie2/odevicebutton.h> 34#include <opie2/odevicebutton.h>
35#include <qpe/qpeapplication.h> /* for Transformation enum.. */
34 36
35/* QT */ 37/* QT */
36#include <qnamespace.h> 38#include <qnamespace.h>
@@ -38,8 +40,6 @@
38#include <qstring.h> 40#include <qstring.h>
39#include <qstrlist.h> 41#include <qstrlist.h>
40 42
41#include <qpe/qpeapplication.h> /* for Transformation enum.. */
42
43namespace Opie 43namespace Opie
44{ 44{
45 class ODeviceData; 45 class ODeviceData;
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index d928806..d68bce1 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -27,7 +27,7 @@
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice.h" 30#include "odevice_ipaq.h"
31 31
32/* QT */ 32/* QT */
33#include <qapplication.h> 33#include <qapplication.h>
@@ -53,12 +53,7 @@
53#include <linux/soundcard.h> 53#include <linux/soundcard.h>
54#endif 54#endif
55 55
56#ifndef ARRAY_SIZE 56/* KERNEL */
57#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
58#endif
59
60// _IO and friends are only defined in kernel headers ...
61
62#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 57#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
63 58
64#define OD_IO(type,number) OD_IOC(0,type,number,0) 59#define OD_IO(type,number) OD_IOC(0,type,number,0)
@@ -82,51 +77,7 @@ typedef struct {
82#define LED_ON OD_IOW( 'f', 5, LED_IN ) 77#define LED_ON OD_IOW( 'f', 5, LED_IN )
83#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) 78#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
84 79
85using namespace Opie; 80struct i_button ipaq_buttons [] = {
86
87class iPAQ : public ODevice, public QWSServer::KeyboardFilter
88{
89
90 protected:
91 virtual void init();
92 virtual void initButtons();
93
94 public:
95 virtual bool setSoftSuspend( bool soft );
96
97 virtual bool setDisplayBrightness( int b );
98 virtual int displayBrightnessResolution() const;
99
100 virtual void alarmSound();
101
102 virtual QValueList <OLed> ledList() const;
103 virtual QValueList <OLedState> ledStateList( OLed led ) const;
104 virtual OLedState ledState( OLed led ) const;
105 virtual bool setLedState( OLed led, OLedState st );
106
107 virtual bool hasLightSensor() const;
108 virtual int readLightSensor();
109 virtual int lightSensorResolution() const;
110
111 protected:
112 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
113 virtual void timerEvent( QTimerEvent *te );
114
115 int m_power_timer;
116
117 OLedState m_leds [2];
118};
119
120struct i_button {
121 uint model;
122 Qt::Key code;
123 char *utext;
124 char *pix;
125 char *fpressedservice;
126 char *fpressedaction;
127 char *fheldservice;
128 char *fheldaction;
129} ipaq_buttons [] = {
130 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 81 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
131 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 82 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
132 "devicebuttons/ipaq_calendar", 83 "devicebuttons/ipaq_calendar",
diff --git a/libopie2/opiecore/device/odevice_ipaq.h b/libopie2/opiecore/device/odevice_ipaq.h
new file mode 100644
index 0000000..baf7215
--- a/dev/null
+++ b/libopie2/opiecore/device/odevice_ipaq.h
@@ -0,0 +1,84 @@
1/*
2                 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =.
5 .=l.
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
30#ifndef ODEVICE_IPAQ
31#define ODEVICE_IPAQ
32
33#include "odevice.h"
34
35/* QT */
36#include <qwindowsystem_qws.h>
37
38using namespace Opie;
39
40class iPAQ : public ODevice, public QWSServer::KeyboardFilter
41{
42
43 protected:
44 virtual void init();
45 virtual void initButtons();
46
47 public:
48 virtual bool setSoftSuspend( bool soft );
49
50 virtual bool setDisplayBrightness( int b );
51 virtual int displayBrightnessResolution() const;
52
53 virtual void alarmSound();
54
55 virtual QValueList <OLed> ledList() const;
56 virtual QValueList <OLedState> ledStateList( OLed led ) const;
57 virtual OLedState ledState( OLed led ) const;
58 virtual bool setLedState( OLed led, OLedState st );
59
60 virtual bool hasLightSensor() const;
61 virtual int readLightSensor();
62 virtual int lightSensorResolution() const;
63
64 protected:
65 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
66 virtual void timerEvent( QTimerEvent *te );
67
68 int m_power_timer;
69
70 OLedState m_leds [2];
71};
72
73struct i_button {
74 uint model;
75 Qt::Key code;
76 char *utext;
77 char *pix;
78 char *fpressedservice;
79 char *fpressedaction;
80 char *fheldservice;
81 char *fheldaction;
82};
83
84#endif
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp
index bcd03ed..37bd6e9 100644
--- a/libopie2/opiecore/device/odevice_jornada.cpp
+++ b/libopie2/opiecore/device/odevice_jornada.cpp
@@ -27,7 +27,7 @@
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice.h" 30#include "odevice_jornada.h"
31 31
32/* QT */ 32/* QT */
33#include <qapplication.h> 33#include <qapplication.h>
@@ -53,12 +53,7 @@
53#include <linux/soundcard.h> 53#include <linux/soundcard.h>
54#endif 54#endif
55 55
56#ifndef ARRAY_SIZE 56/* KERNEL */
57#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
58#endif
59
60// _IO and friends are only defined in kernel headers ...
61
62#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 57#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
63 58
64#define OD_IO(type,number) OD_IOC(0,type,number,0) 59#define OD_IO(type,number) OD_IOC(0,type,number,0)
@@ -84,39 +79,6 @@ typedef struct {
84 79
85using namespace Opie; 80using namespace Opie;
86 81
87class Jornada : public ODevice
88{
89
90 protected:
91 virtual void init();
92
93 public:
94 virtual bool setSoftSuspend ( bool soft );
95 virtual bool setDisplayBrightness ( int b );
96 virtual int displayBrightnessResolution() const;
97 static bool isJornada();
98};
99
100
101bool Jornada::isJornada()
102{
103 QFile f( "/proc/cpuinfo" );
104 if ( f. open ( IO_ReadOnly ) ) {
105 QTextStream ts ( &f );
106 QString line;
107 while( line = ts. readLine() ) {
108 if ( line. left ( 8 ) == "Hardware" ) {
109 int loc = line. find ( ":" );
110 if ( loc != -1 ) {
111 QString model = line.mid( loc + 2 ).simplifyWhiteSpace( );
112 return ( model == "HP Jornada 56x" );
113 }
114 }
115 }
116 }
117 return false;
118}
119
120void Jornada::init() 82void Jornada::init()
121{ 83{
122 d->m_vendorstr = "HP"; 84 d->m_vendorstr = "HP";
@@ -138,41 +100,13 @@ void Jornada::init()
138 } 100 }
139} 101}
140 102
141#if 0
142void Jornada::initButtons()
143{
144 if ( d->m_buttons )
145 return;
146
147 // Simulation uses iPAQ 3660 device buttons
148
149 qDebug ( "init Buttons" );
150 d->m_buttons = new QValueList <ODeviceButton>;
151
152 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
153 i_button *ib = ipaq_buttons + i;
154 ODeviceButton b;
155
156 if (( ib->model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) {
157 b. setKeycode ( ib->code );
158 b. setUserText ( QObject::tr ( "Button", ib->utext ));
159 b. setPixmap ( Resource::loadPixmap ( ib->pix ));
160 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction ));
161 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction ));
162 d->m_buttons->append ( b );
163 }
164 }
165 reloadButtonMapping();
166
167 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
168 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
169}
170#endif
171 103
172int Jornada::displayBrightnessResolution() const 104int Jornada::displayBrightnessResolution() const
173{ 105{
106 return 0;
174} 107}
175 108
109
176bool Jornada::setDisplayBrightness( int bright ) 110bool Jornada::setDisplayBrightness( int bright )
177{ 111{
178 bool res = false; 112 bool res = false;
@@ -194,6 +128,7 @@ bool Jornada::setDisplayBrightness( int bright )
194 return res; 128 return res;
195} 129}
196 130
131
197bool Jornada::setSoftSuspend( bool soft ) 132bool Jornada::setSoftSuspend( bool soft )
198{ 133{
199 bool res = false; 134 bool res = false;
@@ -212,3 +147,4 @@ bool Jornada::setSoftSuspend( bool soft )
212 147
213 return res; 148 return res;
214} 149}
150
diff --git a/libopie2/opiecore/device/odevice_jornada.h b/libopie2/opiecore/device/odevice_jornada.h
new file mode 100644
index 0000000..59be8da
--- a/dev/null
+++ b/libopie2/opiecore/device/odevice_jornada.h
@@ -0,0 +1,50 @@
1/*
2                 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =.
5 .=l.
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
30#ifndef ODEVICE_JORNADA
31#define ODEVICE_JORNADA
32
33#include <opie2/odevice.h>
34
35using namespace Opie;
36
37class Jornada : public ODevice
38{
39
40 protected:
41 virtual void init();
42
43 public:
44 virtual bool setSoftSuspend ( bool soft );
45 virtual bool setDisplayBrightness ( int b );
46 virtual int displayBrightnessResolution() const;
47};
48
49#endif
50
diff --git a/libopie2/opiecore/device/odevice_ramses.cpp b/libopie2/opiecore/device/odevice_ramses.cpp
index a90c3a0..5bcf6a9 100644
--- a/libopie2/opiecore/device/odevice_ramses.cpp
+++ b/libopie2/opiecore/device/odevice_ramses.cpp
@@ -27,7 +27,7 @@
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice.h" 30#include "odevice_ramses.h"
31 31
32/* QT */ 32/* QT */
33#include <qapplication.h> 33#include <qapplication.h>
@@ -53,53 +53,7 @@
53#include <linux/soundcard.h> 53#include <linux/soundcard.h>
54#endif 54#endif
55 55
56#ifndef ARRAY_SIZE 56struct r_button ramses_buttons [] = {
57#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
58#endif
59
60// _IO and friends are only defined in kernel headers ...
61
62#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
63
64#define OD_IO(type,number) OD_IOC(0,type,number,0)
65#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
66#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
67#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
68
69using namespace Opie;
70
71class Ramses : public ODevice, public QWSServer::KeyboardFilter
72{
73 protected:
74 virtual void init();
75
76 public:
77 virtual bool setSoftSuspend( bool soft );
78 virtual bool suspend();
79
80 virtual bool setDisplayStatus( bool on );
81 virtual bool setDisplayBrightness( int b );
82 virtual int displayBrightnessResolution() const;
83 virtual bool setDisplayContrast( int b );
84 virtual int displayContrastResolution() const;
85
86 protected:
87 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
88 virtual void timerEvent ( QTimerEvent *te );
89
90 int m_power_timer;
91};
92
93struct r_button {
94 uint model;
95 Qt::Key code;
96 char *utext;
97 char *pix;
98 char *fpressedservice;
99 char *fpressedaction;
100 char *fheldservice;
101 char *fheldaction;
102} ramses_buttons [] = {
103 { Model_Ramses_MNCI, 57 { Model_Ramses_MNCI,
104 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 58 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
105 "devicebuttons/z_menu", 59 "devicebuttons/z_menu",
diff --git a/libopie2/opiecore/device/odevice_ramses.h b/libopie2/opiecore/device/odevice_ramses.h
new file mode 100644
index 0000000..1b660ab
--- a/dev/null
+++ b/libopie2/opiecore/device/odevice_ramses.h
@@ -0,0 +1,72 @@
1/*
2                 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =.
5 .=l.
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
30#ifndef ODEVICE_RAMSES
31#define ODEVICE_RAMSES
32
33#include <opie2/odevice.h>
34/* QT */
35#include <qwindowsystem_qws.h>
36
37using namespace Opie;
38
39class Ramses : public ODevice, public QWSServer::KeyboardFilter
40{
41 protected:
42 virtual void init();
43
44 public:
45 virtual bool setSoftSuspend( bool soft );
46 virtual bool suspend();
47
48 virtual bool setDisplayStatus( bool on );
49 virtual bool setDisplayBrightness( int b );
50 virtual int displayBrightnessResolution() const;
51 virtual bool setDisplayContrast( int b );
52 virtual int displayContrastResolution() const;
53
54 protected:
55 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
56 virtual void timerEvent ( QTimerEvent *te );
57
58 int m_power_timer;
59};
60
61struct r_button {
62 uint model;
63 Qt::Key code;
64 char *utext;
65 char *pix;
66 char *fpressedservice;
67 char *fpressedaction;
68 char *fheldservice;
69 char *fheldaction;
70};
71
72#endif
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp
index 82dce10..a2cd419 100644
--- a/libopie2/opiecore/device/odevice_simpad.cpp
+++ b/libopie2/opiecore/device/odevice_simpad.cpp
@@ -27,7 +27,7 @@
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice.h" 30#include "odevice_simpad.h"
31 31
32/* QT */ 32/* QT */
33#include <qapplication.h> 33#include <qapplication.h>
@@ -53,61 +53,9 @@
53#include <linux/soundcard.h> 53#include <linux/soundcard.h>
54#endif 54#endif
55 55
56#ifndef ARRAY_SIZE
57#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
58#endif
59
60// _IO and friends are only defined in kernel headers ...
61
62#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
63
64#define OD_IO(type,number) OD_IOC(0,type,number,0)
65#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
66#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
67#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
68
69using namespace Opie; 56using namespace Opie;
70 57
71class SIMpad : public ODevice, public QWSServer::KeyboardFilter 58struct s_button simpad_buttons [] = {
72{
73 protected:
74 virtual void init();
75 virtual void initButtons();
76
77 public:
78 virtual bool setSoftSuspend( bool soft );
79 virtual bool suspend();
80
81 virtual bool setDisplayStatus( bool on );
82 virtual bool setDisplayBrightness( int b );
83 virtual int displayBrightnessResolution() const;
84
85 virtual void alarmSound();
86
87 virtual QValueList <OLed> ledList() const;
88 virtual QValueList <OLedState> ledStateList( OLed led ) const;
89 virtual OLedState ledState( OLed led ) const;
90 virtual bool setLedState( OLed led, OLedState st );
91
92 protected:
93 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
94 virtual void timerEvent( QTimerEvent *te );
95
96 int m_power_timer;
97
98 OLedState m_leds [1];
99};
100
101struct s_button {
102 uint model;
103 Qt::Key code;
104 char *utext;
105 char *pix;
106 char *fpressedservice;
107 char *fpressedaction;
108 char *fheldservice;
109 char *fheldaction;
110} simpad_buttons [] = {
111 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 59 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
112 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), 60 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"),
113 "devicebuttons/simpad_lower_up", 61 "devicebuttons/simpad_lower_up",
diff --git a/libopie2/opiecore/device/odevice_simpad.h b/libopie2/opiecore/device/odevice_simpad.h
new file mode 100644
index 0000000..615effc
--- a/dev/null
+++ b/libopie2/opiecore/device/odevice_simpad.h
@@ -0,0 +1,81 @@
1/*
2                 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =.
5 .=l.
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
30#ifndef ODEVICE_SIMPAD
31#define ODEVICE_SIMPAD
32
33#include <opie2/odevice.h>
34
35/* QT */
36#include <qwindowsystem_qws.h>
37
38using namespace Opie;
39
40class SIMpad : public ODevice, public QWSServer::KeyboardFilter
41{
42 protected:
43 virtual void init();
44 virtual void initButtons();
45
46 public:
47 virtual bool setSoftSuspend( bool soft );
48 virtual bool suspend();
49
50 virtual bool setDisplayStatus( bool on );
51 virtual bool setDisplayBrightness( int b );
52 virtual int displayBrightnessResolution() const;
53
54 virtual void alarmSound();
55
56 virtual QValueList <OLed> ledList() const;
57 virtual QValueList <OLedState> ledStateList( OLed led ) const;
58 virtual OLedState ledState( OLed led ) const;
59 virtual bool setLedState( OLed led, OLedState st );
60
61 protected:
62 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
63 virtual void timerEvent( QTimerEvent *te );
64
65 int m_power_timer;
66
67 OLedState m_leds [1];
68};
69
70struct s_button {
71 uint model;
72 Qt::Key code;
73 char *utext;
74 char *pix;
75 char *fpressedservice;
76 char *fpressedaction;
77 char *fheldservice;
78 char *fheldaction;
79};
80
81#endif
diff --git a/libopie2/opiecore/device/odevice_yopy.cpp b/libopie2/opiecore/device/odevice_yopy.cpp
index 9d0cdeb..a76f90b 100644
--- a/libopie2/opiecore/device/odevice_yopy.cpp
+++ b/libopie2/opiecore/device/odevice_yopy.cpp
@@ -1,33 +1,33 @@
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 =. 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.h" 30#include "odevice_yopy.h"
31 31
32/* QT */ 32/* QT */
33#include <qapplication.h> 33#include <qapplication.h>
@@ -53,46 +53,9 @@
53#include <linux/soundcard.h> 53#include <linux/soundcard.h>
54#endif 54#endif
55 55
56#ifndef ARRAY_SIZE
57#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
58#endif
59
60// _IO and friends are only defined in kernel headers ...
61
62#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
63
64#define OD_IO(type,number) OD_IOC(0,type,number,0)
65#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
66#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
67#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
68
69using namespace Opie; 56using namespace Opie;
70 57
71class Yopy : public ODevice 58struct yopy_button yopy_buttons [] = {
72{
73 protected:
74
75 virtual void init();
76 virtual void initButtons();
77
78 public:
79 virtual bool suspend();
80
81 virtual bool setDisplayBrightness ( int b );
82 virtual int displayBrightnessResolution() const;
83
84 static bool isYopy();
85};
86
87struct yopy_button {
88 Qt::Key code;
89 char *utext;
90 char *pix;
91 char *fpressedservice;
92 char *fpressedaction;
93 char *fheldservice;
94 char *fheldaction;
95} yopy_buttons [] = {
96{ Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Action Button"), 59{ Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Action Button"),
97 "devicebuttons/yopy_action", 60 "devicebuttons/yopy_action",
98 "datebook", "nextView()", 61 "datebook", "nextView()",
@@ -107,26 +70,6 @@ struct yopy_button {
107 "buttonsettings", "raise()" }, 70 "buttonsettings", "raise()" },
108}; 71};
109 72
110bool Yopy::isYopy()
111{
112QFile f( "/proc/cpuinfo" );
113if ( f. open ( IO_ReadOnly ) ) {
114 QTextStream ts ( &f );
115 QString line;
116 while( line = ts. readLine() ) {
117 if ( line. left ( 8 ) == "Hardware" ) {
118 int loc = line. find ( ":" );
119 if ( loc != -1 ) {
120 QString model =
121 line. mid ( loc + 2 ). simplifyWhiteSpace( );
122 return ( model == "Yopy" );
123 }
124 }
125 }
126}
127return false;
128}
129
130void Yopy::init() 73void Yopy::init()
131{ 74{
132d->m_vendorstr = "G.Mate"; 75d->m_vendorstr = "G.Mate";
@@ -139,7 +82,8 @@ d->m_systemstr = "Linupy";
139d->m_system = System_Linupy; 82d->m_system = System_Linupy;
140 83
141QFile f ( "/etc/issue" ); 84QFile f ( "/etc/issue" );
142if ( f. open ( IO_ReadOnly )) { 85 if ( f. open ( IO_ReadOnly ) )
86 {
143 QTextStream ts ( &f ); 87 QTextStream ts ( &f );
144 ts.readLine(); 88 ts.readLine();
145 d->m_sysverstr = ts. readLine(); 89 d->m_sysverstr = ts. readLine();
@@ -147,6 +91,7 @@ if ( f. open ( IO_ReadOnly )) {
147} 91}
148} 92}
149 93
94
150void Yopy::initButtons() 95void Yopy::initButtons()
151{ 96{
152if ( d->m_buttons ) 97if ( d->m_buttons )
@@ -154,7 +99,8 @@ if ( d->m_buttons )
154 99
155d->m_buttons = new QValueList <ODeviceButton>; 100d->m_buttons = new QValueList <ODeviceButton>;
156 101
157for (uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof(yopy_button)); i++) { 102 for ( uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof( yopy_button ) ); i++ )
103 {
158 104
159 yopy_button *ib = yopy_buttons + i; 105 yopy_button *ib = yopy_buttons + i;
160 106
@@ -177,6 +123,7 @@ connect(sysch, SIGNAL(received(const QCString &, const QByteArray & )),
177 this, SLOT(systemMessage(const QCString &, const QByteArray & ))); 123 this, SLOT(systemMessage(const QCString &, const QByteArray & )));
178} 124}
179 125
126
180bool Yopy::suspend() 127bool Yopy::suspend()
181{ 128{
182/* Opie for Yopy does not implement its own power management at the 129/* Opie for Yopy does not implement its own power management at the
@@ -185,14 +132,17 @@ bool Yopy::suspend()
185return false; 132return false;
186} 133}
187 134
135
188bool Yopy::setDisplayBrightness(int bright) 136bool Yopy::setDisplayBrightness(int bright)
189{ 137{
190/* The code here works, but is disabled as the current version runs 138/* The code here works, but is disabled as the current version runs
191 parallel to X, and relies on the existing backlight demon. */ 139 parallel to X, and relies on the existing backlight demon. */
192#if 0 140#if 0
193if ( QFile::exists("/proc/sys/pm/light") ) { 141 if ( QFile::exists( "/proc/sys/pm/light" ) )
142 {
194 int fd = ::open("/proc/sys/pm/light", O_WRONLY); 143 int fd = ::open("/proc/sys/pm/light", O_WRONLY);
195 if (fd >= 0 ) { 144 if ( fd >= 0 )
145 {
196 if (bright) 146 if (bright)
197 ::write(fd, "1\n", 2); 147 ::write(fd, "1\n", 2);
198 else 148 else
@@ -205,6 +155,7 @@ if ( QFile::exists("/proc/sys/pm/light") ) {
205return false; 155return false;
206} 156}
207 157
158
208int Yopy::displayBrightnessResolution() const 159int Yopy::displayBrightnessResolution() const
209{ 160{
210 return 2; 161 return 2;
diff --git a/libopie2/opiecore/device/odevice_yopy.h b/libopie2/opiecore/device/odevice_yopy.h
new file mode 100644
index 0000000..be8f62c
--- a/dev/null
+++ b/libopie2/opiecore/device/odevice_yopy.h
@@ -0,0 +1,62 @@
1/*
2                This file is part of the Opie Project
3             Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =.
5 .=l.
6          .>+-=
7_;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software
11- .   .-<_>     .<> Foundation; either version 2 of the License,
12    ._= =}       : or (at your option) any later version.
13   .%`+i>       _;_.
14   .i_,=:_.      -<s. This program is distributed in the hope that
15    +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16   : ..    .:,     . . . without even the implied warranty of
17   =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21:     =  ...= . :.=-
22-.   .:....=;==+<; You should have received a copy of the GNU
23 -_. . .   )=.  = Library General Public License along with
24   --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
30#ifndef ODEVICE_YOPY
31#define ODEVICE_YOPY
32
33#include <opie2/odevice.h>
34
35using namespace Opie;
36
37class Yopy : public ODevice
38{
39 protected:
40
41 virtual void init();
42 virtual void initButtons();
43
44 public:
45 virtual bool suspend();
46
47 virtual bool setDisplayBrightness ( int b );
48 virtual int displayBrightnessResolution() const;
49};
50
51struct yopy_button
52{
53 Qt::Key code;
54 char *utext;
55 char *pix;
56 char *fpressedservice;
57 char *fpressedaction;
58 char *fheldservice;
59 char *fheldaction;
60};
61
62#endif
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index a6e8b82..78bc62e 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -27,7 +27,7 @@
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice.h" 30#include "odevice_zaurus.h"
31 31
32/* QT */ 32/* QT */
33#include <qapplication.h> 33#include <qapplication.h>
@@ -53,68 +53,9 @@
53#include <linux/soundcard.h> 53#include <linux/soundcard.h>
54#endif 54#endif
55 55
56#ifndef ARRAY_SIZE
57#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
58#endif
59
60// _IO and friends are only defined in kernel headers ...
61
62#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
63
64#define OD_IO(type,number) OD_IOC(0,type,number,0)
65#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
66#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
67#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
68
69using namespace Opie; 56using namespace Opie;
70 57
71class Zaurus : public ODevice 58struct z_button z_buttons [] = {
72{
73
74 protected:
75 virtual void init();
76 virtual void initButtons();
77
78 public:
79 virtual bool setSoftSuspend ( bool soft );
80
81 virtual bool setDisplayBrightness ( int b );
82 virtual int displayBrightnessResolution() const;
83
84 virtual void alarmSound();
85 virtual void keySound();
86 virtual void touchSound();
87
88 virtual QValueList <OLed> ledList() const;
89 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
90 virtual OLedState ledState( OLed led ) const;
91 virtual bool setLedState( OLed led, OLedState st );
92
93 virtual bool hasHingeSensor() const;
94 virtual OHingeStatus readHingeSensor();
95
96 static bool isZaurus();
97
98 virtual bool suspend();
99 virtual Transformation rotation() const;
100 virtual ODirection direction() const;
101
102 protected:
103 virtual void buzzer ( int snd );
104
105 OLedState m_leds [1];
106 bool m_embedix;
107};
108
109struct z_button {
110 Qt::Key code;
111 char *utext;
112 char *pix;
113 char *fpressedservice;
114 char *fpressedaction;
115 char *fheldservice;
116 char *fheldaction;
117} z_buttons [] = {
118 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 59 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
119 "devicebuttons/z_calendar", 60 "devicebuttons/z_calendar",
120 "datebook", "nextView()", 61 "datebook", "nextView()",
@@ -160,7 +101,6 @@ struct z_button z_buttons_c700 [] = {
160 "QPE/Dummy", "doNothing()" }, 101 "QPE/Dummy", "doNothing()" },
161}; 102};
162 103
163// Check whether this device is the sharp zaurus..
164// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus 104// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
165// class up into individual classes. We need three classes 105// class up into individual classes. We need three classes
166// 106//
@@ -174,45 +114,6 @@ struct z_button z_buttons_c700 [] = {
174// 114//
175// Comments? - mickeyl. 115// Comments? - mickeyl.
176 116
177bool Zaurus::isZaurus()
178{
179
180 // If the special devices by embedix exist, it is quite simple: it is a Zaurus !
181 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ) ){
182 return true;
183 }
184
185 // On non-embedix kernels, we have to look closer.
186 bool is_zaurus = false;
187 QFile f ( "/proc/cpuinfo" );
188 if ( f. open ( IO_ReadOnly ) ) {
189 QString model;
190 QFile f ( "/proc/cpuinfo" );
191
192 QTextStream ts ( &f );
193 QString line;
194 while( line = ts. readLine() ) {
195 if ( line. left ( 8 ) == "Hardware" )
196 break;
197 }
198 int loc = line. find ( ":" );
199 if ( loc != -1 )
200 model = line. mid ( loc + 2 ). simplifyWhiteSpace( );
201
202 if ( model == "Sharp-Collie"
203 || model == "Collie"
204 || model == "SHARP Corgi"
205 || model == "SHARP Shepherd"
206 || model == "SHARP Poodle"
207 || model == "SHARP Husky"
208 )
209 is_zaurus = true;
210
211 }
212 return is_zaurus;
213}
214
215
216void Zaurus::init() 117void Zaurus::init()
217{ 118{
218 d->m_vendorstr = "Sharp"; 119 d->m_vendorstr = "Sharp";
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h
new file mode 100644
index 0000000..c07fe07
--- a/dev/null
+++ b/libopie2/opiecore/device/odevice_zaurus.h
@@ -0,0 +1,96 @@
1/*
2                 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =.
5 .=l.
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29
30#ifndef ODEVICE_ZAURUS
31#define ODEVICE_ZAURUS
32
33#include <opie2/odevice.h>
34
35#ifndef ARRAY_SIZE
36#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
37#endif
38
39// _IO and friends are only defined in kernel headers ...
40
41#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
42
43#define OD_IO(type,number) OD_IOC(0,type,number,0)
44#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
45#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
46#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
47
48using namespace Opie;
49
50class Zaurus : public ODevice
51{
52
53 protected:
54 virtual void init();
55 virtual void initButtons();
56
57 public:
58 virtual bool setSoftSuspend ( bool soft );
59
60 virtual bool setDisplayBrightness ( int b );
61 virtual int displayBrightnessResolution() const;
62
63 virtual void alarmSound();
64 virtual void keySound();
65 virtual void touchSound();
66
67 virtual QValueList <OLed> ledList() const;
68 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
69 virtual OLedState ledState( OLed led ) const;
70 virtual bool setLedState( OLed led, OLedState st );
71
72 virtual bool hasHingeSensor() const;
73 virtual OHingeStatus readHingeSensor();
74
75 virtual bool suspend();
76 virtual Transformation rotation() const;
77 virtual ODirection direction() const;
78
79 protected:
80 virtual void buzzer ( int snd );
81
82 OLedState m_leds [1];
83 bool m_embedix;
84};
85
86struct z_button {
87 Qt::Key code;
88 char *utext;
89 char *pix;
90 char *fpressedservice;
91 char *fpressedaction;
92 char *fheldservice;
93 char *fheldaction;
94};
95
96#endif
diff --git a/libopie2/opiecore/opiecore.pro b/libopie2/opiecore/opiecore.pro
index 97e8146..98d315f 100644
--- a/libopie2/opiecore/opiecore.pro
+++ b/libopie2/opiecore/opiecore.pro
@@ -6,6 +6,12 @@ HEADERS = oapplication.h \
6 odebug.h \ 6 odebug.h \
7 odevice.h \ 7 odevice.h \
8 odevicebutton.h \ 8 odevicebutton.h \
9 odevice_ipaq.h \
10 odevice_jornada.h \
11 odevice_ramses.h \
12 odevice_simpad.h \
13 odevice_zaurus.h \
14 odevice_yopy.h \
9 oglobal.h \ 15 oglobal.h \
10 oglobalsettings.h \ 16 oglobalsettings.h \
11 oprocess.h \ 17 oprocess.h \