summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-10 01:12:01 (UTC)
committer llornkcor <llornkcor>2002-11-10 01:12:01 (UTC)
commitd8bf328c4dfa2b33e2c5761c7af3b39ec307abee (patch) (unidiff)
treeb1185b0970076d4c76c358b8c96b696ae37270e1
parent12aa2d36cdd22cbde571716db4da302159c718fd (diff)
downloadopie-d8bf328c4dfa2b33e2c5761c7af3b39ec307abee.zip
opie-d8bf328c4dfa2b33e2c5761c7af3b39ec307abee.tar.gz
opie-d8bf328c4dfa2b33e2c5761c7af3b39ec307abee.tar.bz2
fix system version string for zaurus
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp2
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
@@ -657,193 +657,193 @@ bool iPAQ::setDisplayBrightness ( int bright )
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
676int iPAQ::displayBrightnessResolution ( ) const 676int 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
694bool iPAQ::hasLightSensor ( ) const 694bool iPAQ::hasLightSensor ( ) const
695{ 695{
696 return true; 696 return true;
697} 697}
698 698
699int iPAQ::readLightSensor ( ) 699int 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
722int iPAQ::lightSensorResolution ( ) const 722int 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
735void Zaurus::init ( ) 735void 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
813typedef struct sharp_led_status { 813typedef 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
833void Zaurus::buzzer ( int sound ) 833void 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
842void Zaurus::alarmSound ( ) 842void Zaurus::alarmSound ( )
843{ 843{
844 buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); 844 buzzer ( SHARP_BUZ_SCHEDULE_ALARM );
845} 845}
846 846
847void Zaurus::touchSound ( ) 847void Zaurus::touchSound ( )
848{ 848{
849 buzzer ( SHARP_BUZ_TOUCHSOUND ); 849 buzzer ( SHARP_BUZ_TOUCHSOUND );