summaryrefslogtreecommitdiff
path: root/libopie2
authormickeyl <mickeyl>2006-08-02 19:12:38 (UTC)
committer mickeyl <mickeyl>2006-08-02 19:12:38 (UTC)
commitcc2f5d3f3173be64d177ad827864b7da95343a1d (patch) (unidiff)
tree8c278fc6b108667e3fdc2b98d91dd5377756c95a /libopie2
parent3e77cb64e7ca0d89656e6665c1007bff6b34d609 (diff)
downloadopie-cc2f5d3f3173be64d177ad827864b7da95343a1d.zip
opie-cc2f5d3f3173be64d177ad827864b7da95343a1d.tar.gz
opie-cc2f5d3f3173be64d177ad827864b7da95343a1d.tar.bz2
improve ipaq 2200, 4xxx, 4700 support. patches courtesy R.Wagner, E.Hovland, P.Sokolovsky. thanks guys
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.h1
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp47
2 files changed, 42 insertions, 6 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index c2fa411..a8362cd 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -62,24 +62,25 @@ enum OModel {
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 Model_iPAQ_HX4700 = ( Model_iPAQ | 0x000A ), 73 Model_iPAQ_HX4700 = ( Model_iPAQ | 0x000A ),
74 Model_iPAQ_H4xxx = ( Model_iPAQ | 0x000b ),
74 Model_Jornada = ( 6 << 16 ), 75 Model_Jornada = ( 6 << 16 ),
75 Model_Jornada_56x = ( Model_Jornada | 0x0001 ), 76 Model_Jornada_56x = ( Model_Jornada | 0x0001 ),
76 Model_Jornada_720 = ( Model_Jornada | 0x0002 ), 77 Model_Jornada_720 = ( Model_Jornada | 0x0002 ),
77 Model_Jornada_820 = ( Model_Jornada | 0x0003 ), 78 Model_Jornada_820 = ( Model_Jornada | 0x0003 ),
78 79
79 Model_Zaurus = ( 2 << 16 ), 80 Model_Zaurus = ( 2 << 16 ),
80 81
81 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ), 82 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ),
82 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ), 83 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ),
83 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ), 84 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ),
84 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ), 85 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ),
85 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ), 86 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ),
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index 63b60a7..00939bf 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -76,66 +76,94 @@ typedef struct {
76} LED_IN; 76} LED_IN;
77 77
78typedef struct { 78typedef struct {
79 unsigned char mode; 79 unsigned char mode;
80 unsigned char pwr; 80 unsigned char pwr;
81 unsigned char brightness; 81 unsigned char brightness;
82} FLITE_IN; 82} FLITE_IN;
83 83
84#define LED_ON OD_IOW( 'f', 5, LED_IN ) 84#define LED_ON OD_IOW( 'f', 5, LED_IN )
85#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) 85#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
86 86
87struct i_button ipaq_buttons [] = { 87struct i_button ipaq_buttons [] = {
88 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx | Model_iPAQ_H191x, 88 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx | Model_iPAQ_H191x | Model_iPAQ_H22xx | Model_iPAQ_HX4700 | Model_iPAQ_H4xxx,
89 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 89 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
90 "devicebuttons/ipaq_calendar", 90 "devicebuttons/ipaq_calendar",
91 "datebook", "nextView()", 91 "datebook", "nextView()",
92 "today", "raise()" }, 92 "today", "raise()" },
93 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx | Model_iPAQ_H191x, 93 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx | Model_iPAQ_H191x | Model_iPAQ_H22xx | Model_iPAQ_HX4700 | Model_iPAQ_H4xxx,
94 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 94 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
95 "devicebuttons/ipaq_contact", 95 "devicebuttons/ipaq_contact",
96 "addressbook", "raise()", 96 "addressbook", "raise()",
97 "addressbook", "beamBusinessCard()" }, 97 "addressbook", "beamBusinessCard()" },
98 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, 98 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx,
99 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 99 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
100 "devicebuttons/ipaq_menu", 100 "devicebuttons/ipaq_menu",
101 "QPE/TaskBar", "toggleMenu()", 101 "QPE/TaskBar", "toggleMenu()",
102 "QPE/TaskBar", "toggleStartMenu()" }, 102 "QPE/TaskBar", "toggleStartMenu()" },
103 { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 103 { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
104 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 104 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
105 "devicebuttons/ipaq_mail", 105 "devicebuttons/ipaq_mail",
106 "opiemail", "raise()", 106 "opiemail", "raise()",
107 "opiemail", "newMail()" }, 107 "opiemail", "newMail()" },
108 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx | Model_iPAQ_H191x, 108 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx | Model_iPAQ_H191x | Model_iPAQ_H4xxx,
109 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 109 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
110 "devicebuttons/ipaq_home", 110 "devicebuttons/ipaq_home",
111 "QPE/Launcher", "home()", 111 "QPE/Launcher", "home()",
112 "buttonsettings", "raise()" }, 112 "buttonsettings", "raise()" },
113 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 113 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
114 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), 114 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
115 "devicebuttons/ipaq_record", 115 "devicebuttons/ipaq_record",
116 "QPE/VMemo", "toggleRecord()", 116 "QPE/VMemo", "toggleRecord()",
117 "sound", "raise()" }, 117 "sound", "raise()" },
118 118
119 { Model_iPAQ_H191x, 119 { Model_iPAQ_H191x | Model_iPAQ_H4xxx,
120 Qt::Key_F8, QT_TRANSLATE_NOOP("Button", "Mail Button"), 120 Qt::Key_F8, QT_TRANSLATE_NOOP("Button", "Mail Button"),
121 "devicebuttons/ipaq_mail", 121 "devicebuttons/ipaq_mail",
122 "opiemail", "raise()", 122 "opiemail", "raise()",
123 "opiemail", "newMail()" }, 123 "opiemail", "newMail()" },
124 { Model_iPAQ_H191x, 124 { Model_iPAQ_H191x | Model_iPAQ_H4xxx,
125 Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Record Button"), 125 Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Record Button"),
126 "devicebuttons/ipaq_record", 126 "devicebuttons/ipaq_record",
127 "QPE/VMemo", "toggleRecord()", 127 "QPE/VMemo", "toggleRecord()",
128 "sound", "raise()" }, 128 "sound", "raise()" },
129 129
130 //h2200 has different button mapping
131 { Model_iPAQ_H22xx,
132 Qt::Key_NumLock, QT_TRANSLATE_NOOP("Button", "Mail Button"),
133 "devicebuttons/ipaq_mail",
134 "opiemail", "raise()",
135 "opiemail", "newMail()" },
136 { Model_iPAQ_H22xx,
137 Qt::Key_ScrollLock, QT_TRANSLATE_NOOP("Button", "Menu Button"),
138 "devicebuttons/ipaq_menu",
139 "QPE/TaskBar", "toggleMenu()",
140 "QPE/TaskBar", "toggleStartMenu()" },
141 // and hx4700 has different button mapping still
142 { Model_iPAQ_HX4700,
143 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Mail Button"),
144 "devicebuttons/ipaq_mail",
145 "opiemail", "raise()",
146 "opiemail", "newMail()" },
147 { Model_iPAQ_HX4700,
148 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Record Button"),
149 "devicebuttons/ipaq_record",
150 "QPE/VMemo", "toggleRecord()",
151 "sound", "raise()" },
152 { Model_iPAQ_HX4700,
153 Qt::Key_Home, QT_TRANSLATE_NOOP("Button", "Home Button"),
154 "devicebuttons/ipaq_home",
155 "QPE/Launcher", "home()",
156 "buttonsettings", "raise()" },
157
130}; 158};
131 159
132void iPAQ::init(const QString& model) 160void iPAQ::init(const QString& model)
133{ 161{
134 d->m_vendorstr = "HP"; 162 d->m_vendorstr = "HP";
135 d->m_vendor = Vendor_HP; 163 d->m_vendor = Vendor_HP;
136 164
137 d->m_modelstr = model.mid(model.findRev('H')); 165 d->m_modelstr = model.mid(model.findRev('H'));
138 166
139 if ( d->m_modelstr == "H3100" ) 167 if ( d->m_modelstr == "H3100" )
140 d->m_model = Model_iPAQ_H31xx; 168 d->m_model = Model_iPAQ_H31xx;
141 else if ( d->m_modelstr == "H3600" ) 169 else if ( d->m_modelstr == "H3600" )
@@ -147,38 +175,41 @@ void iPAQ::init(const QString& model)
147 else if ( d->m_modelstr == "H3900" ) 175 else if ( d->m_modelstr == "H3900" )
148 d->m_model = Model_iPAQ_H39xx; 176 d->m_model = Model_iPAQ_H39xx;
149 else if ( d->m_modelstr == "H5400" ) 177 else if ( d->m_modelstr == "H5400" )
150 d->m_model = Model_iPAQ_H5xxx; 178 d->m_model = Model_iPAQ_H5xxx;
151 else if ( d->m_modelstr == "H2200" ) 179 else if ( d->m_modelstr == "H2200" )
152 d->m_model = Model_iPAQ_H22xx; 180 d->m_model = Model_iPAQ_H22xx;
153 else if ( d->m_modelstr == "H1910" ) 181 else if ( d->m_modelstr == "H1910" )
154 d->m_model = Model_iPAQ_H191x; 182 d->m_model = Model_iPAQ_H191x;
155 else if ( d->m_modelstr == "H1940" ) 183 else if ( d->m_modelstr == "H1940" )
156 d->m_model = Model_iPAQ_H1940; 184 d->m_model = Model_iPAQ_H1940;
157 else if ( d->m_modelstr == "HX4700" ) 185 else if ( d->m_modelstr == "HX4700" )
158 d->m_model = Model_iPAQ_HX4700; 186 d->m_model = Model_iPAQ_HX4700;
187 else if ( d->m_modelstr == "H4000" )
188 d->m_model = Model_iPAQ_H4xxx;
159 189
160 else 190 else
161 d->m_model = Model_Unknown; 191 d->m_model = Model_Unknown;
162 192
163 switch ( d->m_model ) { 193 switch ( d->m_model ) {
164 case Model_iPAQ_H31xx: 194 case Model_iPAQ_H31xx:
165 case Model_iPAQ_H38xx: 195 case Model_iPAQ_H38xx:
166 d->m_rotation = Rot90; 196 d->m_rotation = Rot90;
167 break; 197 break;
168 case Model_iPAQ_H5xxx: 198 case Model_iPAQ_H5xxx:
169 case Model_iPAQ_H22xx: 199 case Model_iPAQ_H22xx:
170 case Model_iPAQ_H191x: 200 case Model_iPAQ_H191x:
171 case Model_iPAQ_H1940: 201 case Model_iPAQ_H1940:
172 case Model_iPAQ_HX4700: 202 case Model_iPAQ_HX4700:
203 case Model_iPAQ_H4xxx:
173 d->m_rotation = Rot0; 204 d->m_rotation = Rot0;
174 break; 205 break;
175 case Model_iPAQ_H36xx: 206 case Model_iPAQ_H36xx:
176 case Model_iPAQ_H37xx: 207 case Model_iPAQ_H37xx:
177 case Model_iPAQ_H39xx: 208 case Model_iPAQ_H39xx:
178 default: 209 default:
179 d->m_rotation = Rot270; 210 d->m_rotation = Rot270;
180 break; 211 break;
181 212
182 } 213 }
183 214
184 m_leds [0] = m_leds [1] = Led_Off; 215 m_leds [0] = m_leds [1] = Led_Off;
@@ -300,32 +331,33 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b
300 case Key_Up : 331 case Key_Up :
301 case Key_Down : { 332 case Key_Down : {
302 if (( d->m_model == Model_iPAQ_H31xx ) || 333 if (( d->m_model == Model_iPAQ_H31xx ) ||
303 ( d->m_model == Model_iPAQ_H38xx )) { 334 ( d->m_model == Model_iPAQ_H38xx )) {
304 newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; 335 newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4;
305 } 336 }
306 // Rotate the cursor keys by 270 337 // Rotate the cursor keys by 270
307 // keycode - Key_Left = position of the button starting from left clockwise 338 // keycode - Key_Left = position of the button starting from left clockwise
308 // add the rotation to it and modolo. No we've the original offset 339 // add the rotation to it and modolo. No we've the original offset
309 // add the offset to the Key_Left key 340 // add the offset to the Key_Left key
310 if (( d->m_model == Model_iPAQ_H5xxx ) || 341 if (( d->m_model == Model_iPAQ_H5xxx ) ||
311 ( d->m_model == Model_iPAQ_H191x ) || 342 ( d->m_model == Model_iPAQ_H191x ) ||
343 ( d->m_model == Model_iPAQ_H4xxx ) ||
312 ( d->m_model == Model_iPAQ_H1940 )) 344 ( d->m_model == Model_iPAQ_H1940 ))
313 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; 345 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4;
314 break; 346 break;
315 } 347 }
316 348
317 // map Power Button short/long press to F6 for h191x 349 // map Power Button short/long press to F6 for h191x
318 case Key_F6: 350 case Key_F6:
319 if ( d->m_model != Model_iPAQ_H191x ) 351 if ( d->m_model != Model_iPAQ_H191x && d->m_model != Model_iPAQ_H4xxx )
320 break; 352 break;
321 // map Power Button short/long press to F34/F35 353 // map Power Button short/long press to F34/F35
322 case Key_SysReq: { 354 case Key_SysReq: {
323 if ( isPress ) { 355 if ( isPress ) {
324 if ( m_power_timer ) 356 if ( m_power_timer )
325 killTimer ( m_power_timer ); 357 killTimer ( m_power_timer );
326 m_power_timer = startTimer ( 500 ); 358 m_power_timer = startTimer ( 500 );
327 } 359 }
328 else if ( m_power_timer ) { 360 else if ( m_power_timer ) {
329 killTimer ( m_power_timer ); 361 killTimer ( m_power_timer );
330 m_power_timer = 0; 362 m_power_timer = 0;
331 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); 363 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false );
@@ -371,24 +403,25 @@ bool iPAQ::setDisplayBrightness ( int bright )
371 bool res = false; 403 bool res = false;
372 int fd; 404 int fd;
373 405
374 if ( bright > 255 ) 406 if ( bright > 255 )
375 bright = 255; 407 bright = 255;
376 if ( bright < 0 ) 408 if ( bright < 0 )
377 bright = 0; 409 bright = 0;
378 410
379 QString cmdline; 411 QString cmdline;
380 412
381 switch ( model()) { 413 switch ( model()) {
382 case Model_iPAQ_H191x: 414 case Model_iPAQ_H191x:
415 case Model_iPAQ_H4xxx:
383 { 416 {
384 QDir sysClass( "/sys/class/backlight/pxafb/" ); 417 QDir sysClass( "/sys/class/backlight/pxafb/" );
385 sysClass.setFilter(QDir::Dirs); 418 sysClass.setFilter(QDir::Dirs);
386 int fd; 419 int fd;
387 if ( sysClass.exists() ) { 420 if ( sysClass.exists() ) {
388 QString sysClassPath = sysClass.absFilePath( "/sys/class/backlight/pxafb/power" ); 421 QString sysClassPath = sysClass.absFilePath( "/sys/class/backlight/pxafb/power" );
389 fd = ::open( sysClassPath, O_WRONLY | O_NONBLOCK ); 422 fd = ::open( sysClassPath, O_WRONLY | O_NONBLOCK );
390 if ( fd ) { 423 if ( fd ) {
391 char buf[10]; 424 char buf[10];
392 buf[0] = bright ? 0 : 4; 425 buf[0] = bright ? 0 : 4;
393 buf[1] = '\0'; 426 buf[1] = '\0';
394 res = ( ::write( fd, &buf[0], 2 ) == 0 ); 427 res = ( ::write( fd, &buf[0], 2 ) == 0 );
@@ -430,24 +463,25 @@ int iPAQ::displayBrightnessResolution() const
430{ 463{
431 switch ( model()) { 464 switch ( model()) {
432 case Model_iPAQ_H31xx: 465 case Model_iPAQ_H31xx:
433 case Model_iPAQ_H36xx: 466 case Model_iPAQ_H36xx:
434 case Model_iPAQ_H37xx: 467 case Model_iPAQ_H37xx:
435 return 128; // really 256, but >128 could damage the LCD 468 return 128; // really 256, but >128 could damage the LCD
436 469
437 case Model_iPAQ_H38xx: 470 case Model_iPAQ_H38xx:
438 case Model_iPAQ_H39xx: 471 case Model_iPAQ_H39xx:
439 return 64; 472 return 64;
440 case Model_iPAQ_H5xxx: 473 case Model_iPAQ_H5xxx:
441 case Model_iPAQ_HX4700: 474 case Model_iPAQ_HX4700:
475 case Model_iPAQ_H4xxx:
442 return 255; 476 return 255;
443 case Model_iPAQ_H191x: 477 case Model_iPAQ_H191x:
444 return 7; 478 return 7;
445 case Model_iPAQ_H1940: 479 case Model_iPAQ_H1940:
446 return 44; 480 return 44;
447 default: 481 default:
448 return 2; 482 return 2;
449 } 483 }
450} 484}
451 485
452bool iPAQ::setDisplayStatus ( bool on ) 486bool iPAQ::setDisplayStatus ( bool on )
453{ 487{
@@ -474,24 +508,25 @@ bool iPAQ::setDisplayStatus ( bool on )
474 return OAbstractMobileDevice::setDisplayStatus(on); 508 return OAbstractMobileDevice::setDisplayStatus(on);
475 } 509 }
476 510
477 res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); 511 res = ( ::system( QFile::encodeName(cmdline) ) == 0 );
478 512
479 return res; 513 return res;
480} 514}
481 515
482bool iPAQ::hasLightSensor() const 516bool iPAQ::hasLightSensor() const
483{ 517{
484 switch (model()) { 518 switch (model()) {
485 case Model_iPAQ_H191x: 519 case Model_iPAQ_H191x:
520 case Model_iPAQ_H4xxx:
486 return false; 521 return false;
487 default: 522 default:
488 return true; 523 return true;
489 } 524 }
490} 525}
491 526
492int iPAQ::readLightSensor() 527int iPAQ::readLightSensor()
493{ 528{
494 int fd; 529 int fd;
495 int val = -1; 530 int val = -1;
496 531
497 if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { 532 if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) {