summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice_simpad.cpp
Unidiff
Diffstat (limited to 'libopie2/opiecore/device/odevice_simpad.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp32
1 files changed, 3 insertions, 29 deletions
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp
index 34876da..335e0db 100644
--- a/libopie2/opiecore/device/odevice_simpad.cpp
+++ b/libopie2/opiecore/device/odevice_simpad.cpp
@@ -143,17 +143,12 @@ void SIMpad::init(const QString&)
143 143
144void SIMpad::initButtons() 144void SIMpad::initButtons()
145{ 145{
146 if ( d->m_buttons ) 146 if ( d->m_buttons )
147 return; 147 return;
148 148
149 if ( isQWS( ) ) {
150 addPreHandler(this);
151 }
152
153
154 d->m_buttons = new QValueList <ODeviceButton>; 149 d->m_buttons = new QValueList <ODeviceButton>;
155 150
156 for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { 151 for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) {
157 s_button *sb = simpad_buttons + i; 152 s_button *sb = simpad_buttons + i;
158 ODeviceButton b; 153 ODeviceButton b;
159 154
@@ -190,14 +185,13 @@ void SIMpad::initButtons()
190#define SIMPAD_LED2_ON 0x1000 185#define SIMPAD_LED2_ON 0x1000
191#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode 186#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode
192#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit 187#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit
193#define SIMPAD_RESET_SIMCARD 0x8000 188#define SIMPAD_RESET_SIMCARD 0x8000
194 189
195//SIMpad touchscreen backlight strength control 190//SIMpad touchscreen backlight strength control
196#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" 191#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/backlight"
197#define SIMPAD_BACKLIGHT_MASK 0x00a10044
198 192
199 193
200/* 194/*
201 * The SIMpad exposes ChipSelect3 to userspace 195 * The SIMpad exposes ChipSelect3 to userspace
202 * via a proc filesystem file. Using this register 196 * via a proc filesystem file. Using this register
203 * one can toggle power of serial, irda, dect circuits 197 * one can toggle power of serial, irda, dect circuits
@@ -296,19 +290,12 @@ bool SIMpad::setLedState ( OLed l, OLedState st )
296 return true; 290 return true;
297 } 291 }
298 292
299 return false; 293 return false;
300} 294}
301 295
302
303bool SIMpad::filter ( int /*unicode*/, int /*keycode*/, int /*modifiers*/, bool /*isPress*/, bool /*autoRepeat*/ )
304{
305 //TODO
306 return false;
307}
308
309void SIMpad::timerEvent ( QTimerEvent * ) 296void SIMpad::timerEvent ( QTimerEvent * )
310{ 297{
311 killTimer ( m_power_timer ); 298 killTimer ( m_power_timer );
312 m_power_timer = 0; 299 m_power_timer = 0;
313 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); 300 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false );
314 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); 301 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false );
@@ -349,20 +336,12 @@ bool SIMpad::suspend() // Must override because SIMpad does NOT have apm
349 if ( res ) 336 if ( res )
350 ::system( "cat /tmp/.buffer > /dev/fb/0" ); 337 ::system( "cat /tmp/.buffer > /dev/fb/0" );
351 338
352 return res; 339 return res;
353} 340}
354 341
355
356bool SIMpad::setSoftSuspend ( bool soft )
357{
358 qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" );
359 return false;
360}
361
362
363bool SIMpad::setDisplayStatus ( bool on ) 342bool SIMpad::setDisplayStatus ( bool on )
364{ 343{
365 qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); 344 qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" );
366 345
367 return setCS3Bit(on, SIMPAD_DISPLAY_ON); 346 return setCS3Bit(on, SIMPAD_DISPLAY_ON);
368} 347}
@@ -377,19 +356,14 @@ bool SIMpad::setDisplayBrightness ( int bright )
377 if ( bright > 255 ) 356 if ( bright > 255 )
378 bright = 255; 357 bright = 255;
379 if ( bright < 1 ) 358 if ( bright < 1 )
380 bright = 0; 359 bright = 0;
381 360
382 if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { 361 if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) {
383 int value = 255 - bright; 362 QCString str = QFile::encodeName( QString::number(bright));
384 const int mask = SIMPAD_BACKLIGHT_MASK; 363 res = ( ::write(fd, str, str.length()) != -1 );
385 value = value << 8;
386 value += mask;
387 char writeCommand[100];
388 const int count = snprintf( writeCommand, sizeof(writeCommand), "0x%x\n", value );
389 res = ( ::write ( fd, writeCommand, count ) != -1 );
390 ::close ( fd ); 364 ::close ( fd );
391 } 365 }
392 return res; 366 return res;
393} 367}
394 368
395 369