summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
Unidiff
Diffstat (limited to 'libopie/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp1
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
@@ -659,128 +659,129 @@ int iPAQ::displayBrightnessResolution ( ) const
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
674bool iPAQ::hasLightSensor ( ) const 674bool iPAQ::hasLightSensor ( ) const
675{ 675{
676 return true; 676 return true;
677} 677}
678 678
679int iPAQ::readLightSensor ( ) 679int 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
702int iPAQ::lightSensorResolution ( ) const 702int 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
715void Zaurus::init ( ) 715void 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