summaryrefslogtreecommitdiff
path: root/libopie2
authorchicken <chicken>2004-05-11 17:29:32 (UTC)
committer chicken <chicken>2004-05-11 17:29:32 (UTC)
commitee881675ee5f0df15cc19e7ab2d18ee9f13bf438 (patch) (side-by-side diff)
tree8237ba829231f961d83e89f56d488873a80c64e4 /libopie2
parentd6759c4a53426e01c2bec7d00d703b76da992d78 (diff)
downloadopie-ee881675ee5f0df15cc19e7ab2d18ee9f13bf438.zip
opie-ee881675ee5f0df15cc19e7ab2d18ee9f13bf438.tar.gz
opie-ee881675ee5f0df15cc19e7ab2d18ee9f13bf438.tar.bz2
as the jornada 56x uses kernel 2.6 now we need new functions.
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_jornada.cpp54
-rw-r--r--libopie2/opiecore/device/odevice_jornada.h3
2 files changed, 37 insertions, 20 deletions
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp
index ad2f830..75c9fc5 100644
--- a/libopie2/opiecore/device/odevice_jornada.cpp
+++ b/libopie2/opiecore/device/odevice_jornada.cpp
@@ -82,69 +82,85 @@ using namespace Opie::Core::Internal;
void Jornada::init(const QString&)
{
d->m_vendorstr = "HP";
d->m_vendor = Vendor_HP;
d->m_modelstr = "Jornada 56x";
d->m_model = Model_Jornada_56x;
d->m_systemstr = "Familiar";
d->m_system = System_Familiar;
d->m_rotation = Rot0;
QFile f ( "/etc/familiar-version" );
f.setName ( "/etc/familiar-version" );
if ( f.open ( IO_ReadOnly )) {
QTextStream ts ( &f );
d->m_sysverstr = ts.readLine().mid( 10 );
f. close();
}
}
int Jornada::displayBrightnessResolution() const
{
- return 0;
+ return 255;
}
bool Jornada::setDisplayBrightness( int bright )
{
bool res = false;
int fd;
if ( bright > 255 )
bright = 255;
if ( bright < 0 )
bright = 0;
- if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
- FLITE_IN bl;
- bl. mode = 1;
- bl. pwr = bright ? 1 : 0;
- bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255;
- res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
- ::close ( fd );
- }
+ QString cmdline;
+
+ int value = 255 - bright;
+ if ( !bright )
+ cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power");
+ else
+ cmdline = QString().sprintf( "echo 1 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", value );
+
+ res = ( ::system( (const char*) cmdline ) == 0 );
+
return res;
}
-bool Jornada::setSoftSuspend( bool soft )
+bool Jornada::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 );
+
+ return res;
+}
+
+bool Jornada::setDisplayStatus ( bool on )
{
bool res = false;
int fd;
- if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) {
- if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 )
- res = true;
- else
- ::perror ( "write to /proc/sys/ts/suspend_button_mode" );
+ QString cmdline = QString().sprintf( "echo %d > /sys/class/lcd/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/power", on ? "1" : "0",on ? "1" : "0" );
- ::close ( fd );
- }
- else
- ::perror ( "/proc/sys/ts/suspend_button_mode" );
+ res = ( ::system( (const char*) cmdline ) == 0 );
return res;
}
diff --git a/libopie2/opiecore/device/odevice_jornada.h b/libopie2/opiecore/device/odevice_jornada.h
index fddfe34..2a9e821 100644
--- a/libopie2/opiecore/device/odevice_jornada.h
+++ b/libopie2/opiecore/device/odevice_jornada.h
@@ -21,33 +21,34 @@
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ODEVICE_JORNADA
#define ODEVICE_JORNADA
#include <opie2/odevice.h>
namespace Opie {
namespace Core {
namespace Internal {
class Jornada : public ODevice
{
protected:
virtual void init(const QString&);
public:
- virtual bool setSoftSuspend ( bool soft );
+ virtual bool suspend ( );
virtual bool setDisplayBrightness ( int b );
+ virtual bool setDisplayStatus ( bool on);
virtual int displayBrightnessResolution() const;
};
}
}
}
#endif