summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice_ipaq.cpp
Unidiff
Diffstat (limited to 'libopie2/opiecore/device/odevice_ipaq.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index 3cc6cec..52da2d9 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -130,59 +130,62 @@ struct i_button ipaq_buttons [] = {
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" )
155 d->m_model = Model_iPAQ_H1940;
154 else 156 else
155 d->m_model = Model_Unknown; 157 d->m_model = Model_Unknown;
156 158
157 switch ( d->m_model ) { 159 switch ( d->m_model ) {
158 case Model_iPAQ_H31xx: 160 case Model_iPAQ_H31xx:
159 case Model_iPAQ_H38xx: 161 case Model_iPAQ_H38xx:
160 d->m_rotation = Rot90; 162 d->m_rotation = Rot90;
161 break; 163 break;
162 case Model_iPAQ_H5xxx: 164 case Model_iPAQ_H5xxx:
163 case Model_iPAQ_H22xx: 165 case Model_iPAQ_H22xx:
164 case Model_iPAQ_H191x: 166 case Model_iPAQ_H191x:
167 case Model_iPAQ_H1940:
165 d->m_rotation = Rot0; 168 d->m_rotation = Rot0;
166 break; 169 break;
167 case Model_iPAQ_H36xx: 170 case Model_iPAQ_H36xx:
168 case Model_iPAQ_H37xx: 171 case Model_iPAQ_H37xx:
169 case Model_iPAQ_H39xx: 172 case Model_iPAQ_H39xx:
170 default: 173 default:
171 d->m_rotation = Rot270; 174 d->m_rotation = Rot270;
172 break; 175 break;
173 176
174 } 177 }
175 178
176 m_leds [0] = m_leds [1] = Led_Off; 179 m_leds [0] = m_leds [1] = Led_Off;
177 180
178 m_power_timer = 0; 181 m_power_timer = 0;
179 182
180} 183}
181 184
182void iPAQ::initButtons() 185void iPAQ::initButtons()
183{ 186{
184 if ( d->m_buttons ) 187 if ( d->m_buttons )
185 return; 188 return;
186 189
187 if ( isQWS( ) ) { 190 if ( isQWS( ) ) {
188 addPreHandler(this); 191 addPreHandler(this);
@@ -279,49 +282,50 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b
279 // H38xx/H39xx have no "Q" key anymore - this is now the Mail key 282 // H38xx/H39xx have no "Q" key anymore - this is now the Mail key
280 case HardKey_Menu: { 283 case HardKey_Menu: {
281 if (( d->m_model == Model_iPAQ_H38xx ) || 284 if (( d->m_model == Model_iPAQ_H38xx ) ||
282 ( d->m_model == Model_iPAQ_H39xx ) || 285 ( d->m_model == Model_iPAQ_H39xx ) ||
283 ( d->m_model == Model_iPAQ_H5xxx)) { 286 ( d->m_model == Model_iPAQ_H5xxx)) {
284 newkeycode = HardKey_Mail; 287 newkeycode = HardKey_Mail;
285 } 288 }
286 break; 289 break;
287 } 290 }
288 291
289 // Rotate cursor keys 180 or 270 292 // Rotate cursor keys 180 or 270
290 case Key_Left : 293 case Key_Left :
291 case Key_Right: 294 case Key_Right:
292 case Key_Up : 295 case Key_Up :
293 case Key_Down : { 296 case Key_Down : {
294 if (( d->m_model == Model_iPAQ_H31xx ) || 297 if (( d->m_model == Model_iPAQ_H31xx ) ||
295 ( d->m_model == Model_iPAQ_H38xx )) { 298 ( d->m_model == Model_iPAQ_H38xx )) {
296 newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; 299 newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4;
297 } 300 }
298 // Rotate the cursor keys by 270 301 // Rotate the cursor keys by 270
299 // keycode - Key_Left = position of the button starting from left clockwise 302 // keycode - Key_Left = position of the button starting from left clockwise
300 // add the rotation to it and modolo. No we've the original offset 303 // add the rotation to it and modolo. No we've the original offset
301 // add the offset to the Key_Left key 304 // add the offset to the Key_Left key
302 if (( d->m_model == Model_iPAQ_H5xxx ) || 305 if (( d->m_model == Model_iPAQ_H5xxx ) ||
303 ( d->m_model == Model_iPAQ_H191x )) 306 ( d->m_model == Model_iPAQ_H191x ) ||
307 ( d->m_model == Model_iPAQ_H1940 ))
304 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; 308 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4;
305 break; 309 break;
306 } 310 }
307 311
308 // map Power Button short/long press to F34/F35 312 // map Power Button short/long press to F34/F35
309 case Key_SysReq: { 313 case Key_SysReq: {
310 if ( isPress ) { 314 if ( isPress ) {
311 if ( m_power_timer ) 315 if ( m_power_timer )
312 killTimer ( m_power_timer ); 316 killTimer ( m_power_timer );
313 m_power_timer = startTimer ( 500 ); 317 m_power_timer = startTimer ( 500 );
314 } 318 }
315 else if ( m_power_timer ) { 319 else if ( m_power_timer ) {
316 killTimer ( m_power_timer ); 320 killTimer ( m_power_timer );
317 m_power_timer = 0; 321 m_power_timer = 0;
318 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); 322 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false );
319 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); 323 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false );
320 } 324 }
321 newkeycode = Key_unknown; 325 newkeycode = Key_unknown;
322 break; 326 break;
323 } 327 }
324 } 328 }
325 329
326 if ( newkeycode != keycode ) { 330 if ( newkeycode != keycode ) {
327 if ( newkeycode != Key_unknown ) 331 if ( newkeycode != Key_unknown )
@@ -381,48 +385,50 @@ bool iPAQ::setDisplayBrightness ( int bright )
381 bl. pwr = bright ? 1 : 0; 385 bl. pwr = bright ? 1 : 0;
382 bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255; 386 bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255;
383 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 387 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
384 ::close ( fd ); 388 ::close ( fd );
385 } 389 }
386 } 390 }
387 return res; 391 return res;
388} 392}
389 393
390int iPAQ::displayBrightnessResolution() const 394int iPAQ::displayBrightnessResolution() const
391{ 395{
392 switch ( model()) { 396 switch ( model()) {
393 case Model_iPAQ_H31xx: 397 case Model_iPAQ_H31xx:
394 case Model_iPAQ_H36xx: 398 case Model_iPAQ_H36xx:
395 case Model_iPAQ_H37xx: 399 case Model_iPAQ_H37xx:
396 return 128; // really 256, but >128 could damage the LCD 400 return 128; // really 256, but >128 could damage the LCD
397 401
398 case Model_iPAQ_H38xx: 402 case Model_iPAQ_H38xx:
399 case Model_iPAQ_H39xx: 403 case Model_iPAQ_H39xx:
400 return 64; 404 return 64;
401 case Model_iPAQ_H5xxx: 405 case Model_iPAQ_H5xxx:
402 return 255; 406 return 255;
403 case Model_iPAQ_H191x: 407 case Model_iPAQ_H191x:
404 return 183; 408 return 183;
409 case Model_iPAQ_H191x:
410 return 44;
405 default: 411 default:
406 return 2; 412 return 2;
407 } 413 }
408} 414}
409 415
410bool iPAQ::setDisplayStatus ( bool on ) 416bool iPAQ::setDisplayStatus ( bool on )
411{ 417{
412 bool res = false; 418 bool res = false;
413 419
414 QString cmdline; 420 QString cmdline;
415 421
416 if ( model() == Model_iPAQ_H191x ) { 422 if ( model() == Model_iPAQ_H191x ) {
417 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" ); 423 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" );
418 } else { 424 } else {
419 return OAbstractMobileDevice::setDisplayStatus(on); 425 return OAbstractMobileDevice::setDisplayStatus(on);
420 } 426 }
421 427
422 res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); 428 res = ( ::system( QFile::encodeName(cmdline) ) == 0 );
423 429
424 return res; 430 return res;
425} 431}
426 432
427bool iPAQ::hasLightSensor() const 433bool iPAQ::hasLightSensor() const
428{ 434{