summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_jornada.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp
index c7ed4bc..272109b 100644
--- a/libopie2/opiecore/device/odevice_jornada.cpp
+++ b/libopie2/opiecore/device/odevice_jornada.cpp
@@ -128,71 +128,81 @@ void Jornada::init(const QString& cpu_info)
128 d->m_model = Model_Jornada_720; 128 d->m_model = Model_Jornada_720;
129 } 129 }
130 130
131 d->m_rotation = Rot0; //all Jornadas need this rotation 131 d->m_rotation = Rot0; //all Jornadas need this rotation
132 //Distribution detecting code is now in base class 132 //Distribution detecting code is now in base class
133} 133}
134 134
135void Jornada::initButtons() 135void Jornada::initButtons()
136{ 136{
137 if ( d->m_buttons ) 137 if ( d->m_buttons )
138 return; 138 return;
139 139
140 d->m_buttons = new QValueList <ODeviceButton>; 140 d->m_buttons = new QValueList <ODeviceButton>;
141 141
142 for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) { 142 for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) {
143 j_button *ib = jornada56x_buttons + i; 143 j_button *ib = jornada56x_buttons + i;
144 ODeviceButton b; 144 ODeviceButton b;
145 145
146 if (( ib->model & d->m_model ) == d->m_model ) { 146 if (( ib->model & d->m_model ) == d->m_model ) {
147 b. setKeycode ( ib->code ); 147 b. setKeycode ( ib->code );
148 b. setUserText ( QObject::tr ( "Button", ib->utext )); 148 b. setUserText ( QObject::tr ( "Button", ib->utext ));
149 b. setPixmap ( Resource::loadPixmap ( ib->pix )); 149 b. setPixmap ( Resource::loadPixmap ( ib->pix ));
150 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); 150 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction ));
151 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); 151 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction ));
152 152
153 d->m_buttons->append ( b ); 153 d->m_buttons->append ( b );
154 } 154 }
155 } 155 }
156 reloadButtonMapping(); 156 reloadButtonMapping();
157} 157}
158 158
159int Jornada::displayBrightnessResolution() const 159int Jornada::displayBrightnessResolution() const
160{ 160{
161 return 255; 161 return 255;
162} 162}
163 163
164 164
165bool Jornada::setDisplayBrightness( int bright ) 165bool Jornada::setDisplayBrightness( int bright )
166{ 166{
167 bool res = false; 167 bool res = false;
168 168
169 if ( bright > 255 ) 169 if ( bright > 255 )
170 bright = 255; 170 bright = 255;
171 if ( bright < 0 ) 171 if ( bright < 0 )
172 bright = 0; 172 bright = 0;
173 173
174 QString cmdline; 174 QString cmdline;
175 175
176 if ( !bright ) 176 if ( d->m_model == Model_Jornada_56x ) {
177 cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/*/power"); 177 if ( !bright )
178 else 178 cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/sa1100fb/power");
179 cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/*/power; echo %1 > /sys/class/backlight/*/brightness" ).arg( bright ); 179 else
180 cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/sa1100/power; echo %1 > /sys/class/backlight/sa1100/brightness" ).arg( bright );
181 } else if ( d->m_model == Model_Jornada_720 ) {
182 cmdline = QString::fromLatin1( "echo %1 > /sys/class/backlight/e1356fb/brightness" ).arg( bright );
183 }
180 184
181 // No Global::shellQuote as we gurantee it to be sane 185 // No Global::shellQuote as we gurantee it to be sane
182 res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); 186 res = ( ::system( QFile::encodeName(cmdline) ) == 0 );
183 187
184 return res; 188 return res;
185} 189}
186 190
187 191
188bool Jornada::setDisplayStatus ( bool on ) 192bool Jornada::setDisplayStatus ( bool on )
189{ 193{
190 bool res = false; 194 bool res = false;
191 195
192 QString cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/*/power; echo %2 > /sys/class/backlight/*/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); 196 QString cmdline;
197
198 if ( d->m_model == Model_Jornada_56x ) {
199 QString cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/*/power; echo %2 > /sys/class/backlight/*/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" );
200 } else if ( d->m_model == Model_Jornada_720 ) {
201 QString cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/e1356fb/power").arg( on ? "0" : "4" );
202 }
193 203
194 res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); 204 res = ( ::system( QFile::encodeName(cmdline) ) == 0 );
195 205
196 return res; 206 return res;
197} 207}
198 208