summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
Unidiff
Diffstat (limited to 'libopie/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 6e3f114..9871e80 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1,747 +1,749 @@
1/* This file is part of the OPIE libraries 1/* This file is part of the OPIE libraries
2 Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) 2 Copyright (C) 2002 Robert Griebl (sandman@handhelds.org)
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <stdlib.h> 20#include <stdlib.h>
21#include <unistd.h> 21#include <unistd.h>
22#include <fcntl.h> 22#include <fcntl.h>
23#include <sys/ioctl.h> 23#include <sys/ioctl.h>
24#include <signal.h> 24#include <signal.h>
25#include <sys/time.h> 25#include <sys/time.h>
26#include <linux/soundcard.h> 26#include <linux/soundcard.h>
27#include <math.h> 27#include <math.h>
28 28
29#include <qapplication.h> 29#include <qapplication.h>
30 30
31#include <qfile.h> 31#include <qfile.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qpe/sound.h> 33#include <qpe/sound.h>
34#include <qpe/resource.h> 34#include <qpe/resource.h>
35#include <qpe/config.h> 35#include <qpe/config.h>
36 36
37#include "odevice.h" 37#include "odevice.h"
38 38
39// _IO and friends are only defined in kernel headers ... 39// _IO and friends are only defined in kernel headers ...
40 40
41#define OD_IO(type,area,number,args) (( type << 30 ) | ( area << 8 ) | ( number ) | ( sizeof( args ) << 16 )) 41#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
42#define OD_IOW(area,number,args) OD_IO(1,area,number,args) 42
43#define OD_IOR(area,number,args) OD_IO(2,area,number,args) 43#define OD_IO(type,number) OD_IOC(0,type,number,0)
44#define OD_IORW(area,number,args) OD_IO(3,area,number,args) 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))
45 47
46 48
47class ODeviceData { 49class ODeviceData {
48public: 50public:
49 QString m_vendorstr; 51 QString m_vendorstr;
50 OVendor m_vendor; 52 OVendor m_vendor;
51 53
52 QString m_modelstr; 54 QString m_modelstr;
53 OModel m_model; 55 OModel m_model;
54 56
55 QString m_systemstr; 57 QString m_systemstr;
56 OSystem m_system; 58 OSystem m_system;
57 59
58 QString m_sysverstr; 60 QString m_sysverstr;
59 61
60 OLedState m_leds [4]; // just for convenience ... 62 OLedState m_leds [4]; // just for convenience ...
61}; 63};
62 64
63class ODeviceIPAQ : public ODevice { 65class ODeviceIPAQ : public ODevice {
64protected: 66protected:
65 virtual void init ( ); 67 virtual void init ( );
66 68
67public: 69public:
68 virtual bool setPowerButtonHandler ( PowerButtonHandler h ); 70 virtual bool setPowerButtonHandler ( PowerButtonHandler h );
69 71
70 virtual bool setDisplayBrightness ( int b ); 72 virtual bool setDisplayBrightness ( int b );
71 virtual int displayBrightnessResolution ( ) const; 73 virtual int displayBrightnessResolution ( ) const;
72 74
73 virtual void alarmSound ( ); 75 virtual void alarmSound ( );
74 76
75 virtual uint hasLeds ( ) const; 77 virtual uint hasLeds ( ) const;
76 virtual OLedState led ( uint which ) const; 78 virtual OLedState led ( uint which ) const;
77 virtual bool setLed ( uint which, OLedState st ); 79 virtual bool setLed ( uint which, OLedState st );
78}; 80};
79 81
80class ODeviceZaurus : public ODevice { 82class ODeviceZaurus : public ODevice {
81protected: 83protected:
82 virtual void init ( ); 84 virtual void init ( );
83 85
84 public: 86 public:
85 virtual bool setPowerButtonHandler ( PowerButtonHandler h ); 87 virtual bool setPowerButtonHandler ( PowerButtonHandler h );
86 88
87 virtual bool setDisplayBrightness ( int b ); 89 virtual bool setDisplayBrightness ( int b );
88 virtual int displayBrightnessResolution ( ) const; 90 virtual int displayBrightnessResolution ( ) const;
89 91
90 virtual void alarmSound ( ); 92 virtual void alarmSound ( );
91 virtual void keySound ( ); 93 virtual void keySound ( );
92 virtual void touchSound ( ); 94 virtual void touchSound ( );
93 95
94 virtual uint hasLeds ( ) const; 96 virtual uint hasLeds ( ) const;
95 virtual OLedState led ( uint which ) const; 97 virtual OLedState led ( uint which ) const;
96 virtual bool setLed ( uint which, OLedState st ); 98 virtual bool setLed ( uint which, OLedState st );
97 99
98protected: 100protected:
99 virtual void buzzer ( int snd ); 101 virtual void buzzer ( int snd );
100}; 102};
101 103
102 104
103 105
104 106
105ODevice *ODevice::inst ( ) 107ODevice *ODevice::inst ( )
106{ 108{
107 static ODevice *dev = 0; 109 static ODevice *dev = 0;
108 110
109 if ( !dev ) { 111 if ( !dev ) {
110 if ( QFile::exists ( "/proc/hal/model" )) 112 if ( QFile::exists ( "/proc/hal/model" ))
111 dev = new ODeviceIPAQ ( ); 113 dev = new ODeviceIPAQ ( );
112 else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) 114 else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
113 dev = new ODeviceZaurus ( ); 115 dev = new ODeviceZaurus ( );
114 else 116 else
115 dev = new ODevice ( ); 117 dev = new ODevice ( );
116 118
117 dev-> init ( ); 119 dev-> init ( );
118 } 120 }
119 return dev; 121 return dev;
120} 122}
121 123
122 124
123/************************************************** 125/**************************************************
124 * 126 *
125 * common 127 * common
126 * 128 *
127 **************************************************/ 129 **************************************************/
128 130
129 131
130ODevice::ODevice ( ) 132ODevice::ODevice ( )
131{ 133{
132 d = new ODeviceData; 134 d = new ODeviceData;
133 135
134 d-> m_modelstr = "Unknown"; 136 d-> m_modelstr = "Unknown";
135 d-> m_model = OMODEL_Unknown; 137 d-> m_model = OMODEL_Unknown;
136 d-> m_vendorstr = "Unkown"; 138 d-> m_vendorstr = "Unkown";
137 d-> m_vendor = OVENDOR_Unknown; 139 d-> m_vendor = OVENDOR_Unknown;
138 d-> m_systemstr = "Unkown"; 140 d-> m_systemstr = "Unkown";
139 d-> m_system = OSYSTEM_Unknown; 141 d-> m_system = OSYSTEM_Unknown;
140 d-> m_sysverstr = "0.0"; 142 d-> m_sysverstr = "0.0";
141} 143}
142 144
143void ODevice::init ( ) 145void ODevice::init ( )
144{ 146{
145} 147}
146 148
147ODevice::~ODevice ( ) 149ODevice::~ODevice ( )
148{ 150{
149 delete d; 151 delete d;
150} 152}
151 153
152bool ODevice::setPowerButtonHandler ( ODevice::PowerButtonHandler ) 154bool ODevice::setPowerButtonHandler ( ODevice::PowerButtonHandler )
153{ 155{
154 return false; 156 return false;
155} 157}
156 158
157//#include <linux/apm_bios.h> 159//#include <linux/apm_bios.h>
158 160
159#define APM_IOC_SUSPEND OD_IO( 0, 'A', 2, 0 ) 161#define APM_IOC_SUSPEND OD_IO( 'A', 2 )
160 162
161 163
162bool ODevice::suspend ( ) 164bool ODevice::suspend ( )
163{ 165{
164 if ( d-> m_model == OMODEL_Unknown ) // better don't suspend in qvfb / on unkown devices 166 if ( d-> m_model == OMODEL_Unknown ) // better don't suspend in qvfb / on unkown devices
165 return false; 167 return false;
166 168
167 int fd; 169 int fd;
168 bool res = false; 170 bool res = false;
169 171
170 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || 172 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) ||
171 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { 173 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) {
172 struct timeval tvs, tvn; 174 struct timeval tvs, tvn;
173 175
174 ::signal ( SIGTSTP, SIG_IGN );// we don't want to be stopped 176 ::signal ( SIGTSTP, SIG_IGN );// we don't want to be stopped
175 ::gettimeofday ( &tvs, 0 ); 177 ::gettimeofday ( &tvs, 0 );
176 178
177 ::sync ( ); // flush fs caches 179 ::sync ( ); // flush fs caches
178 180
179 res = ( ::ioctl ( fd, APM_IOC_SUSPEND, 0 ) == 0 ); // tell the kernel to "start" suspending 181 res = ( ::ioctl ( fd, APM_IOC_SUSPEND, 0 ) == 0 ); // tell the kernel to "start" suspending
180 182
181 if ( res ) { 183 if ( res ) {
182 ::kill ( -::getpid ( ), SIGTSTP ); // stop everthing in our process group 184 ::kill ( -::getpid ( ), SIGTSTP ); // stop everthing in our process group
183 185
184 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed 186 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed
185 ::usleep ( 200 * 1000 ); 187 ::usleep ( 200 * 1000 );
186 ::gettimeofday ( &tvn, 0 ); 188 ::gettimeofday ( &tvn, 0 );
187 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); 189 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 );
188 190
189 ::kill ( -::getpid ( ), SIGCONT ); // continue everything in our process group 191 ::kill ( -::getpid ( ), SIGCONT ); // continue everything in our process group
190 } 192 }
191 193
192 ::close ( fd ); 194 ::close ( fd );
193 ::signal ( SIGTSTP, SIG_DFL ); 195 ::signal ( SIGTSTP, SIG_DFL );
194 } 196 }
195 197
196 return res; 198 return res;
197} 199}
198 200
199//#include <linux/fb.h> better not rely on kernel headers in userspace ... 201//#include <linux/fb.h> better not rely on kernel headers in userspace ...
200 202
201#define FBIOBLANK OD_IO( 0, 'F', 0x11, 0 ) // 0x4611 203#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611
202 204
203/* VESA Blanking Levels */ 205/* VESA Blanking Levels */
204#define VESA_NO_BLANKING 0 206#define VESA_NO_BLANKING 0
205#define VESA_VSYNC_SUSPEND 1 207#define VESA_VSYNC_SUSPEND 1
206#define VESA_HSYNC_SUSPEND 2 208#define VESA_HSYNC_SUSPEND 2
207#define VESA_POWERDOWN 3 209#define VESA_POWERDOWN 3
208 210
209 211
210bool ODevice::setDisplayStatus ( bool on ) 212bool ODevice::setDisplayStatus ( bool on )
211{ 213{
212 if ( d-> m_model == OMODEL_Unknown ) 214 if ( d-> m_model == OMODEL_Unknown )
213 return false; 215 return false;
214 216
215 bool res = false; 217 bool res = false;
216 int fd; 218 int fd;
217 219
218 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { 220 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) {
219 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); 221 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 );
220 ::close ( fd ); 222 ::close ( fd );
221 } 223 }
222 return res; 224 return res;
223} 225}
224 226
225bool ODevice::setDisplayBrightness ( int ) 227bool ODevice::setDisplayBrightness ( int )
226{ 228{
227 return false; 229 return false;
228} 230}
229 231
230int ODevice::displayBrightnessResolution ( ) const 232int ODevice::displayBrightnessResolution ( ) const
231{ 233{
232 return 16; 234 return 16;
233} 235}
234 236
235QString ODevice::vendorString ( ) 237QString ODevice::vendorString ( )
236{ 238{
237 return d-> m_vendorstr; 239 return d-> m_vendorstr;
238} 240}
239 241
240OVendor ODevice::vendor ( ) 242OVendor ODevice::vendor ( )
241{ 243{
242 return d-> m_vendor; 244 return d-> m_vendor;
243} 245}
244 246
245QString ODevice::modelString ( ) 247QString ODevice::modelString ( )
246{ 248{
247 return d-> m_modelstr; 249 return d-> m_modelstr;
248} 250}
249 251
250OModel ODevice::model ( ) 252OModel ODevice::model ( )
251{ 253{
252 return d-> m_model; 254 return d-> m_model;
253} 255}
254 256
255QString ODevice::systemString ( ) 257QString ODevice::systemString ( )
256{ 258{
257 return d-> m_systemstr; 259 return d-> m_systemstr;
258} 260}
259 261
260OSystem ODevice::system ( ) 262OSystem ODevice::system ( )
261{ 263{
262 return d-> m_system; 264 return d-> m_system;
263} 265}
264 266
265QString ODevice::systemVersionString ( ) 267QString ODevice::systemVersionString ( )
266{ 268{
267 return d-> m_sysverstr; 269 return d-> m_sysverstr;
268} 270}
269 271
270void ODevice::alarmSound ( ) 272void ODevice::alarmSound ( )
271{ 273{
272#ifndef QT_QWS_EBX 274#ifndef QT_QWS_EBX
273#ifndef QT_NO_SOUND 275#ifndef QT_NO_SOUND
274 static Sound snd ( "alarm" ); 276 static Sound snd ( "alarm" );
275 277
276 if ( snd. isFinished ( )) 278 if ( snd. isFinished ( ))
277 snd. play ( ); 279 snd. play ( );
278#endif 280#endif
279#endif 281#endif
280} 282}
281 283
282void ODevice::keySound ( ) 284void ODevice::keySound ( )
283{ 285{
284#ifndef QT_QWS_EBX 286#ifndef QT_QWS_EBX
285#ifndef QT_NO_SOUND 287#ifndef QT_NO_SOUND
286 static Sound snd ( "keysound" ); 288 static Sound snd ( "keysound" );
287 289
288 if ( snd. isFinished ( )) 290 if ( snd. isFinished ( ))
289 snd. play ( ); 291 snd. play ( );
290#endif 292#endif
291#endif 293#endif
292} 294}
293 295
294void ODevice::touchSound ( ) 296void ODevice::touchSound ( )
295{ 297{
296 298
297#ifndef QT_QWS_EBX 299#ifndef QT_QWS_EBX
298#ifndef QT_NO_SOUND 300#ifndef QT_NO_SOUND
299 static Sound snd ( "touchsound" ); 301 static Sound snd ( "touchsound" );
300 302
301 if ( snd. isFinished ( )) 303 if ( snd. isFinished ( ))
302 snd. play ( ); 304 snd. play ( );
303#endif 305#endif
304#endif 306#endif
305} 307}
306 308
307uint ODevice::hasLeds ( ) const 309uint ODevice::hasLeds ( ) const
308{ 310{
309 return 0; 311 return 0;
310} 312}
311 313
312OLedState ODevice::led ( uint /*which*/ ) const 314OLedState ODevice::led ( uint /*which*/ ) const
313{ 315{
314 return OLED_Off; 316 return OLED_Off;
315} 317}
316 318
317bool ODevice::setLed ( uint /*which*/, OLedState /*st*/ ) 319bool ODevice::setLed ( uint /*which*/, OLedState /*st*/ )
318{ 320{
319 return false; 321 return false;
320} 322}
321 323
322 324
323 325
324 326
325/************************************************** 327/**************************************************
326 * 328 *
327 * iPAQ 329 * iPAQ
328 * 330 *
329 **************************************************/ 331 **************************************************/
330 332
331void ODeviceIPAQ::init ( ) 333void ODeviceIPAQ::init ( )
332{ 334{
333 d-> m_vendorstr = "HP"; 335 d-> m_vendorstr = "HP";
334 d-> m_vendor = OVENDOR_HP; 336 d-> m_vendor = OVENDOR_HP;
335 337
336 QFile f ( "/proc/hal/model" ); 338 QFile f ( "/proc/hal/model" );
337 339
338 if ( f. open ( IO_ReadOnly )) { 340 if ( f. open ( IO_ReadOnly )) {
339 QTextStream ts ( &f ); 341 QTextStream ts ( &f );
340 342
341 d-> m_modelstr = "H" + ts. readLine ( ); 343 d-> m_modelstr = "H" + ts. readLine ( );
342 344
343 if ( d-> m_modelstr == "H3100" ) 345 if ( d-> m_modelstr == "H3100" )
344 d-> m_model = OMODEL_iPAQ_H31xx; 346 d-> m_model = OMODEL_iPAQ_H31xx;
345 else if ( d-> m_modelstr == "H3600" ) 347 else if ( d-> m_modelstr == "H3600" )
346 d-> m_model = OMODEL_iPAQ_H36xx; 348 d-> m_model = OMODEL_iPAQ_H36xx;
347 else if ( d-> m_modelstr == "H3700" ) 349 else if ( d-> m_modelstr == "H3700" )
348 d-> m_model = OMODEL_iPAQ_H37xx; 350 d-> m_model = OMODEL_iPAQ_H37xx;
349 else if ( d-> m_modelstr == "H3800" ) 351 else if ( d-> m_modelstr == "H3800" )
350 d-> m_model = OMODEL_iPAQ_H38xx; 352 d-> m_model = OMODEL_iPAQ_H38xx;
351 else 353 else
352 d-> m_model = OMODEL_Unknown; 354 d-> m_model = OMODEL_Unknown;
353 355
354 f. close ( ); 356 f. close ( );
355 } 357 }
356 358
357 f. setName ( "/etc/familiar-version" ); 359 f. setName ( "/etc/familiar-version" );
358 if ( f. open ( IO_ReadOnly )) { 360 if ( f. open ( IO_ReadOnly )) {
359 d-> m_systemstr = "Familiar"; 361 d-> m_systemstr = "Familiar";
360 d-> m_system = OSYSTEM_Familiar; 362 d-> m_system = OSYSTEM_Familiar;
361 363
362 QTextStream ts ( &f ); 364 QTextStream ts ( &f );
363 d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); 365 d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
364 366
365 f. close ( ); 367 f. close ( );
366 } 368 }
367 369
368 d-> m_leds [0] = OLED_Off; 370 d-> m_leds [0] = OLED_Off;
369} 371}
370 372
371//#include <linux/h3600_ts.h> // including kernel headers is evil ... 373//#include <linux/h3600_ts.h> // including kernel headers is evil ...
372 374
373typedef struct { 375typedef struct {
374 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ 376 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */
375 unsigned char TotalTime; /* Units of 5 seconds */ 377 unsigned char TotalTime; /* Units of 5 seconds */
376 unsigned char OnTime; /* units of 100m/s */ 378 unsigned char OnTime; /* units of 100m/s */
377 unsigned char OffTime; /* units of 100m/s */ 379 unsigned char OffTime; /* units of 100m/s */
378} LED_IN; 380} LED_IN;
379 381
380typedef struct { 382typedef struct {
381 unsigned char mode; 383 unsigned char mode;
382 unsigned char pwr; 384 unsigned char pwr;
383 unsigned char brightness; 385 unsigned char brightness;
384} FLITE_IN; 386} FLITE_IN;
385 387
386#define LED_ON OD_IOW( 'f', 5, LED_IN ) 388#define LED_ON OD_IOW( 'f', 5, LED_IN )
387#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) 389#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
388 390
389 391
390void ODeviceIPAQ::alarmSound ( ) 392void ODeviceIPAQ::alarmSound ( )
391{ 393{
392#if defined( QT_QWS_IPAQ ) // IPAQ 394#if defined( QT_QWS_IPAQ ) // IPAQ
393#ifndef QT_NO_SOUND 395#ifndef QT_NO_SOUND
394 static Sound snd ( "alarm" ); 396 static Sound snd ( "alarm" );
395 int fd; 397 int fd;
396 int vol; 398 int vol;
397 bool vol_reset = false; 399 bool vol_reset = false;
398 400
399 if ((( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) || 401 if ((( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) ||
400 (( fd = ::open ( "/dev/mixer", O_RDWR )) >= 0 )) { 402 (( fd = ::open ( "/dev/mixer", O_RDWR )) >= 0 )) {
401 403
402 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { 404 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
403 Config cfg ( "qpe" ); 405 Config cfg ( "qpe" );
404 cfg. setGroup ( "Volume" ); 406 cfg. setGroup ( "Volume" );
405 407
406 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); 408 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
407 if ( volalarm < 0 ) 409 if ( volalarm < 0 )
408 volalarm = 0; 410 volalarm = 0;
409 else if ( volalarm > 100 ) 411 else if ( volalarm > 100 )
410 volalarm = 100; 412 volalarm = 100;
411 volalarm |= ( volalarm << 8 ); 413 volalarm |= ( volalarm << 8 );
412 414
413 if (( volalarm & 0xff ) > ( vol & 0xff )) { 415 if (( volalarm & 0xff ) > ( vol & 0xff )) {
414 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) 416 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
415 vol_reset = true; 417 vol_reset = true;
416 } 418 }
417 } 419 }
418 } 420 }
419 421
420 snd. play ( ); 422 snd. play ( );
421 while ( !snd. isFinished ( )) 423 while ( !snd. isFinished ( ))
422 qApp-> processEvents ( ); 424 qApp-> processEvents ( );
423 425
424 if ( fd >= 0 ) { 426 if ( fd >= 0 ) {
425 if ( vol_reset ) 427 if ( vol_reset )
426 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); 428 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
427 ::close ( fd ); 429 ::close ( fd );
428 } 430 }
429#endif 431#endif
430#endif 432#endif
431} 433}
432 434
433uint ODeviceIPAQ::hasLeds ( ) const 435uint ODeviceIPAQ::hasLeds ( ) const
434{ 436{
435 return 1; 437 return 1;
436} 438}
437 439
438OLedState ODeviceIPAQ::led ( uint which ) const 440OLedState ODeviceIPAQ::led ( uint which ) const
439{ 441{
440 if ( which == 0 ) 442 if ( which == 0 )
441 return d-> m_leds [0]; 443 return d-> m_leds [0];
442 else 444 else
443 return OLED_Off; 445 return OLED_Off;
444} 446}
445 447
446bool ODeviceIPAQ::setLed ( uint which, OLedState st ) 448bool ODeviceIPAQ::setLed ( uint which, OLedState st )
447{ 449{
448 static int fd = ::open ( "/dev/touchscreen/0", O_RDWR|O_NONBLOCK ); 450 static int fd = ::open ( "/dev/touchscreen/0", O_RDWR|O_NONBLOCK );
449 451
450 if ( which == 0 ) { 452 if ( which == 0 ) {
451 if ( fd >= 0 ) { 453 if ( fd >= 0 ) {
452 LED_IN leds; 454 LED_IN leds;
453 ::memset ( &leds, 0, sizeof( leds )); 455 ::memset ( &leds, 0, sizeof( leds ));
454 leds. TotalTime = 0; 456 leds. TotalTime = 0;
455 leds. OnTime = 0; 457 leds. OnTime = 0;
456 leds. OffTime = 1; 458 leds. OffTime = 1;
457 leds. OffOnBlink = 2; 459 leds. OffOnBlink = 2;
458 460
459 switch ( st ) { 461 switch ( st ) {
460 case OLED_Off : leds. OffOnBlink = 0; break; 462 case OLED_Off : leds. OffOnBlink = 0; break;
461 case OLED_On : leds. OffOnBlink = 1; break; 463 case OLED_On : leds. OffOnBlink = 1; break;
462 case OLED_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; 464 case OLED_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break;
463 case OLED_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; 465 case OLED_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break;
464 } 466 }
465 467
466 if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { 468 if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) {
467 d-> m_leds [0] = st; 469 d-> m_leds [0] = st;
468 return true; 470 return true;
469 } 471 }
470 } 472 }
471 } 473 }
472 return false; 474 return false;
473} 475}
474 476
475bool ODeviceIPAQ::setPowerButtonHandler ( ODevice::PowerButtonHandler p ) 477bool ODeviceIPAQ::setPowerButtonHandler ( ODevice::PowerButtonHandler p )
476{ 478{
477 bool res = false; 479 bool res = false;
478 int fd; 480 int fd;
479 481
480 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { 482 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) {
481 if ( ::write ( fd, p == KERNEL ? "0" : "1", 1 ) == 1 ) 483 if ( ::write ( fd, p == KERNEL ? "0" : "1", 1 ) == 1 )
482 res = true; 484 res = true;
483 else 485 else
484 ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); 486 ::perror ( "write to /proc/sys/ts/suspend_button_mode" );
485 487
486 ::close ( fd ); 488 ::close ( fd );
487 } 489 }
488 else 490 else
489 ::perror ( "/proc/sys/ts/suspend_button_mode" ); 491 ::perror ( "/proc/sys/ts/suspend_button_mode" );
490 492
491 return res; 493 return res;
492} 494}
493 495
494 496
495bool ODeviceIPAQ::setDisplayBrightness ( int bright ) 497bool ODeviceIPAQ::setDisplayBrightness ( int bright )
496{ 498{
497 bool res = false; 499 bool res = false;
498 int fd; 500 int fd;
499 501
500 if ( bright > 255 ) 502 if ( bright > 255 )
501 bright = 255; 503 bright = 255;
502 if ( bright < 0 ) 504 if ( bright < 0 )
503 bright = 0; 505 bright = 0;
504 506
505 // 128 is the maximum if you want a decent lifetime for the LCD 507 // 128 is the maximum if you want a decent lifetime for the LCD
506 508
507 bright = (int) (( ::pow ( 2, double( bright ) / 255.0 ) - 1 ) * 128.0 ); // logarithmic 509 bright = (int) (( ::pow ( 2, double( bright ) / 255.0 ) - 1 ) * 128.0 ); // logarithmic
508 //bright = ( bright + 1 ) / 2; 510 //bright = ( bright + 1 ) / 2;
509 511
510 if ((( fd = ::open ( "/dev/ts", O_WRONLY )) >= 0 ) || 512 if ((( fd = ::open ( "/dev/ts", O_WRONLY )) >= 0 ) ||
511 (( fd = ::open ( "/dev/h3600_ts", O_WRONLY )) >= 0 )) { 513 (( fd = ::open ( "/dev/h3600_ts", O_WRONLY )) >= 0 )) {
512 FLITE_IN bl; 514 FLITE_IN bl;
513 bl. mode = 1; 515 bl. mode = 1;
514 bl. pwr = bright ? 1 : 0; 516 bl. pwr = bright ? 1 : 0;
515 bl. brightness = bright; 517 bl. brightness = bright;
516 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 518 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
517 ::close ( fd ); 519 ::close ( fd );
518 } 520 }
519 return res; 521 return res;
520} 522}
521 523
522int ODeviceIPAQ::displayBrightnessResolution ( ) const 524int ODeviceIPAQ::displayBrightnessResolution ( ) const
523{ 525{
524 return 255; // really 128, but logarithmic control is smoother this way 526 return 255; // really 128, but logarithmic control is smoother this way
525} 527}
526 528
527 529
528/************************************************** 530/**************************************************
529 * 531 *
530 * Zaurus 532 * Zaurus
531 * 533 *
532 **************************************************/ 534 **************************************************/
533 535
534 536
535 537
536void ODeviceZaurus::init ( ) 538void ODeviceZaurus::init ( )
537{ 539{
538 d-> m_modelstr = "Zaurus SL5000"; 540 d-> m_modelstr = "Zaurus SL5000";
539 d-> m_model = OMODEL_Zaurus_SL5000; 541 d-> m_model = OMODEL_Zaurus_SL5000;
540 d-> m_vendorstr = "Sharp"; 542 d-> m_vendorstr = "Sharp";
541 d-> m_vendor = OVENDOR_Sharp; 543 d-> m_vendor = OVENDOR_Sharp;
542 544
543 QFile f ( "/proc/filesystems" ); 545 QFile f ( "/proc/filesystems" );
544 546
545 if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { 547 if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) {
546 d-> m_systemstr = "OpenZaurus"; 548 d-> m_systemstr = "OpenZaurus";
547 d-> m_system = OSYSTEM_OpenZaurus; 549 d-> m_system = OSYSTEM_OpenZaurus;
548 550
549 f. close ( ); 551 f. close ( );
550 } 552 }
551 else { 553 else {
552 d-> m_systemstr = "Zaurus"; 554 d-> m_systemstr = "Zaurus";
553 d-> m_system = OSYSTEM_Zaurus; 555 d-> m_system = OSYSTEM_Zaurus;
554 } 556 }
555 557
556 d-> m_leds [0] = OLED_Off; 558 d-> m_leds [0] = OLED_Off;
557} 559}
558 560
559#include <unistd.h> 561#include <unistd.h>
560#include <fcntl.h> 562#include <fcntl.h>
561#include <sys/ioctl.h> 563#include <sys/ioctl.h>
562 564
563//#include <asm/sharp_char.h> // including kernel headers is evil ... 565//#include <asm/sharp_char.h> // including kernel headers is evil ...
564 566
565#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 567#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
566 568
567 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 569 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
568#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 570#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
569 571
570#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 572#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
571#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 573#define SHARP_BUZ_KEYSOUND 2 /* key sound */
572#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 574#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
573 575
574/* --- for SHARP_BUZZER device --- */ 576/* --- for SHARP_BUZZER device --- */
575 577
576 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 578 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
577//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 579//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
578 580
579#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) 581#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
580#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 582#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
581#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 583#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
582#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 584#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
583#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 585#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
584 586
585//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 587//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
586//#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 588//#define SHARP_BUZ_KEYSOUND 2 /* key sound */
587 589
588//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ 590//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */
589//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ 591//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */
590//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ 592//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */
591//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ 593//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */
592//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ 594//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */
593//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ 595//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */
594//#define SHARP_PDA_APPSTART 9 /* application start */ 596//#define SHARP_PDA_APPSTART 9 /* application start */
595//#define SHARP_PDA_APPQUIT 10 /* application ends */ 597//#define SHARP_PDA_APPQUIT 10 /* application ends */
596 598
597//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 599//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
598//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ 600//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */
599//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ 601//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */
600//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ 602//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */
601// 603//
602 604
603 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 605 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
604#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) 606#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1)
605 607
606typedef struct sharp_led_status { 608typedef struct sharp_led_status {
607 int which; /* select which LED status is wanted. */ 609 int which; /* select which LED status is wanted. */
608 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 610 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
609} sharp_led_status; 611} sharp_led_status;
610 612
611#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ 613#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */
612 614
613#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ 615#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */
614#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ 616#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */
615#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ 617#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */
616 618
617// #include <asm/sharp_apm.h> // including kernel headers is evil ... 619// #include <asm/sharp_apm.h> // including kernel headers is evil ...
618 620
619#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) 621#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int )
620#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) 622#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int )
621#define APM_EVT_POWER_BUTTON (1 << 0) 623#define APM_EVT_POWER_BUTTON (1 << 0)
622 624
623#define FL_IOCTL_STEP_CONTRAST 100 625#define FL_IOCTL_STEP_CONTRAST 100
624 626
625 627
626void ODeviceZaurus::buzzer ( int sound ) 628void ODeviceZaurus::buzzer ( int sound )
627{ 629{
628 static int fd = ::open ( "/dev/sharp_buz", O_RDWR|O_NONBLOCK ); 630 static int fd = ::open ( "/dev/sharp_buz", O_RDWR|O_NONBLOCK );
629 631
630 if ( fd >= 0 ) 632 if ( fd >= 0 )
631 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 633 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
632} 634}
633 635
634 636
635void ODeviceZaurus::alarmSound ( ) 637void ODeviceZaurus::alarmSound ( )
636{ 638{
637 buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); 639 buzzer ( SHARP_BUZ_SCHEDULE_ALARM );
638} 640}
639 641
640void ODeviceZaurus::touchSound ( ) 642void ODeviceZaurus::touchSound ( )
641{ 643{
642 buzzer ( SHARP_BUZ_TOUCHSOUND ); 644 buzzer ( SHARP_BUZ_TOUCHSOUND );
643} 645}
644 646
645void ODeviceZaurus::keySound ( ) 647void ODeviceZaurus::keySound ( )
646{ 648{
647 buzzer ( SHARP_BUZ_KEYSOUND ); 649 buzzer ( SHARP_BUZ_KEYSOUND );
648} 650}
649 651
650 652
651uint ODeviceZaurus::hasLeds ( ) const 653uint ODeviceZaurus::hasLeds ( ) const
652{ 654{
653 return 1; 655 return 1;
654} 656}
655 657
656OLedState ODeviceZaurus::led ( uint which ) const 658OLedState ODeviceZaurus::led ( uint which ) const
657{ 659{
658 if ( which == 0 ) 660 if ( which == 0 )
659 return d-> m_leds [0]; 661 return d-> m_leds [0];
660 else 662 else
661 return OLED_Off; 663 return OLED_Off;
662} 664}
663 665
664bool ODeviceZaurus::setLed ( uint which, OLedState st ) 666bool ODeviceZaurus::setLed ( uint which, OLedState st )
665{ 667{
666 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 668 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
667 669
668 if ( which == 0 ) { 670 if ( which == 0 ) {
669 if ( fd >= 0 ) { 671 if ( fd >= 0 ) {
670 struct sharp_led_status leds; 672 struct sharp_led_status leds;
671 ::memset ( &leds, 0, sizeof( leds )); 673 ::memset ( &leds, 0, sizeof( leds ));
672 leds. which = SHARP_LED_MAIL_EXISTS; 674 leds. which = SHARP_LED_MAIL_EXISTS;
673 675
674 switch ( st ) { 676 switch ( st ) {
675 case OLED_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; 677 case OLED_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break;
676 case OLED_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; 678 case OLED_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break;
677 case OLED_BlinkSlow: 679 case OLED_BlinkSlow:
678 case OLED_BlinkFast: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; 680 case OLED_BlinkFast: leds. status = LED_MAIL_UNREAD_MAIL_EX; break;
679 } 681 }
680 682
681 if ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 ) { 683 if ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 ) {
682 d-> m_leds [0] = st; 684 d-> m_leds [0] = st;
683 return true; 685 return true;
684 } 686 }
685 } 687 }
686 } 688 }
687 return false; 689 return false;
688} 690}
689 691
690bool ODeviceZaurus::setPowerButtonHandler ( ODevice::PowerButtonHandler p ) 692bool ODeviceZaurus::setPowerButtonHandler ( ODevice::PowerButtonHandler p )
691{ 693{
692 bool res = false; 694 bool res = false;
693 int fd; 695 int fd;
694 696
695 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || 697 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) ||
696 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { 698 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) {
697 699
698 int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources 700 int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources
699 701
700 if ( sources >= 0 ) { 702 if ( sources >= 0 ) {
701 if ( p == KERNEL ) 703 if ( p == KERNEL )
702 sources |= APM_EVT_POWER_BUTTON; 704 sources |= APM_EVT_POWER_BUTTON;
703 else 705 else
704 sources &= ~APM_EVT_POWER_BUTTON; 706 sources &= ~APM_EVT_POWER_BUTTON;
705 707
706 if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources & ~APM_EVT_POWER_BUTTON ) >= 0 ) // set new event sources 708 if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources & ~APM_EVT_POWER_BUTTON ) >= 0 ) // set new event sources
707 res = true; 709 res = true;
708 else 710 else
709 perror ( "APM_IOCGEVTSRC" ); 711 perror ( "APM_IOCGEVTSRC" );
710 } 712 }
711 else 713 else
712 perror ( "APM_IOCGEVTSRC" ); 714 perror ( "APM_IOCGEVTSRC" );
713 715
714 ::close ( fd ); 716 ::close ( fd );
715 } 717 }
716 else 718 else
717 perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); 719 perror ( "/dev/apm_bios or /dev/misc/apm_bios" );
718 720
719 return res; 721 return res;
720} 722}
721 723
722 724
723bool ODeviceZaurus::setDisplayBrightness ( int bright ) 725bool ODeviceZaurus::setDisplayBrightness ( int bright )
724{ 726{
725 bool res = false; 727 bool res = false;
726 int fd; 728 int fd;
727 729
728 if ( bright > 255 ) 730 if ( bright > 255 )
729 bright = 255; 731 bright = 255;
730 if ( bright < 0 ) 732 if ( bright < 0 )
731 bright = 0; 733 bright = 0;
732 734
733 if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { 735 if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) {
734 int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus 736 int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus
735 if ( bright && !bl ) 737 if ( bright && !bl )
736 bl = 1; 738 bl = 1;
737 res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 ); 739 res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 );
738 ::close ( fd ); 740 ::close ( fd );
739 } 741 }
740 return res; 742 return res;
741} 743}
742 744
743 745
744int ODeviceZaurus::displayBrightnessResolution ( ) const 746int ODeviceZaurus::displayBrightnessResolution ( ) const
745{ 747{
746 return 4; 748 return 4;
747} 749}