-rw-r--r-- | libopie/odevice.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 7d8cdbf..25c9826 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -561,385 +561,385 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b | |||
561 | else if ( m_power_timer ) { | 561 | else if ( m_power_timer ) { |
562 | killTimer ( m_power_timer ); | 562 | killTimer ( m_power_timer ); |
563 | m_power_timer = 0; | 563 | m_power_timer = 0; |
564 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); | 564 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); |
565 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); | 565 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); |
566 | } | 566 | } |
567 | newkeycode = Key_unknown; | 567 | newkeycode = Key_unknown; |
568 | } | 568 | } |
569 | //nobreak; | 569 | //nobreak; |
570 | 570 | ||
571 | default: | 571 | default: |
572 | break; | 572 | break; |
573 | } | 573 | } |
574 | 574 | ||
575 | if ( newkeycode != keycode ) { | 575 | if ( newkeycode != keycode ) { |
576 | if ( newkeycode != Key_unknown ) | 576 | if ( newkeycode != Key_unknown ) |
577 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 577 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
578 | return true; | 578 | return true; |
579 | } | 579 | } |
580 | else | 580 | else |
581 | return false; | 581 | return false; |
582 | } | 582 | } |
583 | 583 | ||
584 | void iPAQ::timerEvent ( QTimerEvent * ) | 584 | void iPAQ::timerEvent ( QTimerEvent * ) |
585 | { | 585 | { |
586 | killTimer ( m_power_timer ); | 586 | killTimer ( m_power_timer ); |
587 | m_power_timer = 0; | 587 | m_power_timer = 0; |
588 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 588 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
589 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 589 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
590 | } | 590 | } |
591 | 591 | ||
592 | 592 | ||
593 | void iPAQ::alarmSound ( ) | 593 | void iPAQ::alarmSound ( ) |
594 | { | 594 | { |
595 | #if defined( QT_QWS_IPAQ ) // IPAQ | 595 | #if defined( QT_QWS_IPAQ ) // IPAQ |
596 | #ifndef QT_NO_SOUND | 596 | #ifndef QT_NO_SOUND |
597 | static Sound snd ( "alarm" ); | 597 | static Sound snd ( "alarm" ); |
598 | int fd; | 598 | int fd; |
599 | int vol; | 599 | int vol; |
600 | bool vol_reset = false; | 600 | bool vol_reset = false; |
601 | 601 | ||
602 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | 602 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { |
603 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | 603 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { |
604 | Config cfg ( "qpe" ); | 604 | Config cfg ( "qpe" ); |
605 | cfg. setGroup ( "Volume" ); | 605 | cfg. setGroup ( "Volume" ); |
606 | 606 | ||
607 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 607 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
608 | if ( volalarm < 0 ) | 608 | if ( volalarm < 0 ) |
609 | volalarm = 0; | 609 | volalarm = 0; |
610 | else if ( volalarm > 100 ) | 610 | else if ( volalarm > 100 ) |
611 | volalarm = 100; | 611 | volalarm = 100; |
612 | volalarm |= ( volalarm << 8 ); | 612 | volalarm |= ( volalarm << 8 ); |
613 | 613 | ||
614 | if (( volalarm & 0xff ) > ( vol & 0xff )) { | 614 | if (( volalarm & 0xff ) > ( vol & 0xff )) { |
615 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 615 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
616 | vol_reset = true; | 616 | vol_reset = true; |
617 | } | 617 | } |
618 | } | 618 | } |
619 | } | 619 | } |
620 | 620 | ||
621 | snd. play ( ); | 621 | snd. play ( ); |
622 | while ( !snd. isFinished ( )) | 622 | while ( !snd. isFinished ( )) |
623 | qApp-> processEvents ( ); | 623 | qApp-> processEvents ( ); |
624 | 624 | ||
625 | if ( fd >= 0 ) { | 625 | if ( fd >= 0 ) { |
626 | if ( vol_reset ) | 626 | if ( vol_reset ) |
627 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 627 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
628 | ::close ( fd ); | 628 | ::close ( fd ); |
629 | } | 629 | } |
630 | #endif | 630 | #endif |
631 | #endif | 631 | #endif |
632 | } | 632 | } |
633 | 633 | ||
634 | 634 | ||
635 | bool iPAQ::setSoftSuspend ( bool soft ) | 635 | bool iPAQ::setSoftSuspend ( bool soft ) |
636 | { | 636 | { |
637 | bool res = false; | 637 | bool res = false; |
638 | int fd; | 638 | int fd; |
639 | 639 | ||
640 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { | 640 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { |
641 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) | 641 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) |
642 | res = true; | 642 | res = true; |
643 | else | 643 | else |
644 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); | 644 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); |
645 | 645 | ||
646 | ::close ( fd ); | 646 | ::close ( fd ); |
647 | } | 647 | } |
648 | else | 648 | else |
649 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); | 649 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); |
650 | 650 | ||
651 | return res; | 651 | return res; |
652 | } | 652 | } |
653 | 653 | ||
654 | 654 | ||
655 | bool iPAQ::setDisplayBrightness ( int bright ) | 655 | bool iPAQ::setDisplayBrightness ( int bright ) |
656 | { | 656 | { |
657 | bool res = false; | 657 | bool res = false; |
658 | int fd; | 658 | int fd; |
659 | 659 | ||
660 | if ( bright > 255 ) | 660 | if ( bright > 255 ) |
661 | bright = 255; | 661 | bright = 255; |
662 | if ( bright < 0 ) | 662 | if ( bright < 0 ) |
663 | bright = 0; | 663 | bright = 0; |
664 | 664 | ||
665 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { | 665 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { |
666 | FLITE_IN bl; | 666 | FLITE_IN bl; |
667 | bl. mode = 1; | 667 | bl. mode = 1; |
668 | bl. pwr = bright ? 1 : 0; | 668 | bl. pwr = bright ? 1 : 0; |
669 | bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; | 669 | bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; |
670 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); | 670 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); |
671 | ::close ( fd ); | 671 | ::close ( fd ); |
672 | } | 672 | } |
673 | return res; | 673 | return res; |
674 | } | 674 | } |
675 | 675 | ||
676 | int iPAQ::displayBrightnessResolution ( ) const | 676 | int iPAQ::displayBrightnessResolution ( ) const |
677 | { | 677 | { |
678 | switch ( model ( )) { | 678 | switch ( model ( )) { |
679 | case Model_iPAQ_H31xx: | 679 | case Model_iPAQ_H31xx: |
680 | case Model_iPAQ_H36xx: | 680 | case Model_iPAQ_H36xx: |
681 | case Model_iPAQ_H37xx: | 681 | case Model_iPAQ_H37xx: |
682 | return 128; // really 256, but >128 could damage the LCD | 682 | return 128; // really 256, but >128 could damage the LCD |
683 | 683 | ||
684 | case Model_iPAQ_H38xx: | 684 | case Model_iPAQ_H38xx: |
685 | case Model_iPAQ_H39xx: | 685 | case Model_iPAQ_H39xx: |
686 | return 64; | 686 | return 64; |
687 | 687 | ||
688 | default: | 688 | default: |
689 | return 2; | 689 | return 2; |
690 | } | 690 | } |
691 | } | 691 | } |
692 | 692 | ||
693 | 693 | ||
694 | bool iPAQ::hasLightSensor ( ) const | 694 | bool iPAQ::hasLightSensor ( ) const |
695 | { | 695 | { |
696 | return true; | 696 | return true; |
697 | } | 697 | } |
698 | 698 | ||
699 | int iPAQ::readLightSensor ( ) | 699 | int iPAQ::readLightSensor ( ) |
700 | { | 700 | { |
701 | int fd; | 701 | int fd; |
702 | int val = -1; | 702 | int val = -1; |
703 | 703 | ||
704 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { | 704 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { |
705 | char buffer [8]; | 705 | char buffer [8]; |
706 | 706 | ||
707 | if ( ::read ( fd, buffer, 5 ) == 5 ) { | 707 | if ( ::read ( fd, buffer, 5 ) == 5 ) { |
708 | char *endptr; | 708 | char *endptr; |
709 | 709 | ||
710 | buffer [4] = 0; | 710 | buffer [4] = 0; |
711 | val = ::strtol ( buffer + 2, &endptr, 16 ); | 711 | val = ::strtol ( buffer + 2, &endptr, 16 ); |
712 | 712 | ||
713 | if ( *endptr != 0 ) | 713 | if ( *endptr != 0 ) |
714 | val = -1; | 714 | val = -1; |
715 | } | 715 | } |
716 | ::close ( fd ); | 716 | ::close ( fd ); |
717 | } | 717 | } |
718 | 718 | ||
719 | return val; | 719 | return val; |
720 | } | 720 | } |
721 | 721 | ||
722 | int iPAQ::lightSensorResolution ( ) const | 722 | int iPAQ::lightSensorResolution ( ) const |
723 | { | 723 | { |
724 | return 256; | 724 | return 256; |
725 | } | 725 | } |
726 | 726 | ||
727 | /************************************************** | 727 | /************************************************** |
728 | * | 728 | * |
729 | * Zaurus | 729 | * Zaurus |
730 | * | 730 | * |
731 | **************************************************/ | 731 | **************************************************/ |
732 | 732 | ||
733 | 733 | ||
734 | 734 | ||
735 | void Zaurus::init ( ) | 735 | void Zaurus::init ( ) |
736 | { | 736 | { |
737 | d-> m_modelstr = "Zaurus SL5000"; | 737 | d-> m_modelstr = "Zaurus SL5000"; |
738 | d-> m_model = Model_Zaurus_SL5000; | 738 | d-> m_model = Model_Zaurus_SL5000; |
739 | d-> m_vendorstr = "Sharp"; | 739 | d-> m_vendorstr = "Sharp"; |
740 | d-> m_vendor = Vendor_Sharp; | 740 | d-> m_vendor = Vendor_Sharp; |
741 | 741 | ||
742 | QFile f ( "/proc/filesystems" ); | 742 | QFile f ( "/proc/filesystems" ); |
743 | 743 | ||
744 | if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { | 744 | if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { |
745 | d-> m_systemstr = "OpenZaurus"; | 745 | d-> m_systemstr = "OpenZaurus"; |
746 | d-> m_system = System_OpenZaurus; | 746 | d-> m_system = System_OpenZaurus; |
747 | 747 | ||
748 | f. close ( ); | 748 | f. close ( ); |
749 | 749 | ||
750 | f. setName ( "/etc/oz_version" ); | 750 | f. setName ( "/etc/oz_version" ); |
751 | if ( f. open ( IO_ReadOnly )) { | 751 | if ( f. open ( IO_ReadOnly )) { |
752 | QTextStream ts ( &f ); | 752 | QTextStream ts ( &f ); |
753 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); | 753 | d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); |
754 | f. close ( ); | 754 | f. close ( ); |
755 | } | 755 | } |
756 | } | 756 | } |
757 | else { | 757 | else { |
758 | d-> m_systemstr = "Zaurus"; | 758 | d-> m_systemstr = "Zaurus"; |
759 | d-> m_system = System_Zaurus; | 759 | d-> m_system = System_Zaurus; |
760 | } | 760 | } |
761 | 761 | ||
762 | 762 | ||
763 | m_leds [0] = Led_Off; | 763 | m_leds [0] = Led_Off; |
764 | } | 764 | } |
765 | 765 | ||
766 | #include <unistd.h> | 766 | #include <unistd.h> |
767 | #include <fcntl.h> | 767 | #include <fcntl.h> |
768 | #include <sys/ioctl.h> | 768 | #include <sys/ioctl.h> |
769 | 769 | ||
770 | //#include <asm/sharp_char.h> // including kernel headers is evil ... | 770 | //#include <asm/sharp_char.h> // including kernel headers is evil ... |
771 | 771 | ||
772 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | 772 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 |
773 | 773 | ||
774 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 774 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
775 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 775 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
776 | 776 | ||
777 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 777 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
778 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 778 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
779 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 779 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
780 | 780 | ||
781 | /* --- for SHARP_BUZZER device --- */ | 781 | /* --- for SHARP_BUZZER device --- */ |
782 | 782 | ||
783 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 783 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
784 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 784 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
785 | 785 | ||
786 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | 786 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) |
787 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | 787 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) |
788 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | 788 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) |
789 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | 789 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) |
790 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | 790 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) |
791 | 791 | ||
792 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 792 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
793 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 793 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
794 | 794 | ||
795 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ | 795 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ |
796 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ | 796 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ |
797 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ | 797 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ |
798 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ | 798 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ |
799 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ | 799 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ |
800 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ | 800 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ |
801 | //#define SHARP_PDA_APPSTART 9 /* application start */ | 801 | //#define SHARP_PDA_APPSTART 9 /* application start */ |
802 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ | 802 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ |
803 | 803 | ||
804 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 804 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
805 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ | 805 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ |
806 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ | 806 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ |
807 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ | 807 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ |
808 | // | 808 | // |
809 | 809 | ||
810 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 810 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
811 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) | 811 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) |
812 | 812 | ||
813 | typedef struct sharp_led_status { | 813 | typedef struct sharp_led_status { |
814 | int which; /* select which LED status is wanted. */ | 814 | int which; /* select which LED status is wanted. */ |
815 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ | 815 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ |
816 | } sharp_led_status; | 816 | } sharp_led_status; |
817 | 817 | ||
818 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ | 818 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ |
819 | 819 | ||
820 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ | 820 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ |
821 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ | 821 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ |
822 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ | 822 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ |
823 | 823 | ||
824 | // #include <asm/sharp_apm.h> // including kernel headers is evil ... | 824 | // #include <asm/sharp_apm.h> // including kernel headers is evil ... |
825 | 825 | ||
826 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) | 826 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) |
827 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) | 827 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) |
828 | #define APM_EVT_POWER_BUTTON (1 << 0) | 828 | #define APM_EVT_POWER_BUTTON (1 << 0) |
829 | 829 | ||
830 | #define FL_IOCTL_STEP_CONTRAST 100 | 830 | #define FL_IOCTL_STEP_CONTRAST 100 |
831 | 831 | ||
832 | 832 | ||
833 | void Zaurus::buzzer ( int sound ) | 833 | void Zaurus::buzzer ( int sound ) |
834 | { | 834 | { |
835 | static int fd = ::open ( "/dev/sharp_buz", O_RDWR|O_NONBLOCK ); | 835 | static int fd = ::open ( "/dev/sharp_buz", O_RDWR|O_NONBLOCK ); |
836 | 836 | ||
837 | if ( fd >= 0 ) | 837 | if ( fd >= 0 ) |
838 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); | 838 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); |
839 | } | 839 | } |
840 | 840 | ||
841 | 841 | ||
842 | void Zaurus::alarmSound ( ) | 842 | void Zaurus::alarmSound ( ) |
843 | { | 843 | { |
844 | buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); | 844 | buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); |
845 | } | 845 | } |
846 | 846 | ||
847 | void Zaurus::touchSound ( ) | 847 | void Zaurus::touchSound ( ) |
848 | { | 848 | { |
849 | buzzer ( SHARP_BUZ_TOUCHSOUND ); | 849 | buzzer ( SHARP_BUZ_TOUCHSOUND ); |
850 | } | 850 | } |
851 | 851 | ||
852 | void Zaurus::keySound ( ) | 852 | void Zaurus::keySound ( ) |
853 | { | 853 | { |
854 | buzzer ( SHARP_BUZ_KEYSOUND ); | 854 | buzzer ( SHARP_BUZ_KEYSOUND ); |
855 | } | 855 | } |
856 | 856 | ||
857 | 857 | ||
858 | QValueList <OLed> Zaurus::ledList ( ) const | 858 | QValueList <OLed> Zaurus::ledList ( ) const |
859 | { | 859 | { |
860 | QValueList <OLed> vl; | 860 | QValueList <OLed> vl; |
861 | vl << Led_Mail; | 861 | vl << Led_Mail; |
862 | return vl; | 862 | return vl; |
863 | } | 863 | } |
864 | 864 | ||
865 | QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const | 865 | QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const |
866 | { | 866 | { |
867 | QValueList <OLedState> vl; | 867 | QValueList <OLedState> vl; |
868 | 868 | ||
869 | if ( l == Led_Mail ) | 869 | if ( l == Led_Mail ) |
870 | vl << Led_Off << Led_On << Led_BlinkSlow; | 870 | vl << Led_Off << Led_On << Led_BlinkSlow; |
871 | return vl; | 871 | return vl; |
872 | } | 872 | } |
873 | 873 | ||
874 | OLedState Zaurus::ledState ( OLed which ) const | 874 | OLedState Zaurus::ledState ( OLed which ) const |
875 | { | 875 | { |
876 | if ( which == Led_Mail ) | 876 | if ( which == Led_Mail ) |
877 | return m_leds [0]; | 877 | return m_leds [0]; |
878 | else | 878 | else |
879 | return Led_Off; | 879 | return Led_Off; |
880 | } | 880 | } |
881 | 881 | ||
882 | bool Zaurus::setLedState ( OLed which, OLedState st ) | 882 | bool Zaurus::setLedState ( OLed which, OLedState st ) |
883 | { | 883 | { |
884 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); | 884 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); |
885 | 885 | ||
886 | if ( which == Led_Mail ) { | 886 | if ( which == Led_Mail ) { |
887 | if ( fd >= 0 ) { | 887 | if ( fd >= 0 ) { |
888 | struct sharp_led_status leds; | 888 | struct sharp_led_status leds; |
889 | ::memset ( &leds, 0, sizeof( leds )); | 889 | ::memset ( &leds, 0, sizeof( leds )); |
890 | leds. which = SHARP_LED_MAIL_EXISTS; | 890 | leds. which = SHARP_LED_MAIL_EXISTS; |
891 | bool ok = true; | 891 | bool ok = true; |
892 | 892 | ||
893 | switch ( st ) { | 893 | switch ( st ) { |
894 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; | 894 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; |
895 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; | 895 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; |
896 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; | 896 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; |
897 | default : ok = false; | 897 | default : ok = false; |
898 | } | 898 | } |
899 | 899 | ||
900 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { | 900 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { |
901 | m_leds [0] = st; | 901 | m_leds [0] = st; |
902 | return true; | 902 | return true; |
903 | } | 903 | } |
904 | } | 904 | } |
905 | } | 905 | } |
906 | return false; | 906 | return false; |
907 | } | 907 | } |
908 | 908 | ||
909 | bool Zaurus::setSoftSuspend ( bool soft ) | 909 | bool Zaurus::setSoftSuspend ( bool soft ) |
910 | { | 910 | { |
911 | bool res = false; | 911 | bool res = false; |
912 | int fd; | 912 | int fd; |
913 | 913 | ||
914 | if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || | 914 | if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || |
915 | (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { | 915 | (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { |
916 | 916 | ||
917 | int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources | 917 | int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources |
918 | 918 | ||
919 | if ( sources >= 0 ) { | 919 | if ( sources >= 0 ) { |
920 | if ( soft ) | 920 | if ( soft ) |
921 | sources &= ~APM_EVT_POWER_BUTTON; | 921 | sources &= ~APM_EVT_POWER_BUTTON; |
922 | else | 922 | else |
923 | sources |= APM_EVT_POWER_BUTTON; | 923 | sources |= APM_EVT_POWER_BUTTON; |
924 | 924 | ||
925 | if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources | 925 | if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources |
926 | res = true; | 926 | res = true; |
927 | else | 927 | else |
928 | perror ( "APM_IOCGEVTSRC" ); | 928 | perror ( "APM_IOCGEVTSRC" ); |
929 | } | 929 | } |
930 | else | 930 | else |
931 | perror ( "APM_IOCGEVTSRC" ); | 931 | perror ( "APM_IOCGEVTSRC" ); |
932 | 932 | ||
933 | ::close ( fd ); | 933 | ::close ( fd ); |
934 | } | 934 | } |
935 | else | 935 | else |
936 | perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); | 936 | perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); |
937 | 937 | ||
938 | return res; | 938 | return res; |
939 | } | 939 | } |
940 | 940 | ||
941 | 941 | ||
942 | bool Zaurus::setDisplayBrightness ( int bright ) | 942 | bool Zaurus::setDisplayBrightness ( int bright ) |
943 | { | 943 | { |
944 | bool res = false; | 944 | bool res = false; |
945 | int fd; | 945 | int fd; |