summaryrefslogtreecommitdiff
path: root/libopie
authorsandman <sandman>2002-10-29 18:43:23 (UTC)
committer sandman <sandman>2002-10-29 18:43:23 (UTC)
commit5ac67b8aece5aca20419f8953f88a36fd729adfc (patch) (unidiff)
tree3ce57c7a938d36ce40ff0dfe4b114233febf7b08 /libopie
parent45d9a30ec17b5146ffdac8e776003752fe2deeea (diff)
downloadopie-5ac67b8aece5aca20419f8953f88a36fd729adfc.zip
opie-5ac67b8aece5aca20419f8953f88a36fd729adfc.tar.gz
opie-5ac67b8aece5aca20419f8953f88a36fd729adfc.tar.bz2
- redone the Model enum to make it easy to check for series (like: is this an
iPAQ - and not is this a 31xx or 36xx or ...) - fixed the disply brightness resolution bug on H38xx
Diffstat (limited to 'libopie') (more/less context) (show whitespace changes)
-rw-r--r--libopie/odevice.cpp34
-rw-r--r--libopie/odevice.h21
2 files changed, 31 insertions, 24 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 4c49c4f..8f4e296 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -410,2 +410,4 @@ void iPAQ::init ( )
410 d-> m_model = Model_iPAQ_H38xx; 410 d-> m_model = Model_iPAQ_H38xx;
411 else if ( d-> m_modelstr == "H3900" )
412 d-> m_model = Model_iPAQ_H39xx;
411 else 413 else
@@ -657,4 +659,6 @@ bool iPAQ::setDisplayBrightness ( int bright )
657 659
658 if ( bright > 255 ) 660 int maxbright = displayBrightnessResolution ( );
659 bright = 255; 661
662 if ( bright > maxbright )
663 bright = maxbright;
660 if ( bright < 0 ) 664 if ( bright < 0 )
@@ -662,8 +666,2 @@ bool iPAQ::setDisplayBrightness ( int bright )
662 666
663 // 128 is the maximum if you want a decent lifetime for the LCD
664
665 if ( bright > 1 )
666 bright = (int) ( 0.5 + ( ::pow ( 2, double( bright ) / 255.0 ) - 1 ) * 128.0 ); // logarithmic
667 //bright = ( bright + 1 ) / 2;
668
669 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { 667 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
@@ -681,3 +679,15 @@ int iPAQ::displayBrightnessResolution ( ) const
681{ 679{
682 return 256; // really 128, but logarithmic control is smoother this way 680 switch ( model ( )) {
681 case Model_iPAQ_H31xx:
682 case Model_iPAQ_H36xx:
683 case Model_iPAQ_H37xx:
684 return 128; // really 256, but >128 could damage the LCD
685
686 case Model_iPAQ_H38xx:
687 case Model_iPAQ_H39xx:
688 return 64;
689
690 default:
691 return 2;
692 }
683} 693}
@@ -959,8 +969,2 @@ int Zaurus::displayBrightnessResolution ( ) const
959 969
960//QValueList <int> Zaurus::keyList ( ) const
961//{
962 //QValueList <int> vl;
963 //vl << HardKey_Datebook << HardKey_Contacts << HardKey_Mail << HardKey_Menu << HardKey_Home << HardKey_Suspend << HardKey_Backlight;
964 //return vl;
965//}
966 970
diff --git a/libopie/odevice.h b/libopie/odevice.h
index e07b91c..e50009c 100644
--- a/libopie/odevice.h
+++ b/libopie/odevice.h
@@ -32,12 +32,16 @@ enum OModel {
32 32
33 Model_iPAQ = ( 1 << 16 ), 33 Model_Series_Mask = 0xff000000,
34 34
35 Model_iPAQ_H31xx = ( Model_iPAQ | 1 ), 35 Model_iPAQ = ( 1 << 24 ),
36 Model_iPAQ_H36xx = ( Model_iPAQ | 2 ),
37 Model_iPAQ_H37xx = ( Model_iPAQ | 3 ),
38 Model_iPAQ_H38xx = ( Model_iPAQ | 4 ),
39 36
40 Model_Zaurus = ( 2 << 16 ), 37 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ),
38 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ),
39 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ),
40 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ),
41 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ),
42 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ),
41 43
42 Model_Zaurus_SL5000 = ( Model_Zaurus | 1 ), 44 Model_Zaurus = ( 2 << 24 ),
45
46 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ),
43}; 47};
@@ -106,2 +110,3 @@ public:
106 OModel model ( ) const; 110 OModel model ( ) const;
111 inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); }
107 112
@@ -138,4 +143,2 @@ public:
138 virtual int lightSensorResolution ( ) const; 143 virtual int lightSensorResolution ( ) const;
139
140 //virtual QValueList <int> keyList ( ) const;
141}; 144};