summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-01-10 14:58:14 (UTC)
committer mickeyl <mickeyl>2005-01-10 14:58:14 (UTC)
commit6e3873eab783661c1d476106f588f2dab961dd21 (patch) (unidiff)
tree14cac38bca6da58545ce4a882f17bc4ad4b98228
parent2e897183d1b9373cefaf19dfb272bf1e7bfe50c7 (diff)
downloadopie-6e3873eab783661c1d476106f588f2dab961dd21.zip
opie-6e3873eab783661c1d476106f588f2dab961dd21.tar.gz
opie-6e3873eab783661c1d476106f588f2dab961dd21.tar.bz2
make the SL-C3000 (Sharp Spitz) known to ODevice
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.h3
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp96
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.h5
3 files changed, 64 insertions, 40 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index 93d7d22..bbc32fa 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -1,379 +1,380 @@
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#ifndef ODEVICE_H_ 30#ifndef ODEVICE_H_
31#define ODEVICE_H_ 31#define ODEVICE_H_
32 32
33/* OPIE */ 33/* OPIE */
34#include <opie2/odevicebutton.h> 34#include <opie2/odevicebutton.h>
35#include <qpe/qpeapplication.h> /* for Transformation enum.. */ 35#include <qpe/qpeapplication.h> /* for Transformation enum.. */
36 36
37/* QT */ 37/* QT */
38#include <qnamespace.h> 38#include <qnamespace.h>
39#include <qobject.h> 39#include <qobject.h>
40#include <qstring.h> 40#include <qstring.h>
41 41
42 42
43#include <qstrlist.h> 43#include <qstrlist.h>
44#include <qwindowsystem_qws.h> 44#include <qwindowsystem_qws.h>
45 45
46 46
47class Sound; 47class Sound;
48 48
49namespace Opie{ 49namespace Opie{
50namespace Core{ 50namespace Core{
51 51
52class ODeviceData; 52class ODeviceData;
53/** 53/**
54 * The available devices 54 * The available devices
55 */ 55 */
56enum OModel { 56enum OModel {
57 Model_Unknown, // = 0 57 Model_Unknown, // = 0
58 58
59 Model_Series_Mask = 0xff000000, 59 Model_Series_Mask = 0xff000000,
60 60
61 Model_iPAQ = ( 1 << 24 ), 61 Model_iPAQ = ( 1 << 24 ),
62 62
63 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), 63 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ),
64 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), 64 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ),
65 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), 65 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ),
66 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), 66 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ),
67 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), 67 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ),
68 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), 68 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ),
69 Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ), 69 Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ),
70 Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ), 70 Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ),
71 71
72 Model_Jornada = ( 6 << 24 ), 72 Model_Jornada = ( 6 << 24 ),
73 Model_Jornada_56x = ( Model_Jornada | 0x000001 ), 73 Model_Jornada_56x = ( Model_Jornada | 0x000001 ),
74 74
75 Model_Zaurus = ( 2 << 24 ), 75 Model_Zaurus = ( 2 << 24 ),
76 76
77 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), 77 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ),
78 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), 78 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ),
79 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), 79 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ),
80 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), 80 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ),
81 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), 81 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ),
82 Model_Zaurus_SL6000 = ( Model_Zaurus | 0x000006 ), 82 Model_Zaurus_SL6000 = ( Model_Zaurus | 0x000006 ),
83 Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x000007 ),
83 84
84 Model_SIMpad = ( 3 << 24 ), 85 Model_SIMpad = ( 3 << 24 ),
85 86
86 Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), 87 Model_SIMpad_All = ( Model_SIMpad | 0xffffff ),
87 Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), 88 Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ),
88 Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), 89 Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ),
89 Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), 90 Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ),
90 Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), 91 Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ),
91 92
92 Model_Ramses = ( 4 << 24 ), 93 Model_Ramses = ( 4 << 24 ),
93 94
94 Model_Ramses_All = ( Model_Ramses | 0xffffff ), 95 Model_Ramses_All = ( Model_Ramses | 0xffffff ),
95 Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), 96 Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ),
96 Model_Ramses_MNCIRX = ( Model_Ramses | 0x000002 ), 97 Model_Ramses_MNCIRX = ( Model_Ramses | 0x000002 ),
97 98
98 Model_Yopy = ( 5 << 24 ), 99 Model_Yopy = ( 5 << 24 ),
99 100
100 Model_Yopy_All = ( Model_Yopy | 0xffffff ), 101 Model_Yopy_All = ( Model_Yopy | 0xffffff ),
101 Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), 102 Model_Yopy_3000 = ( Model_Yopy | 0x000001 ),
102 Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), 103 Model_Yopy_3500 = ( Model_Yopy | 0x000002 ),
103 Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), 104 Model_Yopy_3700 = ( Model_Yopy | 0x000003 ),
104 105
105 Model_Beagle = ( 6 << 24 ), 106 Model_Beagle = ( 6 << 24 ),
106 107
107 Model_Beagle_All = ( Model_Beagle | 0xffffff ), 108 Model_Beagle_All = ( Model_Beagle | 0xffffff ),
108 Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ), 109 Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ),
109 110
110 Model_GenuineIntel = ( 7 << 24 ) 111 Model_GenuineIntel = ( 7 << 24 )
111 112
112}; 113};
113 114
114/** 115/**
115 * The vendor of the device 116 * The vendor of the device
116 */ 117 */
117enum OVendor { 118enum OVendor {
118 Vendor_Unknown, 119 Vendor_Unknown,
119 120
120 Vendor_HP, 121 Vendor_HP,
121 Vendor_Sharp, 122 Vendor_Sharp,
122 Vendor_SIEMENS, 123 Vendor_SIEMENS,
123 Vendor_MundN, 124 Vendor_MundN,
124 Vendor_GMate, 125 Vendor_GMate,
125 Vendor_MasterIA, 126 Vendor_MasterIA,
126 Vendor_GenuineIntel 127 Vendor_GenuineIntel
127}; 128};
128 129
129/** 130/**
130 * The System used 131 * The System used
131 */ 132 */
132enum OSystem { 133enum OSystem {
133 System_Unknown, 134 System_Unknown,
134 135
135 System_Familiar, 136 System_Familiar,
136 System_Zaurus, 137 System_Zaurus,
137 System_OpenZaurus, 138 System_OpenZaurus,
138 System_Linupy, 139 System_Linupy,
139 System_OpenEmbedded, 140 System_OpenEmbedded,
140 System_PC 141 System_PC
141}; 142};
142 143
143typedef struct { 144typedef struct {
144 OSystem system; 145 OSystem system;
145 char* sysstr; 146 char* sysstr;
146 char* sysvfile; 147 char* sysvfile;
147} ODistribution; 148} ODistribution;
148 149
149extern ODistribution distributions[]; 150extern ODistribution distributions[];
150 151
151 152
152enum OLedState { 153enum OLedState {
153 Led_Off, 154 Led_Off,
154 Led_On, 155 Led_On,
155 Led_BlinkSlow, 156 Led_BlinkSlow,
156 Led_BlinkFast 157 Led_BlinkFast
157}; 158};
158 159
159enum OLed { 160enum OLed {
160 Led_Mail, 161 Led_Mail,
161 Led_Power, 162 Led_Power,
162 Led_BlueTooth 163 Led_BlueTooth
163}; 164};
164 165
165enum OHardKey { 166enum OHardKey {
166 HardKey_Datebook = Qt::Key_F9, 167 HardKey_Datebook = Qt::Key_F9,
167 HardKey_Contacts = Qt::Key_F10, 168 HardKey_Contacts = Qt::Key_F10,
168 HardKey_Menu = Qt::Key_F11, 169 HardKey_Menu = Qt::Key_F11,
169 HardKey_Home = Qt::Key_F12, 170 HardKey_Home = Qt::Key_F12,
170 HardKey_Mail = Qt::Key_F13, 171 HardKey_Mail = Qt::Key_F13,
171 HardKey_Record = Qt::Key_F24, 172 HardKey_Record = Qt::Key_F24,
172 HardKey_Suspend = Qt::Key_F34, 173 HardKey_Suspend = Qt::Key_F34,
173 HardKey_Backlight = Qt::Key_F35, 174 HardKey_Backlight = Qt::Key_F35,
174 HardKey_Action = Qt::Key_F10, 175 HardKey_Action = Qt::Key_F10,
175 HardKey_OK = Qt::Key_F11, 176 HardKey_OK = Qt::Key_F11,
176 HardKey_End = Qt::Key_F12, 177 HardKey_End = Qt::Key_F12,
177}; 178};
178 179
179enum ODirection { 180enum ODirection {
180 CW = 0, 181 CW = 0,
181 CCW = 1, 182 CCW = 1,
182 Flip = 2, 183 Flip = 2,
183}; 184};
184 185
185enum OHingeStatus { 186enum OHingeStatus {
186 CASE_CLOSED = 3, 187 CASE_CLOSED = 3,
187 CASE_PORTRAIT = 2, 188 CASE_PORTRAIT = 2,
188 CASE_LANDSCAPE = 0, 189 CASE_LANDSCAPE = 0,
189 CASE_UNKNOWN = 1, 190 CASE_UNKNOWN = 1,
190}; 191};
191 192
192/* default button for qvfb or such 193/* default button for qvfb or such
193 * see odevice.cpp for details. 194 * see odevice.cpp for details.
194 * hint: manage a user defined button for qvfb? 195 * hint: manage a user defined button for qvfb?
195 * alwin 196 * alwin
196 */ 197 */
197struct default_button { 198struct default_button {
198 Qt::Key code; 199 Qt::Key code;
199 char *utext; 200 char *utext;
200 char *pix; 201 char *pix;
201 char *fpressedservice; 202 char *fpressedservice;
202 char *fpressedaction; 203 char *fpressedaction;
203 char *fheldservice; 204 char *fheldservice;
204 char *fheldaction; 205 char *fheldaction;
205}; 206};
206 207
207/** 208/**
208 * A singleton which gives informations about device specefic option 209 * A singleton which gives informations about device specefic option
209 * like the Hardware used, LEDs, the Base Distribution and 210 * like the Hardware used, LEDs, the Base Distribution and
210 * hardware key mappings. 211 * hardware key mappings.
211 * 212 *
212 * @short A small class for device specefic options 213 * @short A small class for device specefic options
213 * @see QObject 214 * @see QObject
214 * @author Robert Griebl 215 * @author Robert Griebl
215 * @version 1.0 216 * @version 1.0
216 */ 217 */
217class ODevice : public QObject 218class ODevice : public QObject
218{ 219{
219 Q_OBJECT 220 Q_OBJECT
220 221
221private: 222private:
222 /* disable copy */ 223 /* disable copy */
223 ODevice ( const ODevice & ); 224 ODevice ( const ODevice & );
224 225
225protected: 226protected:
226 ODevice(); 227 ODevice();
227 virtual void init(const QString&); 228 virtual void init(const QString&);
228 virtual void initButtons(); 229 virtual void initButtons();
229 static void sendSuspendmsg(); 230 static void sendSuspendmsg();
230 231
231 ODeviceData *d; 232 ODeviceData *d;
232 233
233public: 234public:
234 // sandman do we want to allow destructions? -zecke? 235 // sandman do we want to allow destructions? -zecke?
235 virtual ~ODevice(); 236 virtual ~ODevice();
236 237
237 static ODevice *inst(); 238 static ODevice *inst();
238 239
239 // information 240 // information
240 241
241 QString modelString() const; 242 QString modelString() const;
242 OModel model() const; 243 OModel model() const;
243 inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } 244 inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); }
244 245
245 QString vendorString() const; 246 QString vendorString() const;
246 OVendor vendor() const; 247 OVendor vendor() const;
247 248
248 QString systemString() const; 249 QString systemString() const;
249 OSystem system() const; 250 OSystem system() const;
250 251
251 QString systemVersionString() const; 252 QString systemVersionString() const;
252 253
253 virtual Transformation rotation() const; 254 virtual Transformation rotation() const;
254 virtual ODirection direction() const; 255 virtual ODirection direction() const;
255 256
256 // system 257 // system
257 258
258 virtual bool setSoftSuspend ( bool on ); 259 virtual bool setSoftSuspend ( bool on );
259 virtual bool suspend(); 260 virtual bool suspend();
260 261
261 virtual bool setDisplayStatus ( bool on ); 262 virtual bool setDisplayStatus ( bool on );
262 virtual bool setDisplayBrightness ( int brightness ); 263 virtual bool setDisplayBrightness ( int brightness );
263 virtual int displayBrightnessResolution() const; 264 virtual int displayBrightnessResolution() const;
264 virtual bool setDisplayContrast ( int contrast ); 265 virtual bool setDisplayContrast ( int contrast );
265 virtual int displayContrastResolution() const; 266 virtual int displayContrastResolution() const;
266 267
267 // don't add new virtual methods, use this: 268 // don't add new virtual methods, use this:
268 // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; 269 // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); };
269 // and in your subclass do overwrite 270 // and in your subclass do overwrite
270 // protected virtual int virtual_hook(int, void *) 271 // protected virtual int virtual_hook(int, void *)
271 // which is defined below 272 // which is defined below
272 273
273 // input / output 274 // input / output
274 virtual void playAlarmSound(); 275 virtual void playAlarmSound();
275 virtual void playKeySound(); 276 virtual void playKeySound();
276 virtual void playTouchSound(); 277 virtual void playTouchSound();
277 278
278 virtual QValueList <OLed> ledList() const; 279 virtual QValueList <OLed> ledList() const;
279 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 280 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
280 virtual OLedState ledState ( OLed led ) const; 281 virtual OLedState ledState ( OLed led ) const;
281 virtual bool setLedState ( OLed led, OLedState st ); 282 virtual bool setLedState ( OLed led, OLedState st );
282 283
283 virtual bool hasLightSensor() const; 284 virtual bool hasLightSensor() const;
284 virtual int readLightSensor(); 285 virtual int readLightSensor();
285 virtual int lightSensorResolution() const; 286 virtual int lightSensorResolution() const;
286 287
287 virtual bool hasHingeSensor() const; 288 virtual bool hasHingeSensor() const;
288 virtual OHingeStatus readHingeSensor(); 289 virtual OHingeStatus readHingeSensor();
289 290
290 const QStrList &allowedCpuFrequencies() const; 291 const QStrList &allowedCpuFrequencies() const;
291 bool setCurrentCpuFrequency(uint index); 292 bool setCurrentCpuFrequency(uint index);
292 293
293 /** 294 /**
294 * Returns the available buttons on this device. The number and location 295 * Returns the available buttons on this device. The number and location
295 * of buttons will vary depending on the device. Button numbers will be assigned 296 * of buttons will vary depending on the device. Button numbers will be assigned
296 * by the device manufacturer and will be from most preferred button to least preffered 297 * by the device manufacturer and will be from most preferred button to least preffered
297 * button. Note that this list only contains "user mappable" buttons. 298 * button. Note that this list only contains "user mappable" buttons.
298 * 299 *
299 * @todo Make method const and take care of calling initButtons or make that const too 300 * @todo Make method const and take care of calling initButtons or make that const too
300 * 301 *
301 */ 302 */
302 const QValueList<ODeviceButton> &buttons(); 303 const QValueList<ODeviceButton> &buttons();
303 304
304 /** 305 /**
305 * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it 306 * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it
306 * returns 0L 307 * returns 0L
307 */ 308 */
308 const ODeviceButton *buttonForKeycode ( ushort keyCode ); 309 const ODeviceButton *buttonForKeycode ( ushort keyCode );
309 310
310 /** 311 /**
311 * Reassigns the pressed action for \a button. To return to the factory 312 * Reassigns the pressed action for \a button. To return to the factory
312 * default pass an empty string as \a qcopMessage. 313 * default pass an empty string as \a qcopMessage.
313 */ 314 */
314 void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); 315 void remapPressedAction ( int button, const OQCopMessage &qcopMessage );
315 316
316 /** 317 /**
317 * Reassigns the held action for \a button. To return to the factory 318 * Reassigns the held action for \a button. To return to the factory
318 * default pass an empty string as \a qcopMessage. 319 * default pass an empty string as \a qcopMessage.
319 */ 320 */
320 void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); 321 void remapHeldAction ( int button, const OQCopMessage &qcopMessage );
321 322
322 /** 323 /**
323 * How long (in ms) you have to press a button for a "hold" action 324 * How long (in ms) you have to press a button for a "hold" action
324 */ 325 */
325 uint buttonHoldTime() const; 326 uint buttonHoldTime() const;
326 327
327signals: 328signals:
328 void buttonMappingChanged(); 329 void buttonMappingChanged();
329 330
330private slots: 331private slots:
331 void systemMessage ( const QCString &, const QByteArray & ); 332 void systemMessage ( const QCString &, const QByteArray & );
332 void playingStopped(); 333 void playingStopped();
333 334
334protected: 335protected:
335 void addPreHandler(QWSServer::KeyboardFilter*aFilter); 336 void addPreHandler(QWSServer::KeyboardFilter*aFilter);
336 void remPreHandler(QWSServer::KeyboardFilter*aFilter); 337 void remPreHandler(QWSServer::KeyboardFilter*aFilter);
337 void reloadButtonMapping(); 338 void reloadButtonMapping();
338 void changeMixerForAlarm( int mixer, const char* file, Sound *snd); 339 void changeMixerForAlarm( int mixer, const char* file, Sound *snd);
339 340
340 /* ugly virtual hook */ 341 /* ugly virtual hook */
341 virtual void virtual_hook( int id, void* data ); 342 virtual void virtual_hook( int id, void* data );
342}; 343};
343 344
344class ODeviceData { 345class ODeviceData {
345 346
346 public: 347 public:
347 QString m_vendorstr; 348 QString m_vendorstr;
348 OVendor m_vendor; 349 OVendor m_vendor;
349 350
350 QString m_modelstr; 351 QString m_modelstr;
351 OModel m_model; 352 OModel m_model;
352 353
353 QString m_systemstr; 354 QString m_systemstr;
354 OSystem m_system; 355 OSystem m_system;
355 356
356 QString m_sysverstr; 357 QString m_sysverstr;
357 358
358 Transformation m_rotation; 359 Transformation m_rotation;
359 ODirection m_direction; 360 ODirection m_direction;
360 361
361 QValueList <ODeviceButton> *m_buttons; 362 QValueList <ODeviceButton> *m_buttons;
362 uint m_holdtime; 363 uint m_holdtime;
363 QStrList *m_cpu_frequencies; 364 QStrList *m_cpu_frequencies;
364 boolm_initializedButtonQcop : 1; 365 bool m_initializedButtonQcop : 1;
365 366
366 /* values for changeMixerForAlarm */ 367 /* values for changeMixerForAlarm */
367 int m_sound, m_vol, m_mixer; 368 int m_sound, m_vol, m_mixer;
368}; 369};
369 370
370extern bool isQWS(); 371extern bool isQWS();
371extern QCString makeChannel ( const char *str ); 372extern QCString makeChannel ( const char *str );
372} 373}
373} 374}
374 375
375 376
376 377
377 378
378#endif 379#endif
379 380
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index fb23e1d..75a2fdc 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -1,590 +1,612 @@
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 =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> 4 =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
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 <qpe/config.h> 39#include <qpe/config.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41#include <qpe/sound.h> 41#include <qpe/sound.h>
42#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
43 43
44/* STD */ 44/* STD */
45#include <fcntl.h> 45#include <fcntl.h>
46#include <math.h> 46#include <math.h>
47#include <stdlib.h> 47#include <stdlib.h>
48#include <signal.h> 48#include <signal.h>
49#include <sys/ioctl.h> 49#include <sys/ioctl.h>
50#include <sys/time.h> 50#include <sys/time.h>
51#include <unistd.h> 51#include <unistd.h>
52#ifndef QT_NO_SOUND 52#ifndef QT_NO_SOUND
53#include <linux/soundcard.h> 53#include <linux/soundcard.h>
54#endif 54#endif
55 55
56using namespace Opie::Core; 56using namespace Opie::Core;
57using namespace Opie::Core::Internal; 57using namespace Opie::Core::Internal;
58 58
59struct z_button z_buttons [] = { 59struct z_button z_buttons [] = {
60 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 60 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
61 "devicebuttons/z_calendar", 61 "devicebuttons/z_calendar",
62 "datebook", "nextView()", 62 "datebook", "nextView()",
63 "today", "raise()" }, 63 "today", "raise()" },
64 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 64 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
65 "devicebuttons/z_contact", 65 "devicebuttons/z_contact",
66 "addressbook", "raise()", 66 "addressbook", "raise()",
67 "addressbook", "beamBusinessCard()" }, 67 "addressbook", "beamBusinessCard()" },
68 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 68 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
69 "devicebuttons/z_home", 69 "devicebuttons/z_home",
70 "QPE/Launcher", "home()", 70 "QPE/Launcher", "home()",
71 "buttonsettings", "raise()" }, 71 "buttonsettings", "raise()" },
72 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 72 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
73 "devicebuttons/z_menu", 73 "devicebuttons/z_menu",
74 "QPE/TaskBar", "toggleMenu()", 74 "QPE/TaskBar", "toggleMenu()",
75 "QPE/TaskBar", "toggleStartMenu()" }, 75 "QPE/TaskBar", "toggleStartMenu()" },
76 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 76 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
77 "devicebuttons/z_mail", 77 "devicebuttons/z_mail",
78 "opiemail", "raise()", 78 "opiemail", "raise()",
79 "opiemail", "newMail()" }, 79 "opiemail", "newMail()" },
80}; 80};
81 81
82struct z_button z_buttons_c700 [] = { 82struct z_button z_buttons_c700 [] = {
83 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 83 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
84 "devicebuttons/z_calendar", 84 "devicebuttons/z_calendar",
85 "datebook", "nextView()", 85 "datebook", "nextView()",
86 "today", "raise()" }, 86 "today", "raise()" },
87 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 87 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
88 "devicebuttons/z_contact", 88 "devicebuttons/z_contact",
89 "addressbook", "raise()", 89 "addressbook", "raise()",
90 "addressbook", "beamBusinessCard()" }, 90 "addressbook", "beamBusinessCard()" },
91 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 91 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
92 "devicebuttons/z_home", 92 "devicebuttons/z_home",
93 "QPE/Launcher", "home()", 93 "QPE/Launcher", "home()",
94 "buttonsettings", "raise()" }, 94 "buttonsettings", "raise()" },
95 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 95 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
96 "devicebuttons/z_menu", 96 "devicebuttons/z_menu",
97 "QPE/TaskBar", "toggleMenu()", 97 "QPE/TaskBar", "toggleMenu()",
98 "QPE/TaskBar", "toggleStartMenu()" }, 98 "QPE/TaskBar", "toggleStartMenu()" },
99 { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"), 99 { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
100 "devicebuttons/z_hinge", 100 "devicebuttons/z_hinge",
101 "QPE/Rotation", "rotateDefault()", 101 "QPE/Rotation", "rotateDefault()",
102 "QPE/Dummy", "doNothing()" }, 102 "QPE/Dummy", "doNothing()" },
103}; 103};
104 104
105// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus 105// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
106// class up into individual classes. We need three classes 106// class up into individual classes. We need three classes
107// 107//
108// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) 108// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000)
109// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) 109// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600)
110// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000) 110// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000)
111// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) 111// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000)
112// 112//
113// Only question right now is: Do we really need to do it? Because as soon 113// Only question right now is: Do we really need to do it? Because as soon
114// as the OpenZaurus kernel is ready, there will be a unified interface for all 114// as the OpenZaurus kernel is ready, there will be a unified interface for all
115// Zaurus models (concerning apm, backlight, buttons, etc.) 115// Zaurus models (concerning apm, backlight, buttons, etc.)
116// 116//
117// Comments? - mickeyl. 117// Comments? - mickeyl.
118 118
119void Zaurus::init(const QString& cpu_info) 119void Zaurus::init(const QString& cpu_info)
120{ 120{
121 // generic distribution code already scanned /etc/issue at that point - 121 // generic distribution code already scanned /etc/issue at that point -
122 // embedix releases contain "Embedix <version> | Linux for Embedded Devices" 122 // embedix releases contain "Embedix <version> | Linux for Embedded Devices"
123 if ( d->m_sysverstr.contains( "embedix", false ) ) 123 if ( d->m_sysverstr.contains( "embedix", false ) )
124 { 124 {
125 d->m_vendorstr = "Sharp"; 125 d->m_vendorstr = "Sharp";
126 d->m_vendor = Vendor_Sharp; 126 d->m_vendor = Vendor_Sharp;
127 d->m_systemstr = "Zaurus"; 127 d->m_systemstr = "Zaurus";
128 d->m_system = System_Zaurus; 128 d->m_system = System_Zaurus;
129 m_embedix = true; 129 m_embedix = true;
130 } 130 }
131 else 131 else
132 { 132 {
133 d->m_vendorstr = "OpenZaurus Team"; 133 d->m_vendorstr = "OpenZaurus Team";
134 d->m_systemstr = "OpenZaurus"; 134 d->m_systemstr = "OpenZaurus";
135 d->m_system = System_OpenZaurus; 135 d->m_system = System_OpenZaurus;
136 // sysver already gathered 136 // sysver already gathered
137 137
138 // OpenZaurus sometimes uses the embedix kernel, check if this is one 138 // OpenZaurus sometimes uses the embedix kernel, check if this is one
139 FILE *uname = popen("uname -r", "r"); 139 FILE *uname = popen("uname -r", "r");
140 QFile f; 140 QFile f;
141 QString line; 141 QString line;
142 if ( f.open(IO_ReadOnly, uname) ) { 142 if ( f.open(IO_ReadOnly, uname) ) {
143 QTextStream ts ( &f ); 143 QTextStream ts ( &f );
144 line = ts. readLine(); 144 line = ts. readLine();
145 int loc = line. find ( "embedix" ); 145 int loc = line. find ( "embedix" );
146 if ( loc != -1 ) 146 if ( loc != -1 )
147 m_embedix = true; 147 m_embedix = true;
148 else 148 else
149 m_embedix = false; 149 m_embedix = false;
150 f.close(); 150 f.close();
151 } 151 }
152 pclose(uname); 152 pclose(uname);
153 } 153 }
154 154
155 // check the Zaurus model 155 // check the Zaurus model
156 QString model; 156 QString model;
157 int loc = cpu_info.find( ":" ); 157 int loc = cpu_info.find( ":" );
158 if ( loc != -1 ) 158 if ( loc != -1 )
159 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); 159 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace();
160 else 160 else
161 model = cpu_info; 161 model = cpu_info;
162 162
163 if ( model == "SHARP Corgi" ) { 163 if ( model == "SHARP Corgi" ) {
164 d->m_model = Model_Zaurus_SLC7x0; 164 d->m_model = Model_Zaurus_SLC7x0;
165 d->m_modelstr = "Zaurus SL-C700"; 165 d->m_modelstr = "Zaurus SL-C700";
166 } else if ( model == "SHARP Shepherd" ) { 166 } else if ( model == "SHARP Shepherd" ) {
167 d->m_model = Model_Zaurus_SLC7x0; 167 d->m_model = Model_Zaurus_SLC7x0;
168 d->m_modelstr = "Zaurus SL-C750"; 168 d->m_modelstr = "Zaurus SL-C750";
169 } else if ( model == "SHARP Husky" ) { 169 } else if ( model == "SHARP Husky" ) {
170 d->m_model = Model_Zaurus_SLC7x0; 170 d->m_model = Model_Zaurus_SLC7x0;
171 d->m_modelstr = "Zaurus SL-C760 or SL-C860"; 171 d->m_modelstr = "Zaurus SL-C760 or SL-C860";
172 } else if ( model == "SHARP Boxer" ) {
173 d->m_model = Model_Zaurus_SLC7x0;
174 d->m_modelstr = "Zaurus SL-C760 or SL-C860";
172 } else if ( model == "SHARP Poodle" ) { 175 } else if ( model == "SHARP Poodle" ) {
173 d->m_model = Model_Zaurus_SLB600; 176 d->m_model = Model_Zaurus_SLB600;
174 d->m_modelstr = "Zaurus SL-B500 or SL-5600"; 177 d->m_modelstr = "Zaurus SL-B500 or SL-5600";
175 } else if ( model == "Sharp-Collie" || model == "Collie" ) { 178 } else if ( model == "Sharp-Collie" || model == "Collie" ) {
176 d->m_model = Model_Zaurus_SL5500; 179 d->m_model = Model_Zaurus_SL5500;
177 d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; 180 d->m_modelstr = "Zaurus SL-5500 or SL-5000d";
178 } else if ( model == "SHARP Tosa" ) { 181 } else if ( model == "SHARP Tosa" ) {
179 d->m_model = Model_Zaurus_SL6000; 182 d->m_model = Model_Zaurus_SL6000;
180 d->m_modelstr = "Zaurus SL-6000"; 183 d->m_modelstr = "Zaurus SL-6000";
184 } else if ( model == "SHARP Spitz" ) {
185 d->m_model = Model_Zaurus_SLC3000;
186 d->m_modelstr = "Zaurus SL-C3000";
181 } else { 187 } else {
182 d->m_model = Model_Zaurus_SL5500; 188 d->m_model = Model_Zaurus_SL5500;
183 d->m_modelstr = "Unkown Zaurus"; 189 d->m_modelstr = "Unknown Zaurus";
184 } 190 }
185 191
186 // set initial rotation 192 // set initial rotation
187 switch( d->m_model ) { 193 switch( d->m_model ) {
188 case Model_Zaurus_SL6000: // fallthrough 194 case Model_Zaurus_SL6000: // fallthrough
189 case Model_Zaurus_SLA300: 195 case Model_Zaurus_SLA300:
190 d->m_rotation = Rot0; 196 d->m_rotation = Rot0;
191 break; 197 break;
198 case Model_Zaurus_SLC3000: // fallthrough
192 case Model_Zaurus_SLC7x0: 199 case Model_Zaurus_SLC7x0:
193 d->m_rotation = rotation(); 200 d->m_rotation = rotation();
194 d->m_direction = direction(); 201 d->m_direction = direction();
195 break; 202 break;
196 case Model_Zaurus_SLB600: // fallthrough 203 case Model_Zaurus_SLB600: // fallthrough
204 case Model_Zaurus_SL5000: // fallthrough
197 case Model_Zaurus_SL5500: // fallthrough 205 case Model_Zaurus_SL5500: // fallthrough
198 case Model_Zaurus_SL5000:
199 default: 206 default:
200 d->m_rotation = Rot270; 207 d->m_rotation = Rot270;
201 break; 208 break;
202 } 209 }
203 m_leds [0] = Led_Off; 210 m_leds[0] = Led_Off;
204} 211}
205 212
206void Zaurus::initButtons() 213void Zaurus::initButtons()
207{ 214{
208 if ( d->m_buttons ) 215 if ( d->m_buttons )
209 return; 216 return;
210 217
211 d->m_buttons = new QValueList <ODeviceButton>; 218 d->m_buttons = new QValueList <ODeviceButton>;
212 219
213 struct z_button * pz_buttons; 220 struct z_button * pz_buttons;
214 int buttoncount; 221 int buttoncount;
215 switch ( d->m_model ) { 222 switch ( d->m_model ) {
216 case Model_Zaurus_SLC7x0: 223 case Model_Zaurus_SLC7x0:
217 pz_buttons = z_buttons_c700; 224 pz_buttons = z_buttons_c700;
218 buttoncount = ARRAY_SIZE(z_buttons_c700); 225 buttoncount = ARRAY_SIZE(z_buttons_c700);
219 break; 226 break;
220 default: 227 default:
221 pz_buttons = z_buttons; 228 pz_buttons = z_buttons;
222 buttoncount = ARRAY_SIZE(z_buttons); 229 buttoncount = ARRAY_SIZE(z_buttons);
223 break; 230 break;
224 } 231 }
225 232
226 for ( int i = 0; i < buttoncount; i++ ) { 233 for ( int i = 0; i < buttoncount; i++ ) {
227 struct z_button *zb = pz_buttons + i; 234 struct z_button *zb = pz_buttons + i;
228 ODeviceButton b; 235 ODeviceButton b;
229 236
230 b. setKeycode ( zb->code ); 237 b. setKeycode ( zb->code );
231 b. setUserText ( QObject::tr ( "Button", zb->utext )); 238 b. setUserText ( QObject::tr ( "Button", zb->utext ));
232 b. setPixmap ( Resource::loadPixmap ( zb->pix )); 239 b. setPixmap ( Resource::loadPixmap ( zb->pix ));
233 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb->fpressedservice ), 240 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb->fpressedservice ),
234 zb->fpressedaction )); 241 zb->fpressedaction ));
235 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb->fheldservice ), 242 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb->fheldservice ),
236 zb->fheldaction )); 243 zb->fheldaction ));
237 244
238 d->m_buttons->append ( b ); 245 d->m_buttons->append ( b );
239 } 246 }
240 247
241 reloadButtonMapping(); 248 reloadButtonMapping();
242} 249}
243 250
244 251
245 252
246typedef struct sharp_led_status { 253typedef struct sharp_led_status {
247 int which; /* select which LED status is wanted. */ 254 int which; /* select which LED status is wanted. */
248 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 255 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
249} sharp_led_status; 256} sharp_led_status;
250 257
251void Zaurus::buzzer( int sound ) 258void Zaurus::buzzer( int sound )
252{ 259{
253#ifndef QT_NO_SOUND 260#ifndef QT_NO_SOUND
254 Sound *snd = 0; 261 Sound *snd = 0;
255 262
256 // Not all devices have real sound 263 // All devices except SL5500 have a DSP device
257 if ( d->m_model == Model_Zaurus_SLC7x0 264 if ( d->m_model != Model_Zaurus_SL5000
258 || d->m_model == Model_Zaurus_SLB600 265 && d->m_model != Model_Zaurus_SL5500 ) {
259 || d->m_model == Model_Zaurus_SL6000 ) {
260 266
261 switch ( sound ){ 267 switch ( sound ){
262 case SHARP_BUZ_TOUCHSOUND: { 268 case SHARP_BUZ_TOUCHSOUND: {
263 static Sound touch_sound("touchsound"); 269 static Sound touch_sound("touchsound");
264 snd = &touch_sound; 270 snd = &touch_sound;
265 } 271 }
266 break; 272 break;
267 case SHARP_BUZ_KEYSOUND: { 273 case SHARP_BUZ_KEYSOUND: {
268 static Sound key_sound( "keysound" ); 274 static Sound key_sound( "keysound" );
269 snd = &key_sound; 275 snd = &key_sound;
270 } 276 }
271 break; 277 break;
272 case SHARP_BUZ_SCHEDULE_ALARM: 278 case SHARP_BUZ_SCHEDULE_ALARM:
273 default: { 279 default: {
274 static Sound alarm_sound("alarm"); 280 static Sound alarm_sound("alarm");
275 snd = &alarm_sound; 281 snd = &alarm_sound;
276 } 282 }
277 break; 283 break;
278 } 284 }
279 } 285 }
280 286
281 // If a soundname is defined, we expect that this device has 287 // If a soundname is defined, we expect that this device has
282 // sound capabilities.. Otherwise we expect to have the buzzer 288 // sound capabilities.. Otherwise we expect to have the buzzer
283 // device.. 289 // device..
284 if ( snd && snd->isFinished() ){ 290 if ( snd && snd->isFinished() ){
285 changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); 291 changeMixerForAlarm( 0, "/dev/sound/mixer", snd );
286 snd->play(); 292 snd->play();
287 } else if( !snd ) { 293 } else if( !snd ) {
288 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); 294 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
289 295
290 if ( fd >= 0 ) { 296 if ( fd >= 0 ) {
291 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 297 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
292 ::close ( fd ); 298 ::close ( fd );
293 } 299 }
294 300
295 } 301 }
296#endif 302#endif
297} 303}
298 304
299 305
300void Zaurus::playAlarmSound() 306void Zaurus::playAlarmSound()
301{ 307{
302 buzzer( SHARP_BUZ_SCHEDULE_ALARM ); 308 buzzer( SHARP_BUZ_SCHEDULE_ALARM );
303} 309}
304 310
305void Zaurus::playTouchSound() 311void Zaurus::playTouchSound()
306{ 312{
307 buzzer( SHARP_BUZ_TOUCHSOUND ); 313 buzzer( SHARP_BUZ_TOUCHSOUND );
308} 314}
309 315
310void Zaurus::playKeySound() 316void Zaurus::playKeySound()
311{ 317{
312 buzzer( SHARP_BUZ_KEYSOUND ); 318 buzzer( SHARP_BUZ_KEYSOUND );
313} 319}
314 320
315 321
316QValueList <OLed> Zaurus::ledList() const 322QValueList <OLed> Zaurus::ledList() const
317{ 323{
318 QValueList <OLed> vl; 324 QValueList <OLed> vl;
319 vl << Led_Mail; 325 vl << Led_Mail;
320 return vl; 326 return vl;
321} 327}
322 328
323QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const 329QValueList <OLedState> Zaurus::ledStateList( OLed l ) const
324{ 330{
325 QValueList <OLedState> vl; 331 QValueList <OLedState> vl;
326 332
327 if ( l == Led_Mail ) 333 if ( l == Led_Mail )
328 vl << Led_Off << Led_On << Led_BlinkSlow; 334 vl << Led_Off << Led_On << Led_BlinkSlow;
329 return vl; 335 return vl;
330} 336}
331 337
332OLedState Zaurus::ledState ( OLed which ) const 338OLedState Zaurus::ledState( OLed which ) const
333{ 339{
334 if ( which == Led_Mail ) 340 if ( which == Led_Mail )
335 return m_leds [0]; 341 return m_leds [0];
336 else 342 else
337 return Led_Off; 343 return Led_Off;
338} 344}
339 345
340bool Zaurus::setLedState ( OLed which, OLedState st ) 346bool Zaurus::setLedState( OLed which, OLedState st )
341{ 347{
342 if (!m_embedix) // Currently not supported on non_embedix kernels 348 // Currently not supported on non_embedix kernels
349 if (!m_embedix)
350 {
351 qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" );
343 return false; 352 return false;
353 }
344 354
345 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 355 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
346 356
347 if ( which == Led_Mail ) { 357 if ( which == Led_Mail ) {
348 if ( fd >= 0 ) { 358 if ( fd >= 0 ) {
349 struct sharp_led_status leds; 359 struct sharp_led_status leds;
350 ::memset ( &leds, 0, sizeof( leds )); 360 ::memset ( &leds, 0, sizeof( leds ));
351 leds. which = SHARP_LED_MAIL_EXISTS; 361 leds. which = SHARP_LED_MAIL_EXISTS;
352 bool ok = true; 362 bool ok = true;
353 363
354 switch ( st ) { 364 switch ( st ) {
355 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; 365 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break;
356 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; 366 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break;
357 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; 367 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break;
358 default : ok = false; 368 default : ok = false;
359 } 369 }
360 370
361 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { 371 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) {
362 m_leds [0] = st; 372 m_leds [0] = st;
363 return true; 373 return true;
364 } 374 }
365 } 375 }
366 } 376 }
367 return false; 377 return false;
368} 378}
369 379
370bool Zaurus::setSoftSuspend ( bool soft ) 380bool Zaurus::setSoftSuspend ( bool soft )
371{ 381{
372 if (!m_embedix) { 382 if (!m_embedix) {
373 /* non-Embedix kernels dont have kernel autosuspend */ 383 /* non-Embedix kernels dont have kernel autosuspend */
374 return ODevice::setSoftSuspend( soft ); 384 return ODevice::setSoftSuspend( soft );
375 } 385 }
376 386
377 bool res = false; 387 bool res = false;
378 int fd; 388 int fd;
379 389
380 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || 390 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) ||
381 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { 391 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) {
382 392
383 int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources 393 int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources
384 394
385 if ( sources >= 0 ) { 395 if ( sources >= 0 ) {
386 if ( soft ) 396 if ( soft )
387 sources &= ~APM_EVT_POWER_BUTTON; 397 sources &= ~APM_EVT_POWER_BUTTON;
388 else 398 else
389 sources |= APM_EVT_POWER_BUTTON; 399 sources |= APM_EVT_POWER_BUTTON;
390 400
391 if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources 401 if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources
392 res = true; 402 res = true;
393 else 403 else
394 perror ( "APM_IOCGEVTSRC" ); 404 perror ( "APM_IOCGEVTSRC" );
395 } 405 }
396 else 406 else
397 perror ( "APM_IOCGEVTSRC" ); 407 perror ( "APM_IOCGEVTSRC" );
398 408
399 ::close ( fd ); 409 ::close ( fd );
400 } 410 }
401 else 411 else
402 perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); 412 perror ( "/dev/apm_bios or /dev/misc/apm_bios" );
403 413
404 return res; 414 return res;
405} 415}
406 416
407bool Zaurus::setDisplayBrightness( int bright ) 417bool Zaurus::setDisplayBrightness( int bright )
408{ 418{
409 //qDebug( "Zaurus::setDisplayBrightness( %d )", bright ); 419 //qDebug( "Zaurus::setDisplayBrightness( %d )", bright );
410 bool res = false; 420 bool res = false;
411 421
412 if ( bright > 255 ) bright = 255; 422 if ( bright > 255 ) bright = 255;
413 if ( bright < 0 ) bright = 0; 423 if ( bright < 0 ) bright = 0;
414 424
415 if ( m_embedix ) 425 if ( m_embedix )
416 { 426 {
417 int numberOfSteps = displayBrightnessResolution(); 427 int numberOfSteps = displayBrightnessResolution();
418 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); 428 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK );
419 if ( fd ) 429 if ( fd )
420 { 430 {
421 int val = ( bright * numberOfSteps ) / 255; 431 int val = ( bright * numberOfSteps ) / 255;
422 res = ( ::ioctl ( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); 432 res = ( ::ioctl ( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 );
423 ::close ( fd ); 433 ::close ( fd );
424 } 434 }
425 } 435 }
426 else 436 else
427 { 437 {
428 qDebug( "ODevice handling for non-embedix kernels not yet implemented" ); 438 qDebug( "Zaurus::setDisplayBrightness: ODevice handling for non-embedix kernels not yet implemented" );
429 } 439 }
430 return res; 440 return res;
431} 441}
432 442
433bool Zaurus::setDisplayStatus( bool on ) 443bool Zaurus::setDisplayStatus( bool on )
434{ 444{
435 bool res = false; 445 bool res = false;
436 if ( m_embedix ) 446 if ( m_embedix )
437 { 447 {
438 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); 448 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK );
439 if ( fd ) 449 if ( fd )
440 { 450 {
441 int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; 451 int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF;
442 res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); 452 res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 );
443 ::close ( fd ); 453 ::close ( fd );
444 } 454 }
445 } 455 }
446 else 456 else
447 { 457 {
448 qDebug( "ODevice handling for non-embedix kernels not yet implemented" ); 458 qDebug( "Zaurus::setDisplayStatus: ODevice handling for non-embedix kernels not yet implemented" );
449 } 459 }
450 return res; 460 return res;
451} 461}
452 462
453bool Zaurus::suspend() 463bool Zaurus::suspend()
454{ 464{
455 qDebug("ODevice::suspend"); 465 qDebug("ODevice::suspend");
456 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 466 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
457 return false; 467 return false;
458 468
459 if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices 469 if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
460 return false; 470 return false;
461 471
462 bool res = false; 472 bool res = false;
463 ODevice::sendSuspendmsg(); 473 ODevice::sendSuspendmsg();
464 474
465 struct timeval tvs, tvn; 475 struct timeval tvs, tvn;
466 ::gettimeofday ( &tvs, 0 ); 476 ::gettimeofday ( &tvs, 0 );
467 477
468 ::sync(); // flush fs caches 478 ::sync(); // flush fs caches
469 res = ( ::system ( "apm --suspend" ) == 0 ); 479 res = ( ::system ( "apm --suspend" ) == 0 );
470 480
471 // This is needed because the apm implementation is asynchronous and we 481 // This is needed because the apm implementation is asynchronous and we
472 // can not be sure when exactly the device is really suspended 482 // can not be sure when exactly the device is really suspended
473 if ( res ) { 483 if ( res ) {
474 do { // Yes, wait 15 seconds. This APM sucks big time. 484 do { // Yes, wait 15 seconds. This APM sucks big time.
475 ::usleep ( 200 * 1000 ); 485 ::usleep ( 200 * 1000 );
476 ::gettimeofday ( &tvn, 0 ); 486 ::gettimeofday ( &tvn, 0 );
477 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 ); 487 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 );
478 } 488 }
479 489
480 QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); 490 QCopEnvelope ( "QPE/Rotation", "rotateDefault()" );
481 return res; 491 return res;
482} 492}
483 493
484 494
485Transformation Zaurus::rotation() const 495Transformation Zaurus::rotation() const
486{ 496{
487 Transformation rot; 497 Transformation rot;
488 int handle = 0; 498 int handle = 0;
489 int retval = 0; 499 int retval = 0;
490 500
491 switch ( d->m_model ) { 501 switch ( d->m_model ) {
502 case Model_Zaurus_SLC3000: // fallthrough
492 case Model_Zaurus_SLC7x0: 503 case Model_Zaurus_SLC7x0:
493 handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); 504 handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK);
494 if (handle == -1) { 505 if (handle == -1) {
495 return Rot270; 506 return Rot270;
496 } else { 507 } else {
497 retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); 508 retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION);
498 ::close (handle); 509 ::close (handle);
499 510
500 if (retval == 2 ) 511 if (retval == 2 )
501 rot = Rot0; 512 rot = Rot0;
502 else 513 else
503 rot = Rot270; 514 rot = Rot270;
504 } 515 }
505 break; 516 break;
506 case Model_Zaurus_SLA300: 517 case Model_Zaurus_SL6000:
507 case Model_Zaurus_SLB600: 518 case Model_Zaurus_SLB600:
519 case Model_Zaurus_SLA300:
508 case Model_Zaurus_SL5500: 520 case Model_Zaurus_SL5500:
509 case Model_Zaurus_SL5000: 521 case Model_Zaurus_SL5000:
510 default: 522 default:
511 rot = d->m_rotation; 523 rot = d->m_rotation;
512 break; 524 break;
513 } 525 }
514 526
515 return rot; 527 return rot;
516} 528}
517ODirection Zaurus::direction() const 529ODirection Zaurus::direction() const
518{ 530{
519 ODirection dir; 531 ODirection dir;
520 int handle = 0; 532 int handle = 0;
521 int retval = 0; 533 int retval = 0;
522 switch ( d->m_model ) { 534 switch ( d->m_model ) {
535 case Model_Zaurus_SLC3000: // fallthrough
523 case Model_Zaurus_SLC7x0: 536 case Model_Zaurus_SLC7x0:
524 handle = ::open( "/dev/apm_bios", O_RDWR|O_NONBLOCK ); 537 handle = ::open( "/dev/apm_bios", O_RDWR|O_NONBLOCK );
525 if (handle == -1) { 538 if (handle == -1) {
526 dir = CW; 539 dir = CW;
527 } else { 540 } else {
528 retval = ::ioctl( handle, SHARP_IOCTL_GET_ROTATION ); 541 retval = ::ioctl( handle, SHARP_IOCTL_GET_ROTATION );
529 ::close (handle); 542 ::close (handle);
530 if (retval == 2 ) 543 if (retval == 2 )
531 dir = CCW; 544 dir = CCW;
532 else 545 else
533 dir = CW; 546 dir = CW;
534 } 547 }
535 break; 548 break;
549 case Model_Zaurus_SL6000:
536 case Model_Zaurus_SLA300: 550 case Model_Zaurus_SLA300:
537 case Model_Zaurus_SLB600: 551 case Model_Zaurus_SLB600:
538 case Model_Zaurus_SL5500: 552 case Model_Zaurus_SL5500:
539 case Model_Zaurus_SL5000: 553 case Model_Zaurus_SL5000:
540 default: dir = d->m_direction; 554 default: dir = d->m_direction;
541 break; 555 break;
542 } 556 }
543 return dir; 557 return dir;
544 558
545} 559}
546 560
547int Zaurus::displayBrightnessResolution() const 561int Zaurus::displayBrightnessResolution() const
548{ 562{
549 if (m_embedix) 563 if (m_embedix)
550 { 564 {
551 int handle = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); 565 int handle = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK );
552 if ( handle != -1 ) return ::ioctl( handle, SHARP_FL_IOCTL_GET_STEP, 0 ); 566 if ( handle != -1 ) return ::ioctl( handle, SHARP_FL_IOCTL_GET_STEP, 0 );
553 else return 1; 567 else return 1;
554 } 568 }
555 else 569 else
556 { 570 {
557 qDebug( "ODevice handling for non-embedix kernels not yet implemented" ); 571 qDebug( "Zaurus::displayBrightnessResolution: ODevice handling for non-embedix kernels not yet implemented" );
558 return 1; 572 return 1;
559 } 573 }
560} 574}
561 575
562bool Zaurus::hasHingeSensor() const 576bool Zaurus::hasHingeSensor() const
563{ 577{
564 return d->m_model == Model_Zaurus_SLC7x0; 578 return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000;
565} 579}
566 580
567OHingeStatus Zaurus::readHingeSensor() 581OHingeStatus Zaurus::readHingeSensor()
568{ 582{
569 int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); 583 if (m_embedix)
570 if (handle == -1)
571 {
572 qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror
573 return CASE_UNKNOWN;
574 }
575 else
576 { 584 {
577 int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); 585 int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK);
578 ::close (handle); 586 if (handle == -1)
579 if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE )
580 { 587 {
581 qDebug( "Zaurus::readHingeSensor() - result = %d", retval ); 588 qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror
582 return static_cast<OHingeStatus>( retval ); 589 return CASE_UNKNOWN;
583 } 590 }
584 else 591 else
585 { 592 {
586 qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); 593 int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION);
587 return CASE_UNKNOWN; 594 ::close (handle);
595 if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE )
596 {
597 qDebug( "Zaurus::readHingeSensor() - result = %d", retval );
598 return static_cast<OHingeStatus>( retval );
599 }
600 else
601 {
602 qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" );
603 return CASE_UNKNOWN;
604 }
588 } 605 }
589 } 606 }
607 else
608 {
609 qDebug( "Zaurus::readHingeSensor: ODevice handling for non-embedix kernels not yet implemented" );
610 return CASE_UNKNOWN;
611 }
590} 612}
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h
index 37ab876..ed9cf67 100644
--- a/libopie2/opiecore/device/odevice_zaurus.h
+++ b/libopie2/opiecore/device/odevice_zaurus.h
@@ -1,137 +1,138 @@
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 =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> 4 =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
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 <opie2/odevice.h> 33#include <opie2/odevice.h>
34 34
35#ifndef ARRAY_SIZE 35#ifndef ARRAY_SIZE
36#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 36#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
37#endif 37#endif
38 38
39// _IO and friends are only defined in kernel headers ... 39// _IO and friends are only defined in kernel headers ...
40#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 40#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) 41#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)) 42#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)) 43#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)) 44#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
45 45
46// Audio 46// Audio
47#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 47#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
48 48
49#define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 49#define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
50#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 50#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
51 51
52#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 52#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
53#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 53#define SHARP_BUZ_KEYSOUND 2 /* key sound */
54#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 54#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
55 55
56#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) 56#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
57#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 57#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
58#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 58#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
59#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 59#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
60#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 60#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
61 61
62// LED 62// LED
63#define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 63#define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
64#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) 64#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1)
65#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ 65#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */
66 66
67#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ 67#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */
68#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ 68#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */
69#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ 69#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */
70 70
71// Rotation and Power Management 71// Rotation and Power Management
72#define SHARP_IOCTL_GET_ROTATION 0x413c 72#define SHARP_IOCTL_GET_ROTATION 0x413c
73 73
74#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) 74#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int )
75#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) 75#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int )
76#define APM_EVT_POWER_BUTTON (1 << 0) 76#define APM_EVT_POWER_BUTTON (1 << 0)
77 77
78// Brightness 78// Brightness
79#define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl" 79#define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl"
80#define SHARP_FL_IOCTL_ON 1 80#define SHARP_FL_IOCTL_ON 1
81#define SHARP_FL_IOCTL_OFF 2 81#define SHARP_FL_IOCTL_OFF 2
82#define SHARP_FL_IOCTL_STEP_CONTRAST 100 82#define SHARP_FL_IOCTL_STEP_CONTRAST 100
83#define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101 83#define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101
84#define SHARP_FL_IOCTL_GET_STEP 102 84#define SHARP_FL_IOCTL_GET_STEP 102
85 85
86namespace Opie { 86namespace Opie {
87namespace Core { 87namespace Core {
88namespace Internal { 88namespace Internal {
89
89class Zaurus : public ODevice 90class Zaurus : public ODevice
90{ 91{
91 protected: 92 protected:
92 virtual void init(const QString&); 93 virtual void init(const QString&);
93 virtual void initButtons(); 94 virtual void initButtons();
94 95
95 public: 96 public:
96 virtual bool setSoftSuspend( bool soft ); 97 virtual bool setSoftSuspend( bool soft );
97 98
98 virtual bool setDisplayBrightness( int b ); 99 virtual bool setDisplayBrightness( int b );
99 virtual bool setDisplayStatus( bool on ); 100 virtual bool setDisplayStatus( bool on );
100 virtual int displayBrightnessResolution() const; 101 virtual int displayBrightnessResolution() const;
101 102
102 virtual void playAlarmSound(); 103 virtual void playAlarmSound();
103 virtual void playKeySound(); 104 virtual void playKeySound();
104 virtual void playTouchSound(); 105 virtual void playTouchSound();
105 106
106 virtual QValueList <OLed> ledList() const; 107 virtual QValueList <OLed> ledList() const;
107 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 108 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
108 virtual OLedState ledState( OLed led ) const; 109 virtual OLedState ledState( OLed led ) const;
109 virtual bool setLedState( OLed led, OLedState st ); 110 virtual bool setLedState( OLed led, OLedState st );
110 111
111 virtual bool hasHingeSensor() const; 112 virtual bool hasHingeSensor() const;
112 virtual OHingeStatus readHingeSensor(); 113 virtual OHingeStatus readHingeSensor();
113 114
114 virtual bool suspend(); 115 virtual bool suspend();
115 virtual Transformation rotation() const; 116 virtual Transformation rotation() const;
116 virtual ODirection direction() const; 117 virtual ODirection direction() const;
117 118
118 protected: 119 protected:
119 virtual void buzzer ( int snd ); 120 virtual void buzzer( int snd );
120 121
121 OLedState m_leds [1]; 122 OLedState m_leds[1];
122 bool m_embedix; 123 bool m_embedix;
123}; 124};
124 125
125struct z_button { 126struct z_button {
126 Qt::Key code; 127 Qt::Key code;
127 char *utext; 128 char *utext;
128 char *pix; 129 char *pix;
129 char *fpressedservice; 130 char *fpressedservice;
130 char *fpressedaction; 131 char *fpressedaction;
131 char *fheldservice; 132 char *fheldservice;
132 char *fheldaction; 133 char *fheldaction;
133}; 134};
134} 135}
135} 136}
136} 137}
137#endif 138#endif