summaryrefslogtreecommitdiff
authorchicken <chicken>2004-05-11 17:29:32 (UTC)
committer chicken <chicken>2004-05-11 17:29:32 (UTC)
commitee881675ee5f0df15cc19e7ab2d18ee9f13bf438 (patch) (unidiff)
tree8237ba829231f961d83e89f56d488873a80c64e4
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 (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
@@ -90,61 +90,77 @@ void Jornada::init(const QString&)
90 d->m_rotation = Rot0; 90 d->m_rotation = Rot0;
91 91
92 QFile f ( "/etc/familiar-version" ); 92 QFile f ( "/etc/familiar-version" );
93 f.setName ( "/etc/familiar-version" ); 93 f.setName ( "/etc/familiar-version" );
94 if ( f.open ( IO_ReadOnly )) { 94 if ( f.open ( IO_ReadOnly )) {
95 95
96 QTextStream ts ( &f ); 96 QTextStream ts ( &f );
97 d->m_sysverstr = ts.readLine().mid( 10 ); 97 d->m_sysverstr = ts.readLine().mid( 10 );
98 98
99 f. close(); 99 f. close();
100 } 100 }
101} 101}
102 102
103 103
104int Jornada::displayBrightnessResolution() const 104int Jornada::displayBrightnessResolution() const
105{ 105{
106 return 0; 106 return 255;
107} 107}
108 108
109 109
110bool Jornada::setDisplayBrightness( int bright ) 110bool Jornada::setDisplayBrightness( int bright )
111{ 111{
112 bool res = false; 112 bool res = false;
113 int fd; 113 int fd;
114 114
115 if ( bright > 255 ) 115 if ( bright > 255 )
116 bright = 255; 116 bright = 255;
117 if ( bright < 0 ) 117 if ( bright < 0 )
118 bright = 0; 118 bright = 0;
119 119
120 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { 120 QString cmdline;
121 FLITE_IN bl; 121
122 bl. mode = 1; 122 int value = 255 - bright;
123 bl. pwr = bright ? 1 : 0; 123 if ( !bright )
124 bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255; 124 cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power");
125 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 125 else
126 ::close ( fd ); 126 cmdline = QString().sprintf( "echo 1 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", value );
127 } 127
128 res = ( ::system( (const char*) cmdline ) == 0 );
129
128 return res; 130 return res;
129} 131}
130 132
131 133
132bool Jornada::setSoftSuspend( bool soft ) 134bool Jornada::suspend( )
135{
136 qDebug("ODevice::suspend");
137 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
138 return false;
139
140 if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
141 return false;
142
143 bool res = false;
144 ODevice::sendSuspendmsg();
145
146 struct timeval tvs, tvn;
147 ::gettimeofday ( &tvs, 0 );
148
149 ::sync(); // flush fs caches
150 res = ( ::system ( "apm --suspend" ) == 0 );
151
152 return res;
153}
154
155bool Jornada::setDisplayStatus ( bool on )
133{ 156{
134 bool res = false; 157 bool res = false;
135 int fd; 158 int fd;
136 159
137 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { 160 QString cmdline = QString().sprintf( "echo %d > /sys/class/lcd/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/power", on ? "1" : "0",on ? "1" : "0" );
138 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 )
139 res = true;
140 else
141 ::perror ( "write to /proc/sys/ts/suspend_button_mode" );
142 161
143 ::close ( fd ); 162 res = ( ::system( (const char*) cmdline ) == 0 );
144 }
145 else
146 ::perror ( "/proc/sys/ts/suspend_button_mode" );
147 163
148 return res; 164 return res;
149} 165}
150 166
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
@@ -29,25 +29,26 @@
29 29
30#ifndef ODEVICE_JORNADA 30#ifndef ODEVICE_JORNADA
31#define ODEVICE_JORNADA 31#define ODEVICE_JORNADA
32 32
33#include <opie2/odevice.h> 33#include <opie2/odevice.h>
34 34
35namespace Opie { 35namespace Opie {
36namespace Core { 36namespace Core {
37namespace Internal { 37namespace Internal {
38class Jornada : public ODevice 38class Jornada : public ODevice
39{ 39{
40 40
41 protected: 41 protected:
42 virtual void init(const QString&); 42 virtual void init(const QString&);
43 43
44 public: 44 public:
45 virtual bool setSoftSuspend ( bool soft ); 45 virtual bool suspend ( );
46 virtual bool setDisplayBrightness ( int b ); 46 virtual bool setDisplayBrightness ( int b );
47 virtual bool setDisplayStatus ( bool on);
47 virtual int displayBrightnessResolution() const; 48 virtual int displayBrightnessResolution() const;
48}; 49};
49} 50}
50} 51}
51} 52}
52#endif 53#endif
53 54