author | mickeyl <mickeyl> | 2003-05-19 21:22:16 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-19 21:22:16 (UTC) |
commit | 71b023064e90282346055f0fea37d9a0d84bfa1b (patch) (unidiff) | |
tree | ad82d6360ff7ef04aed5309e59e80729fcadd2a7 | |
parent | e1435cdf8522e2a932533390b72f39edfe39a24c (diff) | |
download | opie-71b023064e90282346055f0fea37d9a0d84bfa1b.zip opie-71b023064e90282346055f0fea37d9a0d84bfa1b.tar.gz opie-71b023064e90282346055f0fea37d9a0d84bfa1b.tar.bz2 |
SIMpad specific fix
-rw-r--r-- | libopie/odevice.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 921a94e..103104f 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -206,193 +206,193 @@ struct z_button { | |||
206 | char *utext; | 206 | char *utext; |
207 | char *pix; | 207 | char *pix; |
208 | char *fpressedservice; | 208 | char *fpressedservice; |
209 | char *fpressedaction; | 209 | char *fpressedaction; |
210 | char *fheldservice; | 210 | char *fheldservice; |
211 | char *fheldaction; | 211 | char *fheldaction; |
212 | } z_buttons [] = { | 212 | } z_buttons [] = { |
213 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 213 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
214 | "devicebuttons/z_calendar", | 214 | "devicebuttons/z_calendar", |
215 | "datebook", "nextView()", | 215 | "datebook", "nextView()", |
216 | "today", "raise()" }, | 216 | "today", "raise()" }, |
217 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 217 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
218 | "devicebuttons/z_contact", | 218 | "devicebuttons/z_contact", |
219 | "addressbook", "raise()", | 219 | "addressbook", "raise()", |
220 | "addressbook", "beamBusinessCard()" }, | 220 | "addressbook", "beamBusinessCard()" }, |
221 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 221 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
222 | "devicebuttons/z_home", | 222 | "devicebuttons/z_home", |
223 | "QPE/Launcher", "home()", | 223 | "QPE/Launcher", "home()", |
224 | "buttonsettings", "raise()" }, | 224 | "buttonsettings", "raise()" }, |
225 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 225 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
226 | "devicebuttons/z_menu", | 226 | "devicebuttons/z_menu", |
227 | "QPE/TaskBar", "toggleMenu()", | 227 | "QPE/TaskBar", "toggleMenu()", |
228 | "QPE/TaskBar", "toggleStartMenu()" }, | 228 | "QPE/TaskBar", "toggleStartMenu()" }, |
229 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 229 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
230 | "devicebuttons/z_mail", | 230 | "devicebuttons/z_mail", |
231 | "mail", "raise()", | 231 | "mail", "raise()", |
232 | "mail", "newMail()" }, | 232 | "mail", "newMail()" }, |
233 | }; | 233 | }; |
234 | 234 | ||
235 | struct z_button z_buttons_c700 [] = { | 235 | struct z_button z_buttons_c700 [] = { |
236 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 236 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
237 | "devicebuttons/z_calendar", | 237 | "devicebuttons/z_calendar", |
238 | "datebook", "nextView()", | 238 | "datebook", "nextView()", |
239 | "today", "raise()" }, | 239 | "today", "raise()" }, |
240 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 240 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
241 | "devicebuttons/z_contact", | 241 | "devicebuttons/z_contact", |
242 | "addressbook", "raise()", | 242 | "addressbook", "raise()", |
243 | "addressbook", "beamBusinessCard()" }, | 243 | "addressbook", "beamBusinessCard()" }, |
244 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 244 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
245 | "devicebuttons/z_home", | 245 | "devicebuttons/z_home", |
246 | "QPE/Launcher", "home()", | 246 | "QPE/Launcher", "home()", |
247 | "buttonsettings", "raise()" }, | 247 | "buttonsettings", "raise()" }, |
248 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 248 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
249 | "devicebuttons/z_menu", | 249 | "devicebuttons/z_menu", |
250 | "QPE/TaskBar", "toggleMenu()", | 250 | "QPE/TaskBar", "toggleMenu()", |
251 | "QPE/TaskBar", "toggleStartMenu()" }, | 251 | "QPE/TaskBar", "toggleStartMenu()" }, |
252 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"), | 252 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"), |
253 | "", | 253 | "", |
254 | "QPE/Rotation", "flip()", | 254 | "QPE/Rotation", "flip()", |
255 | "QPE/Rotation", "flip()" }, | 255 | "QPE/Rotation", "flip()" }, |
256 | }; | 256 | }; |
257 | 257 | ||
258 | struct s_button { | 258 | struct s_button { |
259 | uint model; | 259 | uint model; |
260 | Qt::Key code; | 260 | Qt::Key code; |
261 | char *utext; | 261 | char *utext; |
262 | char *pix; | 262 | char *pix; |
263 | char *fpressedservice; | 263 | char *fpressedservice; |
264 | char *fpressedaction; | 264 | char *fpressedaction; |
265 | char *fheldservice; | 265 | char *fheldservice; |
266 | char *fheldaction; | 266 | char *fheldaction; |
267 | } simpad_buttons [] = { | 267 | } simpad_buttons [] = { |
268 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 268 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
269 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 269 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
270 | "devicebuttons/simpad_menu", | 270 | "devicebuttons/simpad_menu", |
271 | "QPE/TaskBar", "toggleMenu()", | 271 | "QPE/TaskBar", "toggleMenu()", |
272 | "QPE/TaskBar", "toggleStartMenu()" }, | 272 | "QPE/TaskBar", "toggleStartMenu()" }, |
273 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 273 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
274 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 274 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
275 | "devicebuttons/ipaq_home", | 275 | "devicebuttons/ipaq_home", |
276 | "QPE/Launcher", "home()", | 276 | "QPE/Launcher", "home()", |
277 | "buttonsettings", "raise()" }, | 277 | "buttonsettings", "raise()" }, |
278 | }; | 278 | }; |
279 | 279 | ||
280 | static QCString makeChannel ( const char *str ) | 280 | static QCString makeChannel ( const char *str ) |
281 | { | 281 | { |
282 | if ( str && !::strchr ( str, '/' )) | 282 | if ( str && !::strchr ( str, '/' )) |
283 | return QCString ( "QPE/Application/" ) + str; | 283 | return QCString ( "QPE/Application/" ) + str; |
284 | else | 284 | else |
285 | return str; | 285 | return str; |
286 | } | 286 | } |
287 | 287 | ||
288 | static inline bool isQWS() | 288 | static inline bool isQWS() |
289 | { | 289 | { |
290 | return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | 290 | return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; |
291 | } | 291 | } |
292 | 292 | ||
293 | ODevice *ODevice::inst ( ) | 293 | ODevice *ODevice::inst ( ) |
294 | { | 294 | { |
295 | static ODevice *dev = 0; | 295 | static ODevice *dev = 0; |
296 | 296 | ||
297 | if ( !dev ) { | 297 | if ( !dev ) { |
298 | if ( QFile::exists ( "/proc/hal/model" )) | 298 | if ( QFile::exists ( "/proc/hal/model" )) |
299 | dev = new iPAQ ( ); | 299 | dev = new iPAQ ( ); |
300 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 300 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
301 | dev = new Zaurus ( ); | 301 | dev = new Zaurus ( ); |
302 | else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/CS3" )) | 302 | else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" )) |
303 | dev = new SIMpad ( ); | 303 | dev = new SIMpad ( ); |
304 | else | 304 | else |
305 | dev = new ODevice ( ); | 305 | dev = new ODevice ( ); |
306 | 306 | ||
307 | dev-> init ( ); | 307 | dev-> init ( ); |
308 | } | 308 | } |
309 | return dev; | 309 | return dev; |
310 | } | 310 | } |
311 | 311 | ||
312 | 312 | ||
313 | /************************************************** | 313 | /************************************************** |
314 | * | 314 | * |
315 | * common | 315 | * common |
316 | * | 316 | * |
317 | **************************************************/ | 317 | **************************************************/ |
318 | 318 | ||
319 | 319 | ||
320 | ODevice::ODevice ( ) | 320 | ODevice::ODevice ( ) |
321 | { | 321 | { |
322 | d = new ODeviceData; | 322 | d = new ODeviceData; |
323 | 323 | ||
324 | d-> m_modelstr = "Unknown"; | 324 | d-> m_modelstr = "Unknown"; |
325 | d-> m_model = Model_Unknown; | 325 | d-> m_model = Model_Unknown; |
326 | d-> m_vendorstr = "Unknown"; | 326 | d-> m_vendorstr = "Unknown"; |
327 | d-> m_vendor = Vendor_Unknown; | 327 | d-> m_vendor = Vendor_Unknown; |
328 | d-> m_systemstr = "Unknown"; | 328 | d-> m_systemstr = "Unknown"; |
329 | d-> m_system = System_Unknown; | 329 | d-> m_system = System_Unknown; |
330 | d-> m_sysverstr = "0.0"; | 330 | d-> m_sysverstr = "0.0"; |
331 | d-> m_rotation = Rot0; | 331 | d-> m_rotation = Rot0; |
332 | d-> m_direction = CW; | 332 | d-> m_direction = CW; |
333 | 333 | ||
334 | d-> m_holdtime = 1000; // 1000ms | 334 | d-> m_holdtime = 1000; // 1000ms |
335 | d-> m_buttons = 0; | 335 | d-> m_buttons = 0; |
336 | } | 336 | } |
337 | 337 | ||
338 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) | 338 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) |
339 | { | 339 | { |
340 | if ( msg == "deviceButtonMappingChanged()" ) { | 340 | if ( msg == "deviceButtonMappingChanged()" ) { |
341 | reloadButtonMapping ( ); | 341 | reloadButtonMapping ( ); |
342 | } | 342 | } |
343 | } | 343 | } |
344 | 344 | ||
345 | void ODevice::init ( ) | 345 | void ODevice::init ( ) |
346 | { | 346 | { |
347 | } | 347 | } |
348 | 348 | ||
349 | /** | 349 | /** |
350 | * This method initialises the button mapping | 350 | * This method initialises the button mapping |
351 | */ | 351 | */ |
352 | void ODevice::initButtons ( ) | 352 | void ODevice::initButtons ( ) |
353 | { | 353 | { |
354 | if ( d-> m_buttons ) | 354 | if ( d-> m_buttons ) |
355 | return; | 355 | return; |
356 | 356 | ||
357 | // Simulation uses iPAQ 3660 device buttons | 357 | // Simulation uses iPAQ 3660 device buttons |
358 | 358 | ||
359 | qDebug ( "init Buttons" ); | 359 | qDebug ( "init Buttons" ); |
360 | d-> m_buttons = new QValueList <ODeviceButton>; | 360 | d-> m_buttons = new QValueList <ODeviceButton>; |
361 | 361 | ||
362 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 362 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
363 | i_button *ib = ipaq_buttons + i; | 363 | i_button *ib = ipaq_buttons + i; |
364 | ODeviceButton b; | 364 | ODeviceButton b; |
365 | 365 | ||
366 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { | 366 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { |
367 | b. setKeycode ( ib-> code ); | 367 | b. setKeycode ( ib-> code ); |
368 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); | 368 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); |
369 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); | 369 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); |
370 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); | 370 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); |
371 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); | 371 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); |
372 | d-> m_buttons-> append ( b ); | 372 | d-> m_buttons-> append ( b ); |
373 | } | 373 | } |
374 | } | 374 | } |
375 | reloadButtonMapping ( ); | 375 | reloadButtonMapping ( ); |
376 | 376 | ||
377 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 377 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
378 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 378 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); |
379 | } | 379 | } |
380 | 380 | ||
381 | ODevice::~ODevice ( ) | 381 | ODevice::~ODevice ( ) |
382 | { | 382 | { |
383 | delete d; | 383 | delete d; |
384 | } | 384 | } |
385 | 385 | ||
386 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | 386 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) |
387 | { | 387 | { |
388 | return false; | 388 | return false; |
389 | } | 389 | } |
390 | 390 | ||
391 | //#include <linux/apm_bios.h> | 391 | //#include <linux/apm_bios.h> |
392 | 392 | ||
393 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | 393 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) |
394 | 394 | ||
395 | /** | 395 | /** |
396 | * This method will try to suspend the device | 396 | * This method will try to suspend the device |
397 | * It only works if the user is the QWS Server and the apm application | 397 | * It only works if the user is the QWS Server and the apm application |
398 | * is installed. | 398 | * is installed. |
@@ -1482,270 +1482,270 @@ bool Zaurus::setDisplayBrightness ( int bright ) | |||
1482 | } | 1482 | } |
1483 | return res; | 1483 | return res; |
1484 | } | 1484 | } |
1485 | 1485 | ||
1486 | 1486 | ||
1487 | int Zaurus::displayBrightnessResolution ( ) const | 1487 | int Zaurus::displayBrightnessResolution ( ) const |
1488 | { | 1488 | { |
1489 | return 5; | 1489 | return 5; |
1490 | } | 1490 | } |
1491 | 1491 | ||
1492 | 1492 | ||
1493 | /************************************************** | 1493 | /************************************************** |
1494 | * | 1494 | * |
1495 | * SIMpad | 1495 | * SIMpad |
1496 | * | 1496 | * |
1497 | **************************************************/ | 1497 | **************************************************/ |
1498 | 1498 | ||
1499 | void SIMpad::init ( ) | 1499 | void SIMpad::init ( ) |
1500 | { | 1500 | { |
1501 | d-> m_vendorstr = "SIEMENS"; | 1501 | d-> m_vendorstr = "SIEMENS"; |
1502 | d-> m_vendor = Vendor_SIEMENS; | 1502 | d-> m_vendor = Vendor_SIEMENS; |
1503 | 1503 | ||
1504 | QFile f ( "/proc/hal/model" ); | 1504 | QFile f ( "/proc/hal/model" ); |
1505 | 1505 | ||
1506 | //TODO Implement model checking | 1506 | //TODO Implement model checking |
1507 | //FIXME For now we assume an SL4 | 1507 | //FIXME For now we assume an SL4 |
1508 | 1508 | ||
1509 | d-> m_modelstr = "SL4"; | 1509 | d-> m_modelstr = "SL4"; |
1510 | d-> m_model = Model_SIMpad_SL4; | 1510 | d-> m_model = Model_SIMpad_SL4; |
1511 | 1511 | ||
1512 | switch ( d-> m_model ) { | 1512 | switch ( d-> m_model ) { |
1513 | default: | 1513 | default: |
1514 | d-> m_rotation = Rot270; | 1514 | d-> m_rotation = Rot270; |
1515 | break; | 1515 | break; |
1516 | } | 1516 | } |
1517 | 1517 | ||
1518 | f. setName ( "/etc/familiar-version" ); | 1518 | f. setName ( "/etc/familiar-version" ); |
1519 | if ( f. open ( IO_ReadOnly )) { | 1519 | if ( f. open ( IO_ReadOnly )) { |
1520 | d-> m_systemstr = "Familiar"; | 1520 | d-> m_systemstr = "Familiar"; |
1521 | d-> m_system = System_Familiar; | 1521 | d-> m_system = System_Familiar; |
1522 | 1522 | ||
1523 | QTextStream ts ( &f ); | 1523 | QTextStream ts ( &f ); |
1524 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); | 1524 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); |
1525 | 1525 | ||
1526 | f. close ( ); | 1526 | f. close ( ); |
1527 | } else { | 1527 | } else { |
1528 | f. setName ( "/etc/oz_version" ); | 1528 | f. setName ( "/etc/oz_version" ); |
1529 | 1529 | ||
1530 | if ( f. open ( IO_ReadOnly )) { | 1530 | if ( f. open ( IO_ReadOnly )) { |
1531 | d-> m_systemstr = "OpenEmbedded/SIMpad"; | 1531 | d-> m_systemstr = "OpenEmbedded/SIMpad"; |
1532 | d-> m_system = System_OpenZaurus; | 1532 | d-> m_system = System_OpenZaurus; |
1533 | 1533 | ||
1534 | QTextStream ts ( &f ); | 1534 | QTextStream ts ( &f ); |
1535 | ts.setDevice ( &f ); | 1535 | ts.setDevice ( &f ); |
1536 | d-> m_sysverstr = ts. readLine ( ); | 1536 | d-> m_sysverstr = ts. readLine ( ); |
1537 | f. close ( ); | 1537 | f. close ( ); |
1538 | } | 1538 | } |
1539 | } | 1539 | } |
1540 | 1540 | ||
1541 | m_leds [0] = m_leds [1] = Led_Off; | 1541 | m_leds [0] = m_leds [1] = Led_Off; |
1542 | 1542 | ||
1543 | m_power_timer = 0; | 1543 | m_power_timer = 0; |
1544 | 1544 | ||
1545 | } | 1545 | } |
1546 | 1546 | ||
1547 | void SIMpad::initButtons ( ) | 1547 | void SIMpad::initButtons ( ) |
1548 | { | 1548 | { |
1549 | if ( d-> m_buttons ) | 1549 | if ( d-> m_buttons ) |
1550 | return; | 1550 | return; |
1551 | 1551 | ||
1552 | if ( isQWS( ) ) | 1552 | if ( isQWS( ) ) |
1553 | QWSServer::setKeyboardFilter ( this ); | 1553 | QWSServer::setKeyboardFilter ( this ); |
1554 | 1554 | ||
1555 | d-> m_buttons = new QValueList <ODeviceButton>; | 1555 | d-> m_buttons = new QValueList <ODeviceButton>; |
1556 | 1556 | ||
1557 | for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { | 1557 | for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { |
1558 | s_button *sb = simpad_buttons + i; | 1558 | s_button *sb = simpad_buttons + i; |
1559 | ODeviceButton b; | 1559 | ODeviceButton b; |
1560 | 1560 | ||
1561 | if (( sb-> model & d-> m_model ) == d-> m_model ) { | 1561 | if (( sb-> model & d-> m_model ) == d-> m_model ) { |
1562 | b. setKeycode ( sb-> code ); | 1562 | b. setKeycode ( sb-> code ); |
1563 | b. setUserText ( QObject::tr ( "Button", sb-> utext )); | 1563 | b. setUserText ( QObject::tr ( "Button", sb-> utext )); |
1564 | b. setPixmap ( Resource::loadPixmap ( sb-> pix )); | 1564 | b. setPixmap ( Resource::loadPixmap ( sb-> pix )); |
1565 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction )); | 1565 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction )); |
1566 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction )); | 1566 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction )); |
1567 | 1567 | ||
1568 | d-> m_buttons-> append ( b ); | 1568 | d-> m_buttons-> append ( b ); |
1569 | } | 1569 | } |
1570 | } | 1570 | } |
1571 | reloadButtonMapping ( ); | 1571 | reloadButtonMapping ( ); |
1572 | 1572 | ||
1573 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 1573 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
1574 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 1574 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); |
1575 | } | 1575 | } |
1576 | 1576 | ||
1577 | // SIMpad boardcontrol register CS3 | 1577 | // SIMpad boardcontrol register CS3 |
1578 | #define SIMPAD_BOARDCONTROL "/proc/CS3" | 1578 | #define SIMPAD_BOARDCONTROL "/proc/cs3" |
1579 | #define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA | 1579 | #define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA |
1580 | #define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA | 1580 | #define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA |
1581 | #define SIMPAD_EN1 0x0004 // This is only for EPROM's | 1581 | #define SIMPAD_EN1 0x0004 // This is only for EPROM's |
1582 | #define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V | 1582 | #define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V |
1583 | #define SIMPAD_DISPLAY_ON 0x0010 | 1583 | #define SIMPAD_DISPLAY_ON 0x0010 |
1584 | #define SIMPAD_PCMCIA_BUFF_DIS 0x0020 | 1584 | #define SIMPAD_PCMCIA_BUFF_DIS 0x0020 |
1585 | #define SIMPAD_MQ_RESET 0x0040 | 1585 | #define SIMPAD_MQ_RESET 0x0040 |
1586 | #define SIMPAD_PCMCIA_RESET 0x0080 | 1586 | #define SIMPAD_PCMCIA_RESET 0x0080 |
1587 | #define SIMPAD_DECT_POWER_ON 0x0100 | 1587 | #define SIMPAD_DECT_POWER_ON 0x0100 |
1588 | #define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave | 1588 | #define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave |
1589 | #define SIMPAD_RS232_ON 0x0400 | 1589 | #define SIMPAD_RS232_ON 0x0400 |
1590 | #define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave | 1590 | #define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave |
1591 | #define SIMPAD_LED2_ON 0x1000 | 1591 | #define SIMPAD_LED2_ON 0x1000 |
1592 | #define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode | 1592 | #define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode |
1593 | #define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit | 1593 | #define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit |
1594 | #define SIMPAD_RESET_SIMCARD 0x8000 | 1594 | #define SIMPAD_RESET_SIMCARD 0x8000 |
1595 | 1595 | ||
1596 | //SIMpad touchscreen backlight strength control | 1596 | //SIMpad touchscreen backlight strength control |
1597 | #define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" | 1597 | #define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" |
1598 | #define SIMPAD_BACKLIGHT_MASK 0x00a10044 | 1598 | #define SIMPAD_BACKLIGHT_MASK 0x00a10044 |
1599 | 1599 | ||
1600 | QValueList <OLed> SIMpad::ledList ( ) const | 1600 | QValueList <OLed> SIMpad::ledList ( ) const |
1601 | { | 1601 | { |
1602 | QValueList <OLed> vl; | 1602 | QValueList <OLed> vl; |
1603 | vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? | 1603 | vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? |
1604 | //vl << Led_Mail; //TODO find out if LED1 is accessible anyway | 1604 | //vl << Led_Mail; //TODO find out if LED1 is accessible anyway |
1605 | return vl; | 1605 | return vl; |
1606 | } | 1606 | } |
1607 | 1607 | ||
1608 | QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const | 1608 | QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const |
1609 | { | 1609 | { |
1610 | QValueList <OLedState> vl; | 1610 | QValueList <OLedState> vl; |
1611 | 1611 | ||
1612 | if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? | 1612 | if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? |
1613 | vl << Led_Off << Led_On; | 1613 | vl << Led_Off << Led_On; |
1614 | //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway | 1614 | //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway |
1615 | //vl << Led_Off; | 1615 | //vl << Led_Off; |
1616 | return vl; | 1616 | return vl; |
1617 | } | 1617 | } |
1618 | 1618 | ||
1619 | OLedState SIMpad::ledState ( OLed l ) const | 1619 | OLedState SIMpad::ledState ( OLed l ) const |
1620 | { | 1620 | { |
1621 | switch ( l ) { | 1621 | switch ( l ) { |
1622 | case Led_Power: | 1622 | case Led_Power: |
1623 | return m_leds [0]; | 1623 | return m_leds [0]; |
1624 | //case Led_Mail: | 1624 | //case Led_Mail: |
1625 | //return m_leds [1]; | 1625 | //return m_leds [1]; |
1626 | default: | 1626 | default: |
1627 | return Led_Off; | 1627 | return Led_Off; |
1628 | } | 1628 | } |
1629 | } | 1629 | } |
1630 | 1630 | ||
1631 | bool SIMpad::setLedState ( OLed l, OLedState st ) | 1631 | bool SIMpad::setLedState ( OLed l, OLedState st ) |
1632 | { | 1632 | { |
1633 | static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK ); | 1633 | static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK ); |
1634 | 1634 | ||
1635 | if ( l == Led_Power ) { | 1635 | if ( l == Led_Power ) { |
1636 | if ( fd >= 0 ) { | 1636 | if ( fd >= 0 ) { |
1637 | LED_IN leds; | 1637 | LED_IN leds; |
1638 | ::memset ( &leds, 0, sizeof( leds )); | 1638 | ::memset ( &leds, 0, sizeof( leds )); |
1639 | leds. TotalTime = 0; | 1639 | leds. TotalTime = 0; |
1640 | leds. OnTime = 0; | 1640 | leds. OnTime = 0; |
1641 | leds. OffTime = 1; | 1641 | leds. OffTime = 1; |
1642 | leds. OffOnBlink = 2; | 1642 | leds. OffOnBlink = 2; |
1643 | 1643 | ||
1644 | switch ( st ) { | 1644 | switch ( st ) { |
1645 | case Led_Off : leds. OffOnBlink = 0; break; | 1645 | case Led_Off : leds. OffOnBlink = 0; break; |
1646 | case Led_On : leds. OffOnBlink = 1; break; | 1646 | case Led_On : leds. OffOnBlink = 1; break; |
1647 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; | 1647 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; |
1648 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; | 1648 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; |
1649 | } | 1649 | } |
1650 | 1650 | ||
1651 | { | 1651 | { |
1652 | /*TODO Implement this like that: | 1652 | /*TODO Implement this like that: |
1653 | read from CS3 | 1653 | read from cs3 |
1654 | && with SIMPAD_LED2_ON | 1654 | && with SIMPAD_LED2_ON |
1655 | write to CS3 */ | 1655 | write to cs3 */ |
1656 | m_leds [0] = st; | 1656 | m_leds [0] = st; |
1657 | return true; | 1657 | return true; |
1658 | } | 1658 | } |
1659 | } | 1659 | } |
1660 | } | 1660 | } |
1661 | return false; | 1661 | return false; |
1662 | } | 1662 | } |
1663 | 1663 | ||
1664 | 1664 | ||
1665 | bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 1665 | bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
1666 | { | 1666 | { |
1667 | //TODO | 1667 | //TODO |
1668 | return false; | 1668 | return false; |
1669 | } | 1669 | } |
1670 | 1670 | ||
1671 | void SIMpad::timerEvent ( QTimerEvent * ) | 1671 | void SIMpad::timerEvent ( QTimerEvent * ) |
1672 | { | 1672 | { |
1673 | killTimer ( m_power_timer ); | 1673 | killTimer ( m_power_timer ); |
1674 | m_power_timer = 0; | 1674 | m_power_timer = 0; |
1675 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 1675 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
1676 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 1676 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
1677 | } | 1677 | } |
1678 | 1678 | ||
1679 | 1679 | ||
1680 | void SIMpad::alarmSound ( ) | 1680 | void SIMpad::alarmSound ( ) |
1681 | { | 1681 | { |
1682 | #ifndef QT_NO_SOUND | 1682 | #ifndef QT_NO_SOUND |
1683 | static Sound snd ( "alarm" ); | 1683 | static Sound snd ( "alarm" ); |
1684 | int fd; | 1684 | int fd; |
1685 | int vol; | 1685 | int vol; |
1686 | bool vol_reset = false; | 1686 | bool vol_reset = false; |
1687 | 1687 | ||
1688 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | 1688 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { |
1689 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | 1689 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { |
1690 | Config cfg ( "qpe" ); | 1690 | Config cfg ( "qpe" ); |
1691 | cfg. setGroup ( "Volume" ); | 1691 | cfg. setGroup ( "Volume" ); |
1692 | 1692 | ||
1693 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 1693 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
1694 | if ( volalarm < 0 ) | 1694 | if ( volalarm < 0 ) |
1695 | volalarm = 0; | 1695 | volalarm = 0; |
1696 | else if ( volalarm > 100 ) | 1696 | else if ( volalarm > 100 ) |
1697 | volalarm = 100; | 1697 | volalarm = 100; |
1698 | volalarm |= ( volalarm << 8 ); | 1698 | volalarm |= ( volalarm << 8 ); |
1699 | 1699 | ||
1700 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 1700 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
1701 | vol_reset = true; | 1701 | vol_reset = true; |
1702 | } | 1702 | } |
1703 | } | 1703 | } |
1704 | 1704 | ||
1705 | snd. play ( ); | 1705 | snd. play ( ); |
1706 | while ( !snd. isFinished ( )) | 1706 | while ( !snd. isFinished ( )) |
1707 | qApp-> processEvents ( ); | 1707 | qApp-> processEvents ( ); |
1708 | 1708 | ||
1709 | if ( fd >= 0 ) { | 1709 | if ( fd >= 0 ) { |
1710 | if ( vol_reset ) | 1710 | if ( vol_reset ) |
1711 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 1711 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
1712 | ::close ( fd ); | 1712 | ::close ( fd ); |
1713 | } | 1713 | } |
1714 | #endif | 1714 | #endif |
1715 | } | 1715 | } |
1716 | 1716 | ||
1717 | 1717 | ||
1718 | bool SIMpad::setSoftSuspend ( bool soft ) | 1718 | bool SIMpad::setSoftSuspend ( bool soft ) |
1719 | { | 1719 | { |
1720 | //TODO | 1720 | //TODO |
1721 | return false; | 1721 | return false; |
1722 | } | 1722 | } |
1723 | 1723 | ||
1724 | 1724 | ||
1725 | bool SIMpad::setDisplayBrightness ( int bright ) | 1725 | bool SIMpad::setDisplayBrightness ( int bright ) |
1726 | { | 1726 | { |
1727 | bool res = false; | 1727 | bool res = false; |
1728 | int fd; | 1728 | int fd; |
1729 | 1729 | ||
1730 | if ( bright > 255 ) | 1730 | if ( bright > 255 ) |
1731 | bright = 255; | 1731 | bright = 255; |
1732 | if ( bright < 0 ) | 1732 | if ( bright < 0 ) |
1733 | bright = 0; | 1733 | bright = 0; |
1734 | 1734 | ||
1735 | if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { | 1735 | if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { |
1736 | int value = 255 - bright; | 1736 | int value = 255 - bright; |
1737 | const int mask = SIMPAD_BACKLIGHT_MASK; | 1737 | const int mask = SIMPAD_BACKLIGHT_MASK; |
1738 | value = value << 8; | 1738 | value = value << 8; |
1739 | value += mask; | 1739 | value += mask; |
1740 | char writeCommand[100]; | 1740 | char writeCommand[100]; |
1741 | const int count = sprintf( writeCommand, "0x%x\n", value ); | 1741 | const int count = sprintf( writeCommand, "0x%x\n", value ); |
1742 | res = ( ::write ( fd, writeCommand, count ) != -1 ); | 1742 | res = ( ::write ( fd, writeCommand, count ) != -1 ); |
1743 | ::close ( fd ); | 1743 | ::close ( fd ); |
1744 | } | 1744 | } |
1745 | return res; | 1745 | return res; |
1746 | } | 1746 | } |
1747 | 1747 | ||
1748 | 1748 | ||
1749 | int SIMpad::displayBrightnessResolution ( ) const | 1749 | int SIMpad::displayBrightnessResolution ( ) const |
1750 | { | 1750 | { |
1751 | switch ( model ( )) { | 1751 | switch ( model ( )) { |