summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice_jornada.cpp
Unidiff
Diffstat (limited to 'libopie2/opiecore/device/odevice_jornada.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_jornada.cpp76
1 files changed, 6 insertions, 70 deletions
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