summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
Unidiff
Diffstat (limited to 'libopie/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 4c49c4f..8f4e296 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -408,6 +408,8 @@ void iPAQ::init ( )
408 d-> m_model = Model_iPAQ_H37xx; 408 d-> m_model = Model_iPAQ_H37xx;
409 else if ( d-> m_modelstr == "H3800" ) 409 else if ( d-> m_modelstr == "H3800" )
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
412 d-> m_model = Model_Unknown; 414 d-> m_model = Model_Unknown;
413 415
@@ -655,17 +657,13 @@ bool iPAQ::setDisplayBrightness ( int bright )
655 bool res = false; 657 bool res = false;
656 int fd; 658 int fd;
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 )
661 bright = 0; 665 bright = 0;
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 ) {
670 FLITE_IN bl; 668 FLITE_IN bl;
671 bl. mode = 1; 669 bl. mode = 1;
@@ -679,7 +677,19 @@ bool iPAQ::setDisplayBrightness ( int bright )
679 677
680int iPAQ::displayBrightnessResolution ( ) const 678int 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}
684 694
685 695
@@ -957,10 +967,4 @@ int Zaurus::displayBrightnessResolution ( ) const
957 return 5; 967 return 5;
958} 968}
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