summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 269f6c9..d3ab63a 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -243,400 +243,400 @@ void Zaurus::initButtons()
243 b.setKeycode( zb->code ); 243 b.setKeycode( zb->code );
244 b.setUserText( QObject::tr( "Button", zb->utext )); 244 b.setUserText( QObject::tr( "Button", zb->utext ));
245 b.setPixmap( Resource::loadPixmap( zb->pix )); 245 b.setPixmap( Resource::loadPixmap( zb->pix ));
246 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); 246 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction ));
247 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); 247 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction ));
248 d->m_buttons->append( b ); 248 d->m_buttons->append( b );
249 } 249 }
250 250
251 reloadButtonMapping(); 251 reloadButtonMapping();
252} 252}
253 253
254 254
255 255
256typedef struct sharp_led_status { 256typedef struct sharp_led_status {
257 int which; /* select which LED status is wanted. */ 257 int which; /* select which LED status is wanted. */
258 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 258 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
259} sharp_led_status; 259} sharp_led_status;
260 260
261void Zaurus::buzzer( int sound ) 261void Zaurus::buzzer( int sound )
262{ 262{
263#ifndef QT_NO_SOUND 263#ifndef QT_NO_SOUND
264 Sound *snd = 0; 264 Sound *snd = 0;
265 265
266 // All devices except SL5500 have a DSP device 266 // All devices except SL5500 have a DSP device
267 if ( d->m_model != Model_Zaurus_SL5000 267 if ( d->m_model != Model_Zaurus_SL5000
268 && d->m_model != Model_Zaurus_SL5500 ) { 268 && d->m_model != Model_Zaurus_SL5500 ) {
269 269
270 switch ( sound ){ 270 switch ( sound ){
271 case SHARP_BUZ_TOUCHSOUND: { 271 case SHARP_BUZ_TOUCHSOUND: {
272 static Sound touch_sound("touchsound"); 272 static Sound touch_sound("touchsound");
273 snd = &touch_sound; 273 snd = &touch_sound;
274 } 274 }
275 break; 275 break;
276 case SHARP_BUZ_KEYSOUND: { 276 case SHARP_BUZ_KEYSOUND: {
277 static Sound key_sound( "keysound" ); 277 static Sound key_sound( "keysound" );
278 snd = &key_sound; 278 snd = &key_sound;
279 } 279 }
280 break; 280 break;
281 case SHARP_BUZ_SCHEDULE_ALARM: 281 case SHARP_BUZ_SCHEDULE_ALARM:
282 default: { 282 default: {
283 static Sound alarm_sound("alarm"); 283 static Sound alarm_sound("alarm");
284 snd = &alarm_sound; 284 snd = &alarm_sound;
285 } 285 }
286 break; 286 break;
287 } 287 }
288 } 288 }
289 289
290 // If a soundname is defined, we expect that this device has 290 // If a soundname is defined, we expect that this device has
291 // sound capabilities.. Otherwise we expect to have the buzzer 291 // sound capabilities.. Otherwise we expect to have the buzzer
292 // device.. 292 // device..
293 if ( snd && snd->isFinished() ){ 293 if ( snd && snd->isFinished() ){
294 changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); 294 changeMixerForAlarm( 0, "/dev/sound/mixer", snd );
295 snd->play(); 295 snd->play();
296 } else if( !snd ) { 296 } else if( !snd ) {
297 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); 297 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
298 298
299 if ( fd >= 0 ) { 299 if ( fd >= 0 ) {
300 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 300 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
301 ::close ( fd ); 301 ::close ( fd );
302 } 302 }
303 303
304 } 304 }
305#endif 305#endif
306} 306}
307 307
308 308
309void Zaurus::playAlarmSound() 309void Zaurus::playAlarmSound()
310{ 310{
311 buzzer( SHARP_BUZ_SCHEDULE_ALARM ); 311 buzzer( SHARP_BUZ_SCHEDULE_ALARM );
312} 312}
313 313
314void Zaurus::playTouchSound() 314void Zaurus::playTouchSound()
315{ 315{
316 buzzer( SHARP_BUZ_TOUCHSOUND ); 316 buzzer( SHARP_BUZ_TOUCHSOUND );
317} 317}
318 318
319void Zaurus::playKeySound() 319void Zaurus::playKeySound()
320{ 320{
321 buzzer( SHARP_BUZ_KEYSOUND ); 321 buzzer( SHARP_BUZ_KEYSOUND );
322} 322}
323 323
324 324
325QValueList <OLed> Zaurus::ledList() const 325QValueList <OLed> Zaurus::ledList() const
326{ 326{
327 QValueList <OLed> vl; 327 QValueList <OLed> vl;
328 vl << Led_Mail; 328 vl << Led_Mail;
329 return vl; 329 return vl;
330} 330}
331 331
332QValueList <OLedState> Zaurus::ledStateList( OLed l ) const 332QValueList <OLedState> Zaurus::ledStateList( OLed l ) const
333{ 333{
334 QValueList <OLedState> vl; 334 QValueList <OLedState> vl;
335 335
336 if ( l == Led_Mail ) 336 if ( l == Led_Mail )
337 vl << Led_Off << Led_On << Led_BlinkSlow; 337 vl << Led_Off << Led_On << Led_BlinkSlow;
338 return vl; 338 return vl;
339} 339}
340 340
341OLedState Zaurus::ledState( OLed which ) const 341OLedState Zaurus::ledState( OLed which ) const
342{ 342{
343 if ( which == Led_Mail ) 343 if ( which == Led_Mail )
344 return m_leds [0]; 344 return m_leds [0];
345 else 345 else
346 return Led_Off; 346 return Led_Off;
347} 347}
348 348
349bool Zaurus::setLedState( OLed which, OLedState st ) 349bool Zaurus::setLedState( OLed which, OLedState st )
350{ 350{
351 // Currently not supported on non_embedix kernels 351 // Currently not supported on non_embedix kernels
352 if (!m_embedix) 352 if (!m_embedix)
353 { 353 {
354 qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" ); 354 qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" );
355 return false; 355 return false;
356 } 356 }
357 357
358 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 358 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
359 359
360 if ( which == Led_Mail ) { 360 if ( which == Led_Mail ) {
361 if ( fd >= 0 ) { 361 if ( fd >= 0 ) {
362 struct sharp_led_status leds; 362 struct sharp_led_status leds;
363 ::memset ( &leds, 0, sizeof( leds )); 363 ::memset ( &leds, 0, sizeof( leds ));
364 leds. which = SHARP_LED_MAIL_EXISTS; 364 leds. which = SHARP_LED_MAIL_EXISTS;
365 bool ok = true; 365 bool ok = true;
366 366
367 switch ( st ) { 367 switch ( st ) {
368 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; 368 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break;
369 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; 369 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break;
370 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; 370 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break;
371 default : ok = false; 371 default : ok = false;
372 } 372 }
373 373
374 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { 374 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) {
375 m_leds [0] = st; 375 m_leds [0] = st;
376 return true; 376 return true;
377 } 377 }
378 } 378 }
379 } 379 }
380 return false; 380 return false;
381} 381}
382 382
383bool Zaurus::setSoftSuspend ( bool soft ) 383bool Zaurus::setSoftSuspend ( bool soft )
384{ 384{
385 if (!m_embedix) { 385 if (!m_embedix) {
386 /* non-Embedix kernels dont have kernel autosuspend */ 386 /* non-Embedix kernels dont have kernel autosuspend */
387 return ODevice::setSoftSuspend( soft ); 387 return ODevice::setSoftSuspend( soft );
388 } 388 }
389 389
390 bool res = false; 390 bool res = false;
391 int fd; 391 int fd;
392 392
393 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || 393 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) ||
394 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { 394 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) {
395 395
396 int sources = ::ioctl( fd, APM_IOCGEVTSRC, 0 ); // get current event sources 396 int sources = ::ioctl( fd, APM_IOCGEVTSRC, 0 ); // get current event sources
397 397
398 if ( sources >= 0 ) { 398 if ( sources >= 0 ) {
399 if ( soft ) 399 if ( soft )
400 sources &= ~APM_EVT_POWER_BUTTON; 400 sources &= ~APM_EVT_POWER_BUTTON;
401 else 401 else
402 sources |= APM_EVT_POWER_BUTTON; 402 sources |= APM_EVT_POWER_BUTTON;
403 403
404 if ( ::ioctl( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources 404 if ( ::ioctl( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources
405 res = true; 405 res = true;
406 else 406 else
407 perror ( "APM_IOCGEVTSRC" ); 407 perror ( "APM_IOCGEVTSRC" );
408 } 408 }
409 else 409 else
410 perror ( "APM_IOCGEVTSRC" ); 410 perror ( "APM_IOCGEVTSRC" );
411 411
412 ::close( fd ); 412 ::close( fd );
413 } 413 }
414 else 414 else
415 perror( "/dev/apm_bios or /dev/misc/apm_bios" ); 415 perror( "/dev/apm_bios or /dev/misc/apm_bios" );
416 416
417 return res; 417 return res;
418} 418}
419 419
420int Zaurus::displayBrightnessResolution() const 420int Zaurus::displayBrightnessResolution() const
421{ 421{
422 int res = 1; 422 int res = 1;
423 if (m_embedix) 423 if (m_embedix)
424 { 424 {
425 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); 425 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK );
426 if ( fd ) 426 if ( fd )
427 { 427 {
428 int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); 428 int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 );
429 ::close( fd ); 429 ::close( fd );
430 return value ? value : res; 430 return value ? value : res;
431 } 431 }
432 } 432 }
433 else 433 else
434 { 434 {
435 int fd = ::open( "/sys/class/backlight/corgi-bl/max_brightness", O_RDONLY|O_NONBLOCK ); 435 int fd = ::open( "/sys/class/backlight/corgi-bl/max_brightness", O_RDONLY|O_NONBLOCK );
436 if ( fd ) 436 if ( fd )
437 { 437 {
438 char buf[100]; 438 char buf[100];
439 if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); 439 if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res );
440 ::close( fd ); 440 ::close( fd );
441 } 441 }
442 } 442 }
443 return res; 443 return res;
444} 444}
445 445
446bool Zaurus::setDisplayBrightness( int bright ) 446bool Zaurus::setDisplayBrightness( int bright )
447{ 447{
448 //qDebug( "Zaurus::setDisplayBrightness( %d )", bright ); 448 //qDebug( "Zaurus::setDisplayBrightness( %d )", bright );
449 bool res = false; 449 bool res = false;
450 450
451 if ( bright > 255 ) bright = 255; 451 if ( bright > 255 ) bright = 255;
452 if ( bright < 0 ) bright = 0; 452 if ( bright < 0 ) bright = 0;
453 453
454 int numberOfSteps = displayBrightnessResolution(); 454 int numberOfSteps = displayBrightnessResolution();
455 int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; 455 int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255;
456 456
457 if ( m_embedix ) 457 if ( m_embedix )
458 { 458 {
459 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); 459 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK );
460 if ( fd ) 460 if ( fd )
461 { 461 {
462 res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); 462 res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 );
463 ::close( fd ); 463 ::close( fd );
464 } 464 }
465 } 465 }
466 else 466 else
467 { 467 {
468 int fd = ::open( "/sys/class/backlight/corgi-bl/brightness", O_WRONLY|O_NONBLOCK ); 468 int fd = ::open( "/sys/class/backlight/corgi-bl/brightness", O_WRONLY|O_NONBLOCK );
469 if ( fd ) 469 if ( fd )
470 { 470 {
471 char buf[100]; 471 char buf[100];
472 int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); 472 int len = ::snprintf( &buf[0], sizeof buf, "%d", val );
473 res = ( ::write( fd, &buf[0], len ) == 0 ); 473 res = ( ::write( fd, &buf[0], len ) == 0 );
474 ::close( fd ); 474 ::close( fd );
475 } 475 }
476 } 476 }
477 return res; 477 return res;
478} 478}
479 479
480bool Zaurus::setDisplayStatus( bool on ) 480bool Zaurus::setDisplayStatus( bool on )
481{ 481{
482 bool res = false; 482 bool res = false;
483 if ( m_embedix ) 483 if ( m_embedix )
484 { 484 {
485 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); 485 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK );
486 if ( fd ) 486 if ( fd )
487 { 487 {
488 int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; 488 int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF;
489 res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); 489 res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 );
490 ::close ( fd ); 490 ::close ( fd );
491 } 491 }
492 } 492 }
493 else 493 else
494 { 494 {
495 int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK ); 495 int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK );
496 if ( fd ) 496 if ( fd )
497 { 497 {
498 char buf[10]; 498 char buf[10];
499 buf[0] = on ? '0' : '1'; 499 buf[0] = on ? '1' : '0';
500 buf[1] = '\0'; 500 buf[1] = '\0';
501 res = ( ::write( fd, &buf[0], 2 ) == 0 ); 501 res = ( ::write( fd, &buf[0], 2 ) == 0 );
502 ::close( fd ); 502 ::close( fd );
503 } 503 }
504 } 504 }
505 return res; 505 return res;
506} 506}
507 507
508bool Zaurus::suspend() 508bool Zaurus::suspend()
509{ 509{
510 qDebug("ODevice::suspend"); 510 qDebug("ODevice::suspend");
511 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 511 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
512 return false; 512 return false;
513 513
514 if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices 514 if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
515 return false; 515 return false;
516 516
517 bool res = false; 517 bool res = false;
518 ODevice::sendSuspendmsg(); 518 ODevice::sendSuspendmsg();
519 519
520 struct timeval tvs, tvn; 520 struct timeval tvs, tvn;
521 ::gettimeofday ( &tvs, 0 ); 521 ::gettimeofday ( &tvs, 0 );
522 522
523 ::sync(); // flush fs caches 523 ::sync(); // flush fs caches
524 res = ( ::system ( "apm --suspend" ) == 0 ); 524 res = ( ::system ( "apm --suspend" ) == 0 );
525 525
526 // This is needed because the apm implementation is asynchronous and we 526 // This is needed because the apm implementation is asynchronous and we
527 // can not be sure when exactly the device is really suspended 527 // can not be sure when exactly the device is really suspended
528 if ( res ) { 528 if ( res ) {
529 do { // Yes, wait 15 seconds. This APM sucks big time. 529 do { // Yes, wait 15 seconds. This APM sucks big time.
530 ::usleep ( 200 * 1000 ); 530 ::usleep ( 200 * 1000 );
531 ::gettimeofday ( &tvn, 0 ); 531 ::gettimeofday ( &tvn, 0 );
532 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 ); 532 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 );
533 } 533 }
534 534
535 QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); 535 QCopEnvelope ( "QPE/Rotation", "rotateDefault()" );
536 return res; 536 return res;
537} 537}
538 538
539 539
540Transformation Zaurus::rotation() const 540Transformation Zaurus::rotation() const
541{ 541{
542 Transformation rot; 542 Transformation rot;
543 int handle = 0; 543 int handle = 0;
544 int retval = 0; 544 int retval = 0;
545 545
546 switch ( d->m_model ) { 546 switch ( d->m_model ) {
547 case Model_Zaurus_SLC3000: // fallthrough 547 case Model_Zaurus_SLC3000: // fallthrough
548 case Model_Zaurus_SLC7x0: 548 case Model_Zaurus_SLC7x0:
549 handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); 549 handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK);
550 if (handle == -1) { 550 if (handle == -1) {
551 return Rot270; 551 return Rot270;
552 } else { 552 } else {
553 retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); 553 retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION);
554 ::close (handle); 554 ::close (handle);
555 555
556 if (retval == 2 ) 556 if (retval == 2 )
557 rot = Rot0; 557 rot = Rot0;
558 else 558 else
559 rot = Rot270; 559 rot = Rot270;
560 } 560 }
561 break; 561 break;
562 case Model_Zaurus_SL6000: 562 case Model_Zaurus_SL6000:
563 case Model_Zaurus_SLB600: 563 case Model_Zaurus_SLB600:
564 case Model_Zaurus_SLA300: 564 case Model_Zaurus_SLA300:
565 case Model_Zaurus_SL5500: 565 case Model_Zaurus_SL5500:
566 case Model_Zaurus_SL5000: 566 case Model_Zaurus_SL5000:
567 default: 567 default:
568 rot = d->m_rotation; 568 rot = d->m_rotation;
569 break; 569 break;
570 } 570 }
571 571
572 return rot; 572 return rot;
573} 573}
574ODirection Zaurus::direction() const 574ODirection Zaurus::direction() const
575{ 575{
576 ODirection dir; 576 ODirection dir;
577 int handle = 0; 577 int handle = 0;
578 int retval = 0; 578 int retval = 0;
579 switch ( d->m_model ) { 579 switch ( d->m_model ) {
580 case Model_Zaurus_SLC3000: // fallthrough 580 case Model_Zaurus_SLC3000: // fallthrough
581 case Model_Zaurus_SLC7x0: 581 case Model_Zaurus_SLC7x0:
582 handle = ::open( "/dev/apm_bios", O_RDWR|O_NONBLOCK ); 582 handle = ::open( "/dev/apm_bios", O_RDWR|O_NONBLOCK );
583 if (handle == -1) { 583 if (handle == -1) {
584 dir = CW; 584 dir = CW;
585 } else { 585 } else {
586 retval = ::ioctl( handle, SHARP_IOCTL_GET_ROTATION ); 586 retval = ::ioctl( handle, SHARP_IOCTL_GET_ROTATION );
587 ::close (handle); 587 ::close (handle);
588 if (retval == 2 ) 588 if (retval == 2 )
589 dir = CCW; 589 dir = CCW;
590 else 590 else
591 dir = CW; 591 dir = CW;
592 } 592 }
593 break; 593 break;
594 case Model_Zaurus_SL6000: 594 case Model_Zaurus_SL6000:
595 case Model_Zaurus_SLA300: 595 case Model_Zaurus_SLA300:
596 case Model_Zaurus_SLB600: 596 case Model_Zaurus_SLB600:
597 case Model_Zaurus_SL5500: 597 case Model_Zaurus_SL5500:
598 case Model_Zaurus_SL5000: 598 case Model_Zaurus_SL5000:
599 default: dir = d->m_direction; 599 default: dir = d->m_direction;
600 break; 600 break;
601 } 601 }
602 return dir; 602 return dir;
603 603
604} 604}
605 605
606bool Zaurus::hasHingeSensor() const 606bool Zaurus::hasHingeSensor() const
607{ 607{
608 return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000; 608 return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000;
609} 609}
610 610
611OHingeStatus Zaurus::readHingeSensor() 611OHingeStatus Zaurus::readHingeSensor()
612{ 612{
613 if (m_embedix) 613 if (m_embedix)
614 { 614 {
615 int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); 615 int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK);
616 if (handle == -1) 616 if (handle == -1)
617 { 617 {
618 qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror 618 qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror
619 return CASE_UNKNOWN; 619 return CASE_UNKNOWN;
620 } 620 }
621 else 621 else
622 { 622 {
623 int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); 623 int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION);
624 ::close (handle); 624 ::close (handle);
625 if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE ) 625 if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE )
626 { 626 {
627 qDebug( "Zaurus::readHingeSensor() - result = %d", retval ); 627 qDebug( "Zaurus::readHingeSensor() - result = %d", retval );
628 return static_cast<OHingeStatus>( retval ); 628 return static_cast<OHingeStatus>( retval );
629 } 629 }
630 else 630 else
631 { 631 {
632 qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); 632 qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" );
633 return CASE_UNKNOWN; 633 return CASE_UNKNOWN;
634 } 634 }
635 } 635 }
636 } 636 }
637 else 637 else
638 { 638 {
639 qDebug( "Zaurus::readHingeSensor: ODevice handling for non-embedix kernels not yet implemented" ); 639 qDebug( "Zaurus::readHingeSensor: ODevice handling for non-embedix kernels not yet implemented" );
640 return CASE_UNKNOWN; 640 return CASE_UNKNOWN;
641 } 641 }
642} 642}