summaryrefslogtreecommitdiff
authorzecke <zecke>2006-04-27 10:45:16 (UTC)
committer zecke <zecke>2006-04-27 10:45:16 (UTC)
commit17191b7ae7929568b9ed87a427e2eaeb28377a00 (patch) (unidiff)
tree8a095f0ecd0b4a09f72b1e8295bfc3d8c8008524
parentc5e86199c46839e6952b8ec3dec1447e5f60a279 (diff)
downloadopie-17191b7ae7929568b9ed87a427e2eaeb28377a00.zip
opie-17191b7ae7929568b9ed87a427e2eaeb28377a00.tar.gz
opie-17191b7ae7929568b9ed87a427e2eaeb28377a00.tar.bz2
libopie2/opiecore/device/:
Patch by hrhr to add basic backlight support for the hx4700 series of iPAQs to ODevice
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.h2
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp13
2 files changed, 14 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index 0c78277..2566979 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -25,97 +25,97 @@
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 = 0xffff0000, 59 Model_Series_Mask = 0xffff0000,
60 60
61 Model_iPAQ = ( 1 << 16 ), 61 Model_iPAQ = ( 1 << 16 ),
62 62
63 Model_iPAQ_All = ( Model_iPAQ | 0xffff ), 63 Model_iPAQ_All = ( Model_iPAQ | 0xffff ),
64 Model_iPAQ_H31xx = ( Model_iPAQ | 0x0001 ), 64 Model_iPAQ_H31xx = ( Model_iPAQ | 0x0001 ),
65 Model_iPAQ_H36xx = ( Model_iPAQ | 0x0002 ), 65 Model_iPAQ_H36xx = ( Model_iPAQ | 0x0002 ),
66 Model_iPAQ_H37xx = ( Model_iPAQ | 0x0003 ), 66 Model_iPAQ_H37xx = ( Model_iPAQ | 0x0003 ),
67 Model_iPAQ_H38xx = ( Model_iPAQ | 0x0004 ), 67 Model_iPAQ_H38xx = ( Model_iPAQ | 0x0004 ),
68 Model_iPAQ_H39xx = ( Model_iPAQ | 0x0005 ), 68 Model_iPAQ_H39xx = ( Model_iPAQ | 0x0005 ),
69 Model_iPAQ_H5xxx = ( Model_iPAQ | 0x0006 ), 69 Model_iPAQ_H5xxx = ( Model_iPAQ | 0x0006 ),
70 Model_iPAQ_H22xx = ( Model_iPAQ | 0x0007 ), 70 Model_iPAQ_H22xx = ( Model_iPAQ | 0x0007 ),
71 Model_iPAQ_H191x = ( Model_iPAQ | 0x0008 ), 71 Model_iPAQ_H191x = ( Model_iPAQ | 0x0008 ),
72 Model_iPAQ_H1940 = ( Model_iPAQ | 0x0009 ), 72 Model_iPAQ_H1940 = ( Model_iPAQ | 0x0009 ),
73 73 Model_iPAQ_HX4700 = ( Model_iPAQ | 0x000A ),
74 Model_Jornada = ( 6 << 16 ), 74 Model_Jornada = ( 6 << 16 ),
75 Model_Jornada_56x = ( Model_Jornada | 0x0001 ), 75 Model_Jornada_56x = ( Model_Jornada | 0x0001 ),
76 Model_Jornada_720 = ( Model_Jornada | 0x0002 ), 76 Model_Jornada_720 = ( Model_Jornada | 0x0002 ),
77 77
78 Model_Zaurus = ( 2 << 16 ), 78 Model_Zaurus = ( 2 << 16 ),
79 79
80 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ), 80 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ),
81 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ), 81 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ),
82 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ), 82 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ),
83 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ), 83 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ),
84 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ), 84 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ),
85 Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0006 ), 85 Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0006 ),
86 Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0007 ), 86 Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0007 ),
87 Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0008 ), 87 Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0008 ),
88 Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x0009 ), 88 Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x0009 ),
89 89
90 Model_SIMpad = ( 3 << 16 ), 90 Model_SIMpad = ( 3 << 16 ),
91 91
92 Model_SIMpad_All = ( Model_SIMpad | 0xffff ), 92 Model_SIMpad_All = ( Model_SIMpad | 0xffff ),
93 Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ), 93 Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ),
94 Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ), 94 Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ),
95 Model_SIMpad_SLC = ( Model_SIMpad | 0x0003 ), 95 Model_SIMpad_SLC = ( Model_SIMpad | 0x0003 ),
96 Model_SIMpad_TSinus = ( Model_SIMpad | 0x0004 ), 96 Model_SIMpad_TSinus = ( Model_SIMpad | 0x0004 ),
97 97
98 Model_Ramses = ( 4 << 16 ), 98 Model_Ramses = ( 4 << 16 ),
99 99
100 Model_Ramses_All = ( Model_Ramses | 0xffff ), 100 Model_Ramses_All = ( Model_Ramses | 0xffff ),
101 Model_Ramses_MNCI = ( Model_Ramses | 0x0001 ), 101 Model_Ramses_MNCI = ( Model_Ramses | 0x0001 ),
102 Model_Ramses_MNCIRX = ( Model_Ramses | 0x0002 ), 102 Model_Ramses_MNCIRX = ( Model_Ramses | 0x0002 ),
103 103
104 Model_Yopy = ( 5 << 16 ), 104 Model_Yopy = ( 5 << 16 ),
105 105
106 Model_Yopy_All = ( Model_Yopy | 0xffff ), 106 Model_Yopy_All = ( Model_Yopy | 0xffff ),
107 Model_Yopy_3000 = ( Model_Yopy | 0x0001 ), 107 Model_Yopy_3000 = ( Model_Yopy | 0x0001 ),
108 Model_Yopy_3500 = ( Model_Yopy | 0x0002 ), 108 Model_Yopy_3500 = ( Model_Yopy | 0x0002 ),
109 Model_Yopy_3700 = ( Model_Yopy | 0x0003 ), 109 Model_Yopy_3700 = ( Model_Yopy | 0x0003 ),
110 110
111 Model_Beagle = ( 6 << 16 ), 111 Model_Beagle = ( 6 << 16 ),
112 112
113 Model_Beagle_All = ( Model_Beagle | 0xffff ), 113 Model_Beagle_All = ( Model_Beagle | 0xffff ),
114 Model_Beagle_PA100 = ( Model_Beagle | 0x0001 ), 114 Model_Beagle_PA100 = ( Model_Beagle | 0x0001 ),
115 115
116 Model_GenuineIntel = ( 7 << 16 ), 116 Model_GenuineIntel = ( 7 << 16 ),
117 117
118 Model_MyPal = ( 8 << 16 ), 118 Model_MyPal = ( 8 << 16 ),
119 119
120 Model_MyPal_All = ( Model_MyPal | 0xffff ), 120 Model_MyPal_All = ( Model_MyPal | 0xffff ),
121 Model_MyPal_620 = ( Model_MyPal | 0x0001 ), 121 Model_MyPal_620 = ( Model_MyPal | 0x0001 ),
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index a221e23..e6e3145 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -108,108 +108,112 @@ struct i_button ipaq_buttons [] = {
108 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 108 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
109 "devicebuttons/ipaq_home", 109 "devicebuttons/ipaq_home",
110 "QPE/Launcher", "home()", 110 "QPE/Launcher", "home()",
111 "buttonsettings", "raise()" }, 111 "buttonsettings", "raise()" },
112 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 112 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
113 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), 113 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
114 "devicebuttons/ipaq_record", 114 "devicebuttons/ipaq_record",
115 "QPE/VMemo", "toggleRecord()", 115 "QPE/VMemo", "toggleRecord()",
116 "sound", "raise()" }, 116 "sound", "raise()" },
117 117
118 { Model_iPAQ_H191x, 118 { Model_iPAQ_H191x,
119 Qt::Key_F8, QT_TRANSLATE_NOOP("Button", "Mail Button"), 119 Qt::Key_F8, QT_TRANSLATE_NOOP("Button", "Mail Button"),
120 "devicebuttons/ipaq_mail", 120 "devicebuttons/ipaq_mail",
121 "opiemail", "raise()", 121 "opiemail", "raise()",
122 "opiemail", "newMail()" }, 122 "opiemail", "newMail()" },
123 { Model_iPAQ_H191x, 123 { Model_iPAQ_H191x,
124 Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Record Button"), 124 Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Record Button"),
125 "devicebuttons/ipaq_record", 125 "devicebuttons/ipaq_record",
126 "QPE/VMemo", "toggleRecord()", 126 "QPE/VMemo", "toggleRecord()",
127 "sound", "raise()" }, 127 "sound", "raise()" },
128 128
129}; 129};
130 130
131void iPAQ::init(const QString& model) 131void iPAQ::init(const QString& model)
132{ 132{
133 d->m_vendorstr = "HP"; 133 d->m_vendorstr = "HP";
134 d->m_vendor = Vendor_HP; 134 d->m_vendor = Vendor_HP;
135 135
136 d->m_modelstr = model.mid(model.findRev('H')); 136 d->m_modelstr = model.mid(model.findRev('H'));
137 137
138 if ( d->m_modelstr == "H3100" ) 138 if ( d->m_modelstr == "H3100" )
139 d->m_model = Model_iPAQ_H31xx; 139 d->m_model = Model_iPAQ_H31xx;
140 else if ( d->m_modelstr == "H3600" ) 140 else if ( d->m_modelstr == "H3600" )
141 d->m_model = Model_iPAQ_H36xx; 141 d->m_model = Model_iPAQ_H36xx;
142 else if ( d->m_modelstr == "H3700" ) 142 else if ( d->m_modelstr == "H3700" )
143 d->m_model = Model_iPAQ_H37xx; 143 d->m_model = Model_iPAQ_H37xx;
144 else if ( d->m_modelstr == "H3800" ) 144 else if ( d->m_modelstr == "H3800" )
145 d->m_model = Model_iPAQ_H38xx; 145 d->m_model = Model_iPAQ_H38xx;
146 else if ( d->m_modelstr == "H3900" ) 146 else if ( d->m_modelstr == "H3900" )
147 d->m_model = Model_iPAQ_H39xx; 147 d->m_model = Model_iPAQ_H39xx;
148 else if ( d->m_modelstr == "H5400" ) 148 else if ( d->m_modelstr == "H5400" )
149 d->m_model = Model_iPAQ_H5xxx; 149 d->m_model = Model_iPAQ_H5xxx;
150 else if ( d->m_modelstr == "H2200" ) 150 else if ( d->m_modelstr == "H2200" )
151 d->m_model = Model_iPAQ_H22xx; 151 d->m_model = Model_iPAQ_H22xx;
152 else if ( d->m_modelstr == "H1910" ) 152 else if ( d->m_modelstr == "H1910" )
153 d->m_model = Model_iPAQ_H191x; 153 d->m_model = Model_iPAQ_H191x;
154 else if ( d->m_modelstr == "H1940" ) 154 else if ( d->m_modelstr == "H1940" )
155 d->m_model = Model_iPAQ_H1940; 155 d->m_model = Model_iPAQ_H1940;
156 else if ( d->m_modelstr == "HX4700" )
157 d->m_model = Model_iPAQ_HX4700;
158
156 else 159 else
157 d->m_model = Model_Unknown; 160 d->m_model = Model_Unknown;
158 161
159 switch ( d->m_model ) { 162 switch ( d->m_model ) {
160 case Model_iPAQ_H31xx: 163 case Model_iPAQ_H31xx:
161 case Model_iPAQ_H38xx: 164 case Model_iPAQ_H38xx:
162 d->m_rotation = Rot90; 165 d->m_rotation = Rot90;
163 break; 166 break;
164 case Model_iPAQ_H5xxx: 167 case Model_iPAQ_H5xxx:
165 case Model_iPAQ_H22xx: 168 case Model_iPAQ_H22xx:
166 case Model_iPAQ_H191x: 169 case Model_iPAQ_H191x:
167 case Model_iPAQ_H1940: 170 case Model_iPAQ_H1940:
171 case Model_iPAQ_HX4700:
168 d->m_rotation = Rot0; 172 d->m_rotation = Rot0;
169 break; 173 break;
170 case Model_iPAQ_H36xx: 174 case Model_iPAQ_H36xx:
171 case Model_iPAQ_H37xx: 175 case Model_iPAQ_H37xx:
172 case Model_iPAQ_H39xx: 176 case Model_iPAQ_H39xx:
173 default: 177 default:
174 d->m_rotation = Rot270; 178 d->m_rotation = Rot270;
175 break; 179 break;
176 180
177 } 181 }
178 182
179 m_leds [0] = m_leds [1] = Led_Off; 183 m_leds [0] = m_leds [1] = Led_Off;
180 184
181 m_power_timer = 0; 185 m_power_timer = 0;
182 186
183} 187}
184 188
185void iPAQ::initButtons() 189void iPAQ::initButtons()
186{ 190{
187 if ( d->m_buttons ) 191 if ( d->m_buttons )
188 return; 192 return;
189 193
190 if ( isQWS( ) ) { 194 if ( isQWS( ) ) {
191 addPreHandler(this); 195 addPreHandler(this);
192 } 196 }
193 197
194 d->m_buttons = new QValueList <ODeviceButton>; 198 d->m_buttons = new QValueList <ODeviceButton>;
195 199
196 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 200 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
197 i_button *ib = ipaq_buttons + i; 201 i_button *ib = ipaq_buttons + i;
198 ODeviceButton b; 202 ODeviceButton b;
199 203
200 if (( ib->model & d->m_model ) == d->m_model ) { 204 if (( ib->model & d->m_model ) == d->m_model ) {
201 b. setKeycode ( ib->code ); 205 b. setKeycode ( ib->code );
202 b. setUserText ( QObject::tr ( "Button", ib->utext )); 206 b. setUserText ( QObject::tr ( "Button", ib->utext ));
203 b. setPixmap ( OResource::loadPixmap ( ib->pix )); 207 b. setPixmap ( OResource::loadPixmap ( ib->pix ));
204 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); 208 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction ));
205 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); 209 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction ));
206 210
207 d->m_buttons->append ( b ); 211 d->m_buttons->append ( b );
208 } 212 }
209 } 213 }
210 reloadButtonMapping(); 214 reloadButtonMapping();
211} 215}
212 216
213QValueList <OLed> iPAQ::ledList() const 217QValueList <OLed> iPAQ::ledList() const
214{ 218{
215 QValueList <OLed> vl; 219 QValueList <OLed> vl;
@@ -337,121 +341,130 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b
337 return true; 341 return true;
338 } 342 }
339 else 343 else
340 return false; 344 return false;
341} 345}
342 346
343void iPAQ::timerEvent ( QTimerEvent * ) 347void iPAQ::timerEvent ( QTimerEvent * )
344{ 348{
345 killTimer ( m_power_timer ); 349 killTimer ( m_power_timer );
346 m_power_timer = 0; 350 m_power_timer = 0;
347 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); 351 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false );
348 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); 352 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false );
349} 353}
350 354
351 355
352void iPAQ::playAlarmSound() 356void iPAQ::playAlarmSound()
353{ 357{
354#ifndef QT_NO_SOUND 358#ifndef QT_NO_SOUND
355 static Sound snd ( "alarm" ); 359 static Sound snd ( "alarm" );
356 if(!snd.isFinished()) 360 if(!snd.isFinished())
357 return; 361 return;
358 362
359 changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); 363 changeMixerForAlarm(0, "/dev/sound/mixer", &snd );
360 snd. play(); 364 snd. play();
361#endif 365#endif
362} 366}
363 367
364bool iPAQ::setDisplayBrightness ( int bright ) 368bool iPAQ::setDisplayBrightness ( int bright )
365{ 369{
366 bool res = false; 370 bool res = false;
367 int fd; 371 int fd;
368 372
369 if ( bright > 255 ) 373 if ( bright > 255 )
370 bright = 255; 374 bright = 255;
371 if ( bright < 0 ) 375 if ( bright < 0 )
372 bright = 0; 376 bright = 0;
373 377
374 QString cmdline; 378 QString cmdline;
375 379
376 switch ( model()) { 380 switch ( model()) {
377 case Model_iPAQ_H191x: 381 case Model_iPAQ_H191x:
378 if ( !bright ) 382 if ( !bright )
379 cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/pxafb/power"); 383 cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/pxafb/power");
380 else 384 else
381 cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/pxafb/power; echo %1 > /sys/class/backlight/pxafb/brightness" ).arg( bright ); 385 cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/pxafb/power; echo %1 > /sys/class/backlight/pxafb/brightness" ).arg( bright );
382 // No Global::shellQuote as we gurantee it to be sane 386 // No Global::shellQuote as we gurantee it to be sane
383 res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); 387 res = ( ::system( QFile::encodeName(cmdline) ) == 0 );
384 break; 388 break;
389
390 case Model_iPAQ_HX4700:
391 cmdline = QString::fromLatin1( "echo %1 > /sys/class/backlight/w100fb/brightness" ).arg( bright );
392 // No Global::shellQuote as we gurantee it to be sane
393 res = ( ::system( QFile::encodeName(cmdline) ) == 0 );
394 break;
395
396
385 default: 397 default:
386 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { 398 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
387 FLITE_IN bl; 399 FLITE_IN bl;
388 bl. mode = 1; 400 bl. mode = 1;
389 bl. pwr = bright ? 1 : 0; 401 bl. pwr = bright ? 1 : 0;
390 bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255; 402 bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255;
391 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 403 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
392 ::close ( fd ); 404 ::close ( fd );
393 } 405 }
394 } 406 }
395 return res; 407 return res;
396} 408}
397 409
398int iPAQ::displayBrightnessResolution() const 410int iPAQ::displayBrightnessResolution() const
399{ 411{
400 switch ( model()) { 412 switch ( model()) {
401 case Model_iPAQ_H31xx: 413 case Model_iPAQ_H31xx:
402 case Model_iPAQ_H36xx: 414 case Model_iPAQ_H36xx:
403 case Model_iPAQ_H37xx: 415 case Model_iPAQ_H37xx:
404 return 128; // really 256, but >128 could damage the LCD 416 return 128; // really 256, but >128 could damage the LCD
405 417
406 case Model_iPAQ_H38xx: 418 case Model_iPAQ_H38xx:
407 case Model_iPAQ_H39xx: 419 case Model_iPAQ_H39xx:
408 return 64; 420 return 64;
409 case Model_iPAQ_H5xxx: 421 case Model_iPAQ_H5xxx:
422 case Model_iPAQ_HX4700:
410 return 255; 423 return 255;
411 case Model_iPAQ_H191x: 424 case Model_iPAQ_H191x:
412 return 7; 425 return 7;
413 case Model_iPAQ_H1940: 426 case Model_iPAQ_H1940:
414 return 44; 427 return 44;
415 default: 428 default:
416 return 2; 429 return 2;
417 } 430 }
418} 431}
419 432
420bool iPAQ::setDisplayStatus ( bool on ) 433bool iPAQ::setDisplayStatus ( bool on )
421{ 434{
422 bool res = false; 435 bool res = false;
423 436
424 QString cmdline; 437 QString cmdline;
425 438
426 if ( model() == Model_iPAQ_H191x ) { 439 if ( model() == Model_iPAQ_H191x ) {
427 cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/pxafb/power; echo %2 > /sys/class/backlight/pxafb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); 440 cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/pxafb/power; echo %2 > /sys/class/backlight/pxafb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" );
428 } else { 441 } else {
429 return OAbstractMobileDevice::setDisplayStatus(on); 442 return OAbstractMobileDevice::setDisplayStatus(on);
430 } 443 }
431 444
432 res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); 445 res = ( ::system( QFile::encodeName(cmdline) ) == 0 );
433 446
434 return res; 447 return res;
435} 448}
436 449
437bool iPAQ::hasLightSensor() const 450bool iPAQ::hasLightSensor() const
438{ 451{
439 return true; 452 return true;
440} 453}
441 454
442int iPAQ::readLightSensor() 455int iPAQ::readLightSensor()
443{ 456{
444 int fd; 457 int fd;
445 int val = -1; 458 int val = -1;
446 459
447 if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { 460 if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) {
448 char buffer [8]; 461 char buffer [8];
449 462
450 if ( ::read ( fd, buffer, 5 ) == 5 ) { 463 if ( ::read ( fd, buffer, 5 ) == 5 ) {
451 char *endptr; 464 char *endptr;
452 465
453 buffer [4] = 0; 466 buffer [4] = 0;
454 val = ::strtol ( buffer + 2, &endptr, 16 ); 467 val = ::strtol ( buffer + 2, &endptr, 16 );
455 468
456 if ( *endptr != 0 ) 469 if ( *endptr != 0 )
457 val = -1; 470 val = -1;