-rw-r--r-- | libopie/odevice.cpp | 12 | ||||
-rw-r--r-- | libopie/odevice.h | 1 |
2 files changed, 11 insertions, 2 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 9f64fc0..4c49c4f 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp @@ -81,16 +81,17 @@ public: virtual QValueList <OLed> ledList ( ) const; virtual QValueList <OLedState> ledStateList ( OLed led ) const; virtual OLedState ledState ( OLed led ) const; virtual bool setLedState ( OLed led, OLedState st ); virtual bool hasLightSensor ( ) const; virtual int readLightSensor ( ); + virtual int lightSensorResolution ( ) const; //virtual QValueList <int> keyList ( ) const; protected: virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); virtual void timerEvent ( QTimerEvent *te ); int m_power_timer; @@ -364,16 +365,20 @@ bool ODevice::hasLightSensor ( ) const return false; } int ODevice::readLightSensor ( ) { return -1; } +int ODevice::lightSensorResolution ( ) const +{ + return 0; +} //QValueList <int> ODevice::keyList ( ) const //{ // return QValueList <int> ( ); //} @@ -677,18 +682,17 @@ int iPAQ::displayBrightnessResolution ( ) const return 256; // really 128, but logarithmic control is smoother this way } bool iPAQ::hasLightSensor ( ) const { return true; } -#include <errno.h> -#include <string.h> + int iPAQ::readLightSensor ( ) { int fd; int val = -1; if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { char buffer [8]; @@ -702,16 +706,20 @@ int iPAQ::readLightSensor ( ) val = -1; } ::close ( fd ); } return val; } +int iPAQ::lightSensorResolution ( ) const +{ + return 256; +} /************************************************** * * Zaurus * **************************************************/ diff --git a/libopie/odevice.h b/libopie/odevice.h index be2a9c7..e07b91c 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h @@ -130,16 +130,17 @@ public: virtual QValueList <OLed> ledList ( ) const; virtual QValueList <OLedState> ledStateList ( OLed led ) const; virtual OLedState ledState ( OLed led ) const; virtual bool setLedState ( OLed led, OLedState st ); virtual bool hasLightSensor ( ) const; virtual int readLightSensor ( ); + virtual int lightSensorResolution ( ) const; //virtual QValueList <int> keyList ( ) const; }; } #endif |