summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-12-08 15:17:16 (UTC)
committer mickeyl <mickeyl>2003-12-08 15:17:16 (UTC)
commit7f2f736597490fd1592d7ed1f40e4abf824673c0 (patch) (side-by-side diff)
tree542b6f52b3556f1f4f04c18c15446c73a867ebdc
parentb1182e6a5069c7109f824a916e566c9c1954ded8 (diff)
downloadopie-7f2f736597490fd1592d7ed1f40e4abf824673c0.zip
opie-7f2f736597490fd1592d7ed1f40e4abf824673c0.tar.gz
opie-7f2f736597490fd1592d7ed1f40e4abf824673c0.tar.bz2
Rot270 is not a Direction, but a Rotation. treke, is this fix correct?
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie/odevice.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 5038cc9..e24e043 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1955,193 +1955,193 @@ bool Zaurus::setDisplayBrightness ( int bright )
bright = 255;
if ( bright < 0 )
bright = 0;
if (m_embedix) {
if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) {
int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus
if ( bright && !bl )
bl = 1;
res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 );
::close ( fd );
}
} else {
#define FB_BACKLIGHT_SET_BRIGHTNESS _IOW('F', 1, u_int) /* set brightness */
if (( fd = ::open ( "/dev/fb0", O_WRONLY )) >= 0 ) {
res = ( ::ioctl ( fd , FB_BACKLIGHT_SET_BRIGHTNESS, bright ) == 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;
struct timeval tvs, tvn;
::gettimeofday ( &tvs, 0 );
::sync ( ); // flush fs caches
res = ( ::system ( "apm --suspend" ) == 0 );
// This is needed because the iPAQ apm implementation is asynchronous and we
// can not be sure when exactly the device is really suspended
// This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
if ( res ) {
do { // Yes, wait 15 seconds. This APM bug 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
{
Transformation rot;
int handle = 0;
int retval = 0;
switch ( d-> m_model ) {
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;
}
break;
case Model_Zaurus_SLA300:
case Model_Zaurus_SLB600:
case Model_Zaurus_SL5500:
case Model_Zaurus_SL5000:
default:
rot = d-> m_rotation;
break;
}
return rot;
}
ODirection Zaurus::direction ( ) const
{
ODirection dir;
int handle = 0;
int retval = 0;
switch ( d-> m_model ) {
case Model_Zaurus_SLC7x0:
handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK);
if (handle == -1) {
- dir = Rot270;
+ dir = CW;
} else {
retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION);
::close (handle);
if (retval == 2 )
dir = CCW;
else
dir = CW;
}
break;
case Model_Zaurus_SLA300:
case Model_Zaurus_SLB600:
case Model_Zaurus_SL5500:
case Model_Zaurus_SL5000:
default:
dir = d-> m_direction;
break;
}
return dir;
}
int Zaurus::displayBrightnessResolution ( ) const
{
if (m_embedix)
return 5;
else
return 256;
}
/**************************************************
*
* SIMpad
*
**************************************************/
void SIMpad::init ( )
{
d-> m_vendorstr = "SIEMENS";
d-> m_vendor = Vendor_SIEMENS;
QFile f ( "/proc/hal/model" );
//TODO Implement model checking
//FIXME For now we assume an SL4
d-> m_modelstr = "SL4";
d-> m_model = Model_SIMpad_SL4;
switch ( d-> m_model ) {
default:
d-> m_rotation = Rot0;
d-> m_direction = CCW;
d-> m_holdtime = 1000; // 1000ms
break;
}
f. setName ( "/etc/familiar-version" );
if ( f. open ( IO_ReadOnly )) {
d-> m_systemstr = "Familiar";
d-> m_system = System_Familiar;
QTextStream ts ( &f );
d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
f. close ( );
} else {
f. setName ( "/etc/oz_version" );
if ( f. open ( IO_ReadOnly )) {
d-> m_systemstr = "OpenEmbedded/SIMpad";
d-> m_system = System_OpenZaurus;
QTextStream ts ( &f );
ts.setDevice ( &f );
d-> m_sysverstr = ts. readLine ( );
f. close ( );
}
}
m_leds [0] = m_leds [1] = Led_Off;
m_power_timer = 0;
}
void SIMpad::initButtons ( )
{
if ( d-> m_buttons )
return;
if ( isQWS( ) )
QWSServer::setKeyboardFilter ( this );
d-> m_buttons = new QValueList <ODeviceButton>;