summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-02-06 22:53:53 (UTC)
committer mickeyl <mickeyl>2005-02-06 22:53:53 (UTC)
commitab32151cd8e85deb354bab04e25efb1f3f399dee (patch) (side-by-side diff)
tree66ab72d210bbc50c0e535986c61ca23f68efbfd1
parentec33239c6edd9927fe2f82953fa48dec47d19567 (diff)
downloadopie-ab32151cd8e85deb354bab04e25efb1f3f399dee.zip
opie-ab32151cd8e85deb354bab04e25efb1f3f399dee.tar.gz
opie-ab32151cd8e85deb354bab04e25efb1f3f399dee.tar.bz2
make autorotate also work on kernel 2.6
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp88
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp22
2 files changed, 35 insertions, 75 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index 3d69614..2c5190c 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -182,13 +182,13 @@ ODevice::ODevice()
d->m_buttons = 0;
d->m_cpu_frequencies = new QStrList;
/* mixer */
d->m_sound = d->m_vol = d->m_mixer = -1;
-
+
/* System QCopChannel created */
d->m_initializedButtonQcop = false;
// New distribution detection code first checks for legacy distributions,
// identified by /etc/familiar-version or /etc/oz_version.
// Then check for OpenEmbedded and lastly, read /etc/issue
@@ -268,39 +268,13 @@ ODevice::~ODevice()
* device and return once the device got woken up
*
* @return if the device got suspended
*/
bool 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 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 { // wait at most 1.5 sec: either suspend didn't work or the device resumed
- ::usleep ( 200 * 1000 );
- ::gettimeofday ( &tvn, 0 );
- } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 );
- }
-
- return res;
+ return false; // default implementation == unknown device or qvfb
}
//#include <linux/fb.h> better not rely on kernel headers in userspace ...
#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611
@@ -310,76 +284,63 @@ bool ODevice::suspend()
#define VESA_HSYNC_SUSPEND 2
#define VESA_POWERDOWN 3
/**
* This sets the display on or off
*/
-bool ODevice::setDisplayStatus ( bool on )
+bool ODevice::setDisplayStatus( bool on )
{
- qDebug("ODevice::setDisplayStatus(%d)", on);
-
- if ( d->m_model == Model_Unknown )
- return false;
-
- bool res = false;
- int fd;
-
-#ifdef QT_QWS_DEVFS
- if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) {
-#else
- if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) {
-#endif
- res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 );
- ::close ( fd );
- }
- return res;
+ qDebug( "ODevice::setDisplayStatus( %d ) - please override me.", on );
+ return false; // don't do anything for unknown models
}
/**
* This sets the display brightness
*
* @param b The brightness to be set on a scale from 0 to 255
* @return success or failure
*/
-bool ODevice::setDisplayBrightness ( int b)
+bool ODevice::setDisplayBrightness( int b )
{
- Q_UNUSED( b )
+ qDebug( "ODevice::setDisplayBrightness( %d ) - please override me.", b );
return false;
}
/**
- *
- * @return Returns the number of steppings on the brightness slider
- * in the Light-'n-Power settings. Values smaller zero and bigger
+ *
+ * @returns the number of steppings on the brightness slider
+ * in the Light-'n-Power settings. Values smaller than zero and bigger
* than 255 do not make sense.
*
* \sa QSlider::setLineStep
* \sa QSlider::setPageStep
*/
int ODevice::displayBrightnessResolution() const
{
+ qDebug( "ODevice::displayBrightnessResolution() - please override me." );
return 16;
}
/**
* This sets the display contrast
* @param p The contrast to be set on a scale from 0 to 255
-* @return success or failure
+* @returns success or failure
*/
-bool ODevice::setDisplayContrast ( int p)
+bool ODevice::setDisplayContrast( int p )
{
- Q_UNUSED( p )
+ qDebug( "ODevice::setDisplayContrast( %d ) - please override me.", p );
return false;
}
/**
-* @return return the max value for the brightness settings slider
+* @returns the maximum value for the contrast settings slider
* or 0 if the device doesn't support setting of a contrast
*/
int ODevice::displayContrastResolution() const
{
+ qDebug( "ODevice::displayBrightnessResolution() - please override me." );
return 0;
}
/**
* This returns the vendor as string
* @return Vendor as QString
@@ -636,23 +597,23 @@ uint ODevice::buttonHoldTime() const
*/
const ODeviceButton *ODevice::buttonForKeycode ( ushort code )
{
initButtons();
for ( QValueListConstIterator<ODeviceButton> it = d->m_buttons->begin(); it != d->m_buttons->end(); ++it ) {
- if ( (*it). keycode() == code )
+ if ( (*it).keycode() == code )
return &(*it);
}
return 0;
}
void ODevice::reloadButtonMapping()
{
if(!d->m_buttons)
initButtons();
-
+
if(!d->m_initializedButtonQcop) {
QCopChannel *chan = new QCopChannel("QPE/System", this, "ODevice button channel");
connect(chan,SIGNAL(received(const QCString&,const QByteArray&)),
this,SLOT(systemMessage(const QCString&,const QByteArray&)));
d->m_initializedButtonQcop = true;
}
@@ -676,13 +637,12 @@ void ODevice::reloadButtonMapping()
hch = cfg. readEntry ( "HeldActionChannel" ). latin1();
hm = cfg. readEntry ( "HeldActionMessage" ). latin1();
// hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" ));
}
b. setPressedAction ( OQCopMessage ( pch, pm, pdata ));
-
b. setHeldAction ( OQCopMessage ( hch, hm, hdata ));
}
}
void ODevice::remapPressedAction ( int button, const OQCopMessage &action )
{
@@ -738,16 +698,16 @@ void ODevice::virtual_hook(int, void* ){
/**
* \brief Send a QCOP Message before suspending
*
* Sends a QCOP message to channel QPE/System
* with the message "aboutToSuspend()" if this
* is the windowing server.
- *
+ *
* Call this in your custom \sa suspend() Method
* before going to suspend.
- *
+ *
*/
void ODevice::sendSuspendmsg()
{
if ( isQWS() )
return;
@@ -784,13 +744,13 @@ void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter)
Opie::Core::OKeyFilter::inst()->remPreHandler(aFilter);
}
/**
* @internal
- *
+ *
* @see changeMixerForAlarm
*/
void ODevice::playingStopped() {
if ( sender() )
const_cast<QObject*>(sender())->disconnect( this );
@@ -826,19 +786,19 @@ void ODevice::playingStopped() {
* if(!snd.isFinished())
* return;
*
* changeMixerForAlarm( my_channel, "/dev/mixer", &snd );
* snd.play()
* \endcode
- *
- *
+ *
+ *
*
* @param mixer The mixer number/channel to use
* @param file The file name. If you convert from QString use QFile::encodeName
* @param snd The sound to wait for finishing
- *
+ *
*/
void ODevice::changeMixerForAlarm( int mixer, const char* file, Sound *snd ) {
#ifndef QT_NO_SOUND
if (( d->m_sound = ::open ( file, O_RDWR )) >= 0 ) {
if ( ::ioctl ( d->m_sound, MIXER_READ( mixer ), &d->m_vol ) >= 0 ) {
Config cfg ( "qpe" );
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 7377965..82e127e 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -99,24 +99,24 @@ struct z_button z_buttons_c700 [] = {
"QPE/TaskBar", "toggleStartMenu()" },
{ Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
"devicebuttons/z_mail",
"opiemail", "raise()",
"opiemail", "newMail()" },
- { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
- "devicebuttons/z_hinge",
+ { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"),
+ "devicebuttons/z_hinge1",
"QPE/Rotation", "rotateDefault()",
- "QPE/Dummy", "doNothing()" },
- { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
- "devicebuttons/z_hinge",
+ "QPE/Rotation", "rotateDefault()" },
+ { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"),
+ "devicebuttons/z_hinge2",
"QPE/Rotation", "rotateDefault()",
- "QPE/Dummy", "doNothing()" },
- { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
- "devicebuttons/z_hinge",
+ "QPE/Rotation", "rotateDefault()" },
+ { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"),
+ "devicebuttons/z_hinge3",
"QPE/Rotation", "rotateDefault()",
- "QPE/Dummy", "doNothing()" },
+ "QPE/Rotation", "rotateDefault()" },
};
// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
// class up into individual classes. We need three classes
//
// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000)
@@ -485,13 +485,13 @@ bool Zaurus::setDisplayStatus( bool on )
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
+ if ( d->m_model == Model_Unknown ) // better don't suspend on unknown devices
return false;
bool res = false;
ODevice::sendSuspendmsg();
struct timeval tvs, tvn;
@@ -531,13 +531,13 @@ Transformation Zaurus::rotation() const
if ( hs == CASE_PORTRAIT ) rot = Rot0;
else if ( hs == CASE_UNKNOWN ) rot = Rot0;
else rot = Rot270;
}
else
{
- if ( hs == CASE_PORTRAIT ) rot = Rot270;
+ if ( hs == CASE_PORTRAIT ) rot = Rot90;
else if ( hs == CASE_UNKNOWN ) rot = Rot0;
else rot = Rot0;
}
}
break;
case Model_Zaurus_SL6000: