author | sandman <sandman> | 2002-12-23 03:14:22 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-12-23 03:14:22 (UTC) |
commit | 8bd190d162b538e4226e830f442450f5a95f4434 (patch) (unidiff) | |
tree | 5a0cd0904b11b5d76a09de21db29d77abfe4b176 /libopie/odevice.cpp | |
parent | 726d2ac455446ee194c8e83df16f48357b619988 (diff) | |
download | opie-8bd190d162b538e4226e830f442450f5a95f4434.zip opie-8bd190d162b538e4226e830f442450f5a95f4434.tar.gz opie-8bd190d162b538e4226e830f442450f5a95f4434.tar.bz2 |
grrr .. somehow joe put a 'k' in the file
-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 a3c30cb..0e620ba 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -689,129 +689,129 @@ bool iPAQ::setLedState ( OLed l, OLedState st ) | |||
689 | leds. OffTime = 1; | 689 | leds. OffTime = 1; |
690 | leds. OffOnBlink = 2; | 690 | leds. OffOnBlink = 2; |
691 | 691 | ||
692 | switch ( st ) { | 692 | switch ( st ) { |
693 | case Led_Off : leds. OffOnBlink = 0; break; | 693 | case Led_Off : leds. OffOnBlink = 0; break; |
694 | case Led_On : leds. OffOnBlink = 1; break; | 694 | case Led_On : leds. OffOnBlink = 1; break; |
695 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; | 695 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; |
696 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; | 696 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; |
697 | } | 697 | } |
698 | 698 | ||
699 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { | 699 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { |
700 | m_leds [0] = st; | 700 | m_leds [0] = st; |
701 | return true; | 701 | return true; |
702 | } | 702 | } |
703 | } | 703 | } |
704 | } | 704 | } |
705 | return false; | 705 | return false; |
706 | } | 706 | } |
707 | 707 | ||
708 | 708 | ||
709 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 709 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
710 | { | 710 | { |
711 | int newkeycode = keycode; | 711 | int newkeycode = keycode; |
712 | 712 | ||
713 | switch ( keycode ) { | 713 | switch ( keycode ) { |
714 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key | 714 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key |
715 | case HardKey_Menu: { | 715 | case HardKey_Menu: { |
716 | if (( d-> m_model == Model_iPAQ_H38xx ) || | 716 | if (( d-> m_model == Model_iPAQ_H38xx ) || |
717 | ( d-> m_model == Model_iPAQ_H39xx )) { | 717 | ( d-> m_model == Model_iPAQ_H39xx )) { |
718 | newkeycode = HardKey_Mail; | 718 | newkeycode = HardKey_Mail; |
719 | } | 719 | } |
720 | break; | 720 | break; |
721 | } | 721 | } |
722 | 722 | ||
723 | // Rotate cursor keys 180° | 723 | // Rotate cursor keys 180° |
724 | case Key_Left : | 724 | case Key_Left : |
725 | case Key_Right: | 725 | case Key_Right: |
726 | case Key_Up : | 726 | case Key_Up : |
727 | case Key_Down : { | 727 | case Key_Down : { |
728 | if (( d-> m_model == Model_iPAQ_H31xx ) || | 728 | if (( d-> m_model == Model_iPAQ_H31xx ) || |
729 | ( d-> m_model == Model_iPAQ_H38xx )) { | 729 | ( d-> m_model == Model_iPAQ_H38xx )) { |
730 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; | 730 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; |
731 | } | 731 | } |
732 | break; | 732 | break; |
733 | } | 733 | } |
734 | 734 | ||
735 | // map Power Button short/long press to F34/F35 | 735 | // map Power Button short/long press to F34/F35 |
736 | case Key_SysReq: { | 736 | case Key_SysReq: { |
737 | if ( isPress ) { | 737 | if ( isPress ) { |
738 | if ( m_power_timer ) | 738 | if ( m_power_timer ) |
739 | killTimer ( m_power_timer ); | 739 | killTimer ( m_power_timer ); |
740 | m_power_timer = startTimer ( 500 ); | 740 | m_power_timer = startTimer ( 500 ); |
741 | } | 741 | } |
742 | else if ( m_power_timer ) { | 742 | else if ( m_power_timer ) { |
743 | killTimer ( m_power_timer ); | 743 | killTimer ( m_power_timer ); |
744 | m_power_timer = 0; | 744 | m_power_timer = 0; |
745 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); | 745 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); |
746 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); | 746 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); |
747 | } | 747 | } |
748 | newkeycode = Key_unknown; | 748 | newkeycode = Key_unknown; |
749 | break; | 749 | break; |
750 | } | 750 | } |
751 | } | 751 | } |
752 | 752 | ||
753 | kif ( newkeycode != keycode ) { | 753 | if ( newkeycode != keycode ) { |
754 | if ( newkeycode != Key_unknown ) | 754 | if ( newkeycode != Key_unknown ) |
755 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 755 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
756 | return true; | 756 | return true; |
757 | } | 757 | } |
758 | else | 758 | else |
759 | return false; | 759 | return false; |
760 | } | 760 | } |
761 | 761 | ||
762 | void iPAQ::timerEvent ( QTimerEvent * ) | 762 | void iPAQ::timerEvent ( QTimerEvent * ) |
763 | { | 763 | { |
764 | killTimer ( m_power_timer ); | 764 | killTimer ( m_power_timer ); |
765 | m_power_timer = 0; | 765 | m_power_timer = 0; |
766 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 766 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
767 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 767 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
768 | } | 768 | } |
769 | 769 | ||
770 | 770 | ||
771 | void iPAQ::alarmSound ( ) | 771 | void iPAQ::alarmSound ( ) |
772 | { | 772 | { |
773 | #ifndef QT_NO_SOUND | 773 | #ifndef QT_NO_SOUND |
774 | static Sound snd ( "alarm" ); | 774 | static Sound snd ( "alarm" ); |
775 | int fd; | 775 | int fd; |
776 | int vol; | 776 | int vol; |
777 | bool vol_reset = false; | 777 | bool vol_reset = false; |
778 | 778 | ||
779 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | 779 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { |
780 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | 780 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { |
781 | Config cfg ( "qpe" ); | 781 | Config cfg ( "qpe" ); |
782 | cfg. setGroup ( "Volume" ); | 782 | cfg. setGroup ( "Volume" ); |
783 | 783 | ||
784 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 784 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
785 | if ( volalarm < 0 ) | 785 | if ( volalarm < 0 ) |
786 | volalarm = 0; | 786 | volalarm = 0; |
787 | else if ( volalarm > 100 ) | 787 | else if ( volalarm > 100 ) |
788 | volalarm = 100; | 788 | volalarm = 100; |
789 | volalarm |= ( volalarm << 8 ); | 789 | volalarm |= ( volalarm << 8 ); |
790 | 790 | ||
791 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 791 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
792 | vol_reset = true; | 792 | vol_reset = true; |
793 | } | 793 | } |
794 | } | 794 | } |
795 | 795 | ||
796 | snd. play ( ); | 796 | snd. play ( ); |
797 | while ( !snd. isFinished ( )) | 797 | while ( !snd. isFinished ( )) |
798 | qApp-> processEvents ( ); | 798 | qApp-> processEvents ( ); |
799 | 799 | ||
800 | if ( fd >= 0 ) { | 800 | if ( fd >= 0 ) { |
801 | if ( vol_reset ) | 801 | if ( vol_reset ) |
802 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 802 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
803 | ::close ( fd ); | 803 | ::close ( fd ); |
804 | } | 804 | } |
805 | #endif | 805 | #endif |
806 | } | 806 | } |
807 | 807 | ||
808 | 808 | ||
809 | bool iPAQ::setSoftSuspend ( bool soft ) | 809 | bool iPAQ::setSoftSuspend ( bool soft ) |
810 | { | 810 | { |
811 | bool res = false; | 811 | bool res = false; |
812 | int fd; | 812 | int fd; |
813 | 813 | ||
814 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { | 814 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { |
815 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) | 815 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) |
816 | res = true; | 816 | res = true; |
817 | else | 817 | else |