-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 | |||
@@ -278,49 +278,49 @@ struct s_button { | |||
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"; |
@@ -1554,49 +1554,49 @@ void SIMpad::initButtons ( ) | |||
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; |
@@ -1629,51 +1629,51 @@ OLedState SIMpad::ledState ( OLed l ) const | |||
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 | ||