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