summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice_zaurus.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore/device/odevice_zaurus.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index a59e799..7377965 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -471,106 +471,119 @@ bool Zaurus::setDisplayStatus( bool on )
{
int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK );
if ( fd )
{
char buf[10];
buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
buf[1] = '\0';
res = ( ::write( fd, &buf[0], 2 ) == 0 );
::close( fd );
}
}
return res;
}
bool Zaurus::suspend()
{
qDebug("ODevice::suspend");
if ( !isQWS( ) ) // only qwsserver is allowed to suspend
return false;
if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
return false;
bool res = false;
ODevice::sendSuspendmsg();
struct timeval tvs, tvn;
::gettimeofday ( &tvs, 0 );
::sync(); // flush fs caches
res = ( ::system ( "apm --suspend" ) == 0 );
// This is needed because the apm implementation is asynchronous and we
// can not be sure when exactly the device is really suspended
if ( res ) {
do { // Yes, wait 15 seconds. This APM sucks big time.
::usleep ( 200 * 1000 );
::gettimeofday ( &tvn, 0 );
} while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 );
}
QCopEnvelope ( "QPE/Rotation", "rotateDefault()" );
return res;
}
Transformation Zaurus::rotation() const
{
+ qDebug( "Zaurus::rotation()" );
Transformation rot;
switch ( d->m_model ) {
case Model_Zaurus_SLC3000: // fallthrough
- case Model_Zaurus_SLC7x0: {
- OHingeStatus hs = readHingeSensor();
+ case Model_Zaurus_SLC7x0:
+ {
+ OHingeStatus hs = readHingeSensor();
+ qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs );
+
+ if ( m_embedix )
+ {
if ( hs == CASE_PORTRAIT ) rot = Rot0;
else if ( hs == CASE_UNKNOWN ) rot = Rot0;
else rot = Rot270;
}
+ else
+ {
+ if ( hs == CASE_PORTRAIT ) rot = Rot270;
+ else if ( hs == CASE_UNKNOWN ) rot = Rot0;
+ else rot = Rot0;
+ }
+ }
break;
case Model_Zaurus_SL6000:
case Model_Zaurus_SLB600:
case Model_Zaurus_SLA300:
case Model_Zaurus_SL5500:
case Model_Zaurus_SL5000:
default:
rot = d->m_rotation;
break;
}
return rot;
}
ODirection Zaurus::direction() const
{
ODirection dir;
switch ( d->m_model ) {
case Model_Zaurus_SLC3000: // fallthrough
case Model_Zaurus_SLC7x0: {
OHingeStatus hs = readHingeSensor();
if ( hs == CASE_PORTRAIT ) dir = CCW;
else if ( hs == CASE_UNKNOWN ) dir = CCW;
else dir = CW;
}
break;
case Model_Zaurus_SL6000:
case Model_Zaurus_SLA300:
case Model_Zaurus_SLB600:
case Model_Zaurus_SL5500:
case Model_Zaurus_SL5000:
default: dir = d->m_direction;
break;
}
return dir;
}
bool Zaurus::hasHingeSensor() const
{
return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000;
}
OHingeStatus Zaurus::readHingeSensor() const
{
if (m_embedix)
{
int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK);