author | mickeyl <mickeyl> | 2004-01-13 18:32:19 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-13 18:32:19 (UTC) |
commit | 061ccf5b9d384b1f24d203e96f1f04ccf1dcf133 (patch) (unidiff) | |
tree | ec1fc064f001edba92e58116cdc35fc909b5cdd6 /libopie2/opiecore/device/odevice_jornada.cpp | |
parent | 59f7fa0a480bf921a67ad42fc1fe018b1be44192 (diff) | |
download | opie-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 (limited to 'libopie2/opiecore/device/odevice_jornada.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 82 |
1 files changed, 9 insertions, 73 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 | ||
85 | using namespace Opie; | 80 | using namespace Opie; |
86 | 81 | ||
87 | class 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 | |||
101 | bool 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 | |||
120 | void Jornada::init() | 82 | void Jornada::init() |
121 | { | 83 | { |
122 | d->m_vendorstr = "HP"; | 84 | d->m_vendorstr = "HP"; |
@@ -128,51 +90,23 @@ void Jornada::init() | |||
128 | d->m_rotation = Rot0; | 90 | d->m_rotation = Rot0; |
129 | 91 | ||
130 | QFile f ( "/etc/familiar-version" ); | 92 | QFile f ( "/etc/familiar-version" ); |
131 | f. setName ( "/etc/familiar-version" ); | 93 | f.setName ( "/etc/familiar-version" ); |
132 | if ( f. open ( IO_ReadOnly )) { | 94 | if ( f.open ( IO_ReadOnly )) { |
133 | 95 | ||
134 | QTextStream ts ( &f ); | 96 | QTextStream ts ( &f ); |
135 | d->m_sysverstr = ts. readLine(). mid ( 10 ); | 97 | d->m_sysverstr = ts.readLine().mid( 10 ); |
136 | 98 | ||
137 | f. close(); | 99 | f. close(); |
138 | } | 100 | } |
139 | } | 101 | } |
140 | 102 | ||
141 | #if 0 | ||
142 | void 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 | ||
172 | int Jornada::displayBrightnessResolution() const | 104 | int Jornada::displayBrightnessResolution() const |
173 | { | 105 | { |
106 | return 0; | ||
174 | } | 107 | } |
175 | 108 | ||
109 | |||
176 | bool Jornada::setDisplayBrightness( int bright ) | 110 | bool 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 | |||
197 | bool Jornada::setSoftSuspend( bool soft ) | 132 | bool 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 | |||