author | mickeyl <mickeyl> | 2005-01-23 20:52:18 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-01-23 20:52:18 (UTC) |
commit | be26adf324ea0b723cabcd735b0833e16410ceea (patch) (side-by-side diff) | |
tree | d196481a0e503fb61ec8fad05d0835b877c186cc /libopie2 | |
parent | ab0242ff1bbc40ec8bc38c3cb748a44797ffe3db (diff) | |
download | opie-be26adf324ea0b723cabcd735b0833e16410ceea.zip opie-be26adf324ea0b723cabcd735b0833e16410ceea.tar.gz opie-be26adf324ea0b723cabcd735b0833e16410ceea.tar.bz2 |
- consolidate reading hinge sensor into one place
- return proper rotation and direction if hinge sensor not present (like in 2.6 atm.)
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 33 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.h | 2 |
2 files changed, 10 insertions, 25 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index d3ab63a..b22ee70 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp @@ -547,16 +547,8 @@ Transformation Zaurus::rotation() const case Model_Zaurus_SLC3000: // fallthrough case Model_Zaurus_SLC7x0: - handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); - if (handle == -1) { - return Rot270; - } else { - retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); - ::close (handle); - - if (retval == 2 ) - rot = Rot0; - else - rot = Rot270; - } + OHingeStatus hs = readHingeSensor(); + if ( hs == CASE_PORTRAIT ) rot = Rot0; + else if ( hs == CASE_UNKNOWN ) rot = Rot0; + else rot = Rot270; break; case Model_Zaurus_SL6000: @@ -580,15 +572,8 @@ ODirection Zaurus::direction() const case Model_Zaurus_SLC3000: // fallthrough case Model_Zaurus_SLC7x0: - handle = ::open( "/dev/apm_bios", O_RDWR|O_NONBLOCK ); - if (handle == -1) { - dir = CW; - } else { - retval = ::ioctl( handle, SHARP_IOCTL_GET_ROTATION ); - ::close (handle); - if (retval == 2 ) - dir = CCW; - else - dir = CW; - } + OHingeStatus hs = readHingeSensor(); + if ( hs == CASE_PORTRAIT ) dir = CCW; + else if ( hs == CASE_UNKNOWN ) dir = CCW; + else dir = CW; break; case Model_Zaurus_SL6000: @@ -609,5 +594,5 @@ bool Zaurus::hasHingeSensor() const } -OHingeStatus Zaurus::readHingeSensor() +OHingeStatus Zaurus::readHingeSensor() const { if (m_embedix) diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h index ed9cf67..c763798 100644 --- a/libopie2/opiecore/device/odevice_zaurus.h +++ b/libopie2/opiecore/device/odevice_zaurus.h @@ -111,5 +111,5 @@ class Zaurus : public ODevice virtual bool hasHingeSensor() const; - virtual OHingeStatus readHingeSensor(); + virtual OHingeStatus readHingeSensor() const; virtual bool suspend(); |