summaryrefslogtreecommitdiff
authorkergoth <kergoth>2002-09-27 23:35:30 (UTC)
committer kergoth <kergoth>2002-09-27 23:35:30 (UTC)
commit996c0d02d16c185acc3190baa5b4a1fc934e730c (patch) (unidiff)
tree837e0d9f0fef522964d28e3e841686d63521dadd
parentd7bcdda1857ff31830705921d8248200d881cf93 (diff)
downloadopie-996c0d02d16c185acc3190baa5b4a1fc934e730c.zip
opie-996c0d02d16c185acc3190baa5b4a1fc934e730c.tar.gz
opie-996c0d02d16c185acc3190baa5b4a1fc934e730c.tar.bz2
Check for /etc/oz_version.. tired of seeing OpenZaurus v0.0 in opie-login.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 9871e80..3bc1e0c 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -488,134 +488,142 @@ bool ODeviceIPAQ::setPowerButtonHandler ( ODevice::PowerButtonHandler p )
488 ::close ( fd ); 488 ::close ( fd );
489 } 489 }
490 else 490 else
491 ::perror ( "/proc/sys/ts/suspend_button_mode" ); 491 ::perror ( "/proc/sys/ts/suspend_button_mode" );
492 492
493 return res; 493 return res;
494} 494}
495 495
496 496
497bool ODeviceIPAQ::setDisplayBrightness ( int bright ) 497bool ODeviceIPAQ::setDisplayBrightness ( int bright )
498{ 498{
499 bool res = false; 499 bool res = false;
500 int fd; 500 int fd;
501 501
502 if ( bright > 255 ) 502 if ( bright > 255 )
503 bright = 255; 503 bright = 255;
504 if ( bright < 0 ) 504 if ( bright < 0 )
505 bright = 0; 505 bright = 0;
506 506
507 // 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
508 508
509 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
510 //bright = ( bright + 1 ) / 2; 510 //bright = ( bright + 1 ) / 2;
511 511
512 if ((( fd = ::open ( "/dev/ts", O_WRONLY )) >= 0 ) || 512 if ((( fd = ::open ( "/dev/ts", O_WRONLY )) >= 0 ) ||
513 (( fd = ::open ( "/dev/h3600_ts", O_WRONLY )) >= 0 )) { 513 (( fd = ::open ( "/dev/h3600_ts", O_WRONLY )) >= 0 )) {
514 FLITE_IN bl; 514 FLITE_IN bl;
515 bl. mode = 1; 515 bl. mode = 1;
516 bl. pwr = bright ? 1 : 0; 516 bl. pwr = bright ? 1 : 0;
517 bl. brightness = bright; 517 bl. brightness = bright;
518 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 518 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
519 ::close ( fd ); 519 ::close ( fd );
520 } 520 }
521 return res; 521 return res;
522} 522}
523 523
524int ODeviceIPAQ::displayBrightnessResolution ( ) const 524int ODeviceIPAQ::displayBrightnessResolution ( ) const
525{ 525{
526 return 255; // really 128, but logarithmic control is smoother this way 526 return 255; // really 128, but logarithmic control is smoother this way
527} 527}
528 528
529 529
530/************************************************** 530/**************************************************
531 * 531 *
532 * Zaurus 532 * Zaurus
533 * 533 *
534 **************************************************/ 534 **************************************************/
535 535
536 536
537 537
538void ODeviceZaurus::init ( ) 538void ODeviceZaurus::init ( )
539{ 539{
540 d-> m_modelstr = "Zaurus SL5000"; 540 d-> m_modelstr = "Zaurus SL5000";
541 d-> m_model = OMODEL_Zaurus_SL5000; 541 d-> m_model = OMODEL_Zaurus_SL5000;
542 d-> m_vendorstr = "Sharp"; 542 d-> m_vendorstr = "Sharp";
543 d-> m_vendor = OVENDOR_Sharp; 543 d-> m_vendor = OVENDOR_Sharp;
544 544
545 QFile f ( "/proc/filesystems" ); 545 QFile f ( "/proc/filesystems" );
546 546
547 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 )) {
548 d-> m_systemstr = "OpenZaurus"; 548 d-> m_systemstr = "OpenZaurus";
549 d-> m_system = OSYSTEM_OpenZaurus; 549 d-> m_system = OSYSTEM_OpenZaurus;
550 550
551 f. close ( ); 551 f. close ( );
552
553 f. setName ( "/etc/oz_version" );
554 if ( f. open ( IO_ReadOnly )) {
555 QTextStream ts ( &f );
556 d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
557 f. close ( );
558 }
552 } 559 }
553 else { 560 else {
554 d-> m_systemstr = "Zaurus"; 561 d-> m_systemstr = "Zaurus";
555 d-> m_system = OSYSTEM_Zaurus; 562 d-> m_system = OSYSTEM_Zaurus;
556 } 563 }
557 564
565
558 d-> m_leds [0] = OLED_Off; 566 d-> m_leds [0] = OLED_Off;
559} 567}
560 568
561#include <unistd.h> 569#include <unistd.h>
562#include <fcntl.h> 570#include <fcntl.h>
563#include <sys/ioctl.h> 571#include <sys/ioctl.h>
564 572
565//#include <asm/sharp_char.h> // including kernel headers is evil ... 573//#include <asm/sharp_char.h> // including kernel headers is evil ...
566 574
567#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 575#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
568 576
569 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 577 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
570#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 578#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
571 579
572#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 580#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
573#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 581#define SHARP_BUZ_KEYSOUND 2 /* key sound */
574#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 582#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
575 583
576/* --- for SHARP_BUZZER device --- */ 584/* --- for SHARP_BUZZER device --- */
577 585
578 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 586 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
579//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 587//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
580 588
581#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) 589#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
582#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 590#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
583#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 591#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
584#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 592#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
585#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 593#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
586 594
587//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 595//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
588//#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 596//#define SHARP_BUZ_KEYSOUND 2 /* key sound */
589 597
590//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ 598//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */
591//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ 599//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */
592//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ 600//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */
593//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ 601//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */
594//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ 602//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */
595//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ 603//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */
596//#define SHARP_PDA_APPSTART 9 /* application start */ 604//#define SHARP_PDA_APPSTART 9 /* application start */
597//#define SHARP_PDA_APPQUIT 10 /* application ends */ 605//#define SHARP_PDA_APPQUIT 10 /* application ends */
598 606
599//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 607//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
600//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ 608//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */
601//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ 609//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */
602//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ 610//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */
603// 611//
604 612
605 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 613 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
606#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) 614#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1)
607 615
608typedef struct sharp_led_status { 616typedef struct sharp_led_status {
609 int which; /* select which LED status is wanted. */ 617 int which; /* select which LED status is wanted. */
610 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 618 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
611} sharp_led_status; 619} sharp_led_status;
612 620
613#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ 621#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */
614 622
615#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ 623#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */
616#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ 624#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */
617#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ 625#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */
618 626
619// #include <asm/sharp_apm.h> // including kernel headers is evil ... 627// #include <asm/sharp_apm.h> // including kernel headers is evil ...
620 628
621#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) 629#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int )