summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
Side-by-side diff
Diffstat (limited to 'libopie/odevice.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie/odevice.cpp135
1 files changed, 95 insertions, 40 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index d86654e..160568b 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -166,3 +166,2 @@ protected:
virtual void init ( );
- virtual void initButtons ( );
@@ -170,2 +169,3 @@ public:
virtual bool setSoftSuspend ( bool soft );
+ virtual bool suspend ( );
@@ -174,2 +174,4 @@ public:
virtual int displayBrightnessResolution ( ) const;
+ virtual bool setDisplayContrast ( int b );
+ virtual int displayContrastResolution ( ) const;
@@ -355,3 +357,3 @@ struct r_button {
Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
- "devicebuttons/simpad_menu",
+ "devicebuttons/z_menu",
"QPE/TaskBar", "toggleMenu()",
@@ -495,2 +497,3 @@ bool ODevice::suspend ( )
{
+ qDebug("ODevice::suspend");
if ( !isQWS( ) ) // only qwsserver is allowed to suspend
@@ -538,2 +541,4 @@ bool ODevice::setDisplayStatus ( bool on )
{
+ qDebug("ODevice::setDisplayStatus(%d)", on);
+
if ( d-> m_model == Model_Unknown )
@@ -561,2 +566,5 @@ bool ODevice::setDisplayBrightness ( int p)
+/**
+ * @return return the max value for the brightness settings slider
+ */
int ODevice::displayBrightnessResolution ( ) const
@@ -567,2 +575,21 @@ int ODevice::displayBrightnessResolution ( ) const
/**
+ * This sets the display contrast
+ * @return success or failure
+ */
+bool ODevice::setDisplayContrast ( int p)
+{
+ Q_UNUSED( p )
+ return false;
+}
+
+/**
+ * @return return the max value for the brightness settings slider
+ * or 0 if the device doesn't support setting of a contrast
+ */
+int ODevice::displayContrastResolution ( ) const
+{
+ return 0;
+}
+
+/**
* This returns the vendor as string
@@ -672,3 +699,2 @@ void ODevice::touchSound ( )
{
-
#ifndef QT_NO_SOUND
@@ -1905,4 +1931,3 @@ void Ramses::init ( )
- d->m_rotation = Rot180;
- d->m_direction = CCW;
+ d->m_rotation = Rot0;
d->m_holdtime = 1000;
@@ -1925,35 +1950,8 @@ void Ramses::init ( )
-void Ramses::initButtons ( )
-{
- if ( d->m_buttons )
- return;
-
- if ( isQWS( ) )
- QWSServer::setKeyboardFilter ( this );
-
- d->m_buttons = new QValueList <ODeviceButton>;
-
- for ( uint i = 0; i < ( sizeof( ramses_buttons ) / sizeof( s_button )); i++ ) {
- r_button *rb = ramses_buttons + i;
- ODeviceButton b;
-
- if (( rb->model & d->m_model ) == d->m_model ) {
- b.setKeycode( rb->code );
- b.setUserText( QObject::tr ( "Button", rb->utext ));
- b.setPixmap( Resource::loadPixmap ( rb->pix ));
- b.setFactoryPresetPressedAction( OQCopMessage ( makeChannel ( rb->fpressedservice ), rb->fpressedaction ));
- b.setFactoryPresetHeldAction( OQCopMessage ( makeChannel ( rb->fheldservice ), rb->fheldaction ));
-
- d->m_buttons->append( b );
- }
- }
- reloadButtonMapping();
-
- QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
- connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
-}
-
bool Ramses::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
{
- //TODO
+ Q_UNUSED( keycode );
+ Q_UNUSED( modifiers );
+ Q_UNUSED( isPress );
+ Q_UNUSED( autoRepeat );
return false;
@@ -1972,2 +1970,4 @@ bool Ramses::setSoftSuspend ( bool soft )
{
+ qDebug("Ramses::setSoftSuspend(%d)", soft);
+#if 0
bool res = false;
@@ -2000,2 +2000,10 @@ bool Ramses::setSoftSuspend ( bool soft )
return res;
+#else
+ return true;
+#endif
+}
+
+bool Ramses::suspend ( )
+{
+ qDebug("Ramses::suspend");
}
@@ -2007,2 +2015,4 @@ bool Ramses::setDisplayStatus ( bool on )
{
+ qDebug("Ramses::setDisplayStatus(%d)", on);
+#if 0
bool res = false;
@@ -2015,2 +2025,5 @@ bool Ramses::setDisplayStatus ( bool on )
return res;
+#else
+ return true;
+#endif
}
@@ -2018,5 +2031,8 @@ bool Ramses::setDisplayStatus ( bool on )
+/*
+ * We get something between 0..255 into us
+*/
bool Ramses::setDisplayBrightness ( int bright )
{
- qDebug( "ODevice for Ramses: setDisplayBrightness( %d )", bright );
+ qDebug("Ramses::setDisplayBrightness(%d)", bright);
bool res = false;
@@ -2024,8 +2040,12 @@ bool Ramses::setDisplayBrightness ( int bright )
+ // pwm1 brighness: 20 steps 500..0 (dunkel->hell)
+
if ( bright > 255 )
- bright = 100;
+ bright = 255;
if ( bright < 0 )
bright = 0;
+ bright = 500-(bright * 500 / 255);
- if (( fd = ::open ( "/proc/sys/board/pwm0", O_WRONLY )) >= 0 ) {
+ if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) {
+ qDebug(" %d -> pwm1", bright);
char writeCommand[100];
@@ -2034,2 +2054,4 @@ bool Ramses::setDisplayBrightness ( int bright )
::close ( fd );
+ } else {
+ qWarning("no write");
}
@@ -2041,3 +2063,36 @@ int Ramses::displayBrightnessResolution ( ) const
{
- return 100;
+ return 32;
+}
+
+bool Ramses::setDisplayContrast(int contr)
+{
+ qDebug("Ramses::setDisplayContrast(%d)", contr);
+ bool res = false;
+ int fd;
+
+ // pwm0 contrast: 35 steps 65..100 (dunkel->hell)
+
+ if (contr > 255 )
+ contr = 255;
+ if (contr < 0)
+ contr = 0;
+ contr = 65 + (contr * 350 / 255);
+
+ if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) {
+ qDebug(" %d -> pwm0", contr);
+ char writeCommand[100];
+ const int count = sprintf(writeCommand, "%d\n", contr);
+ res = (::write(fd, writeCommand, count) != -1);
+ res = true;
+ ::close(fd);
+ } else {
+ qWarning("no write");
+ }
+ return res;
+}
+
+
+int Ramses::displayContrastResolution() const
+{
+ return 32;
}