-rw-r--r-- | libopie/odevice.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 58bd663..44fe35f 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -78,16 +78,19 @@ public: | |||
78 | virtual int displayBrightnessResolution ( ) const; | 78 | virtual int displayBrightnessResolution ( ) const; |
79 | 79 | ||
80 | virtual void alarmSound ( ); | 80 | virtual void alarmSound ( ); |
81 | 81 | ||
82 | virtual QValueList <OLed> ledList ( ) const; | 82 | virtual QValueList <OLed> ledList ( ) const; |
83 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 83 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
84 | virtual OLedState ledState ( OLed led ) const; | 84 | virtual OLedState ledState ( OLed led ) const; |
85 | virtual bool setLedState ( OLed led, OLedState st ); | 85 | virtual bool setLedState ( OLed led, OLedState st ); |
86 | |||
87 | virtual bool hasLightSensor ( ) const; | ||
88 | virtual int readLightSensor ( ); | ||
86 | 89 | ||
87 | //virtual QValueList <int> keyList ( ) const; | 90 | //virtual QValueList <int> keyList ( ) const; |
88 | 91 | ||
89 | protected: | 92 | protected: |
90 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 93 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
91 | virtual void timerEvent ( QTimerEvent *te ); | 94 | virtual void timerEvent ( QTimerEvent *te ); |
92 | 95 | ||
93 | int m_power_timer; | 96 | int m_power_timer; |
@@ -351,16 +354,25 @@ OLedState ODevice::ledState ( OLed /*which*/ ) const | |||
351 | return Led_Off; | 354 | return Led_Off; |
352 | } | 355 | } |
353 | 356 | ||
354 | bool ODevice::setLedState ( OLed /*which*/, OLedState /*st*/ ) | 357 | bool ODevice::setLedState ( OLed /*which*/, OLedState /*st*/ ) |
355 | { | 358 | { |
356 | return false; | 359 | return false; |
357 | } | 360 | } |
358 | 361 | ||
362 | bool ODevice::hasLightSensor ( ) const | ||
363 | { | ||
364 | return false; | ||
365 | } | ||
366 | |||
367 | int ODevice::readLightSensor ( ) | ||
368 | { | ||
369 | return -1; | ||
370 | } | ||
359 | 371 | ||
360 | 372 | ||
361 | //QValueList <int> ODevice::keyList ( ) const | 373 | //QValueList <int> ODevice::keyList ( ) const |
362 | //{ | 374 | //{ |
363 | //return QValueList <int> ( ); | 375 | //return QValueList <int> ( ); |
364 | //} | 376 | //} |
365 | 377 | ||
366 | 378 | ||
@@ -661,16 +673,46 @@ bool iPAQ::setDisplayBrightness ( int bright ) | |||
661 | } | 673 | } |
662 | 674 | ||
663 | int iPAQ::displayBrightnessResolution ( ) const | 675 | int iPAQ::displayBrightnessResolution ( ) const |
664 | { | 676 | { |
665 | return 255; // really 128, but logarithmic control is smoother this way | 677 | return 255; // really 128, but logarithmic control is smoother this way |
666 | } | 678 | } |
667 | 679 | ||
668 | 680 | ||
681 | bool iPAQ::hasLightSensor ( ) const | ||
682 | { | ||
683 | return true; | ||
684 | } | ||
685 | |||
686 | int iPAQ::readLightSensor ( ) | ||
687 | { | ||
688 | int fd; | ||
689 | int val = -1; | ||
690 | |||
691 | if (( fd = ::open ( "/proc/hal/lightsensor", O_RDONLY )) >= 0 ) { | ||
692 | char buffer [5]; | ||
693 | |||
694 | if ( ::read ( fd, buffer, 4 ) == 4 ) { | ||
695 | char *endptr; | ||
696 | |||
697 | buffer [4] = 0; | ||
698 | val = ::strtol ( buffer + 2, &endptr, 16 ); | ||
699 | |||
700 | if ( *endptr != 0 ) | ||
701 | val = -1; | ||
702 | } | ||
703 | |||
704 | ::close ( fd ); | ||
705 | } | ||
706 | |||
707 | return val; | ||
708 | } | ||
709 | |||
710 | |||
669 | /************************************************** | 711 | /************************************************** |
670 | * | 712 | * |
671 | * Zaurus | 713 | * Zaurus |
672 | * | 714 | * |
673 | **************************************************/ | 715 | **************************************************/ |
674 | 716 | ||
675 | 717 | ||
676 | 718 | ||