summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 02f13b5..2873407 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1420,193 +1420,196 @@ bool Zaurus::setLedState ( OLed which, OLedState st )
1420 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; 1420 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break;
1421 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; 1421 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break;
1422 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; 1422 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break;
1423 default : ok = false; 1423 default : ok = false;
1424 } 1424 }
1425 1425
1426 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { 1426 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) {
1427 m_leds [0] = st; 1427 m_leds [0] = st;
1428 return true; 1428 return true;
1429 } 1429 }
1430 } 1430 }
1431 } 1431 }
1432 return false; 1432 return false;
1433} 1433}
1434 1434
1435bool Zaurus::setSoftSuspend ( bool soft ) 1435bool Zaurus::setSoftSuspend ( bool soft )
1436{ 1436{
1437 bool res = false; 1437 bool res = false;
1438 int fd; 1438 int fd;
1439 1439
1440 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || 1440 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) ||
1441 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { 1441 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) {
1442 1442
1443 int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources 1443 int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources
1444 1444
1445 if ( sources >= 0 ) { 1445 if ( sources >= 0 ) {
1446 if ( soft ) 1446 if ( soft )
1447 sources &= ~APM_EVT_POWER_BUTTON; 1447 sources &= ~APM_EVT_POWER_BUTTON;
1448 else 1448 else
1449 sources |= APM_EVT_POWER_BUTTON; 1449 sources |= APM_EVT_POWER_BUTTON;
1450 1450
1451 if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources 1451 if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources
1452 res = true; 1452 res = true;
1453 else 1453 else
1454 perror ( "APM_IOCGEVTSRC" ); 1454 perror ( "APM_IOCGEVTSRC" );
1455 } 1455 }
1456 else 1456 else
1457 perror ( "APM_IOCGEVTSRC" ); 1457 perror ( "APM_IOCGEVTSRC" );
1458 1458
1459 ::close ( fd ); 1459 ::close ( fd );
1460 } 1460 }
1461 else 1461 else
1462 perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); 1462 perror ( "/dev/apm_bios or /dev/misc/apm_bios" );
1463 1463
1464 return res; 1464 return res;
1465} 1465}
1466 1466
1467 1467
1468bool Zaurus::setDisplayBrightness ( int bright ) 1468bool Zaurus::setDisplayBrightness ( int bright )
1469{ 1469{
1470 bool res = false; 1470 bool res = false;
1471 int fd; 1471 int fd;
1472 1472
1473 if ( bright > 255 ) 1473 if ( bright > 255 )
1474 bright = 255; 1474 bright = 255;
1475 if ( bright < 0 ) 1475 if ( bright < 0 )
1476 bright = 0; 1476 bright = 0;
1477 1477
1478 if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { 1478 if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) {
1479 int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus 1479 int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus
1480 if ( bright && !bl ) 1480 if ( bright && !bl )
1481 bl = 1; 1481 bl = 1;
1482 res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 ); 1482 res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 );
1483 ::close ( fd ); 1483 ::close ( fd );
1484 } 1484 }
1485 return res; 1485 return res;
1486} 1486}
1487 1487
1488 1488
1489int Zaurus::displayBrightnessResolution ( ) const 1489int Zaurus::displayBrightnessResolution ( ) const
1490{ 1490{
1491 return 5; 1491 return 5;
1492} 1492}
1493 1493
1494 1494
1495/************************************************** 1495/**************************************************
1496 * 1496 *
1497 * SIMpad 1497 * SIMpad
1498 * 1498 *
1499 **************************************************/ 1499 **************************************************/
1500 1500
1501void SIMpad::init ( ) 1501void SIMpad::init ( )
1502{ 1502{
1503 d-> m_vendorstr = "SIEMENS"; 1503 d-> m_vendorstr = "SIEMENS";
1504 d-> m_vendor = Vendor_SIEMENS; 1504 d-> m_vendor = Vendor_SIEMENS;
1505 1505
1506 QFile f ( "/proc/hal/model" ); 1506 QFile f ( "/proc/hal/model" );
1507 1507
1508 //TODO Implement model checking 1508 //TODO Implement model checking
1509 //FIXME For now we assume an SL4 1509 //FIXME For now we assume an SL4
1510 1510
1511 d-> m_modelstr = "SL4"; 1511 d-> m_modelstr = "SL4";
1512 d-> m_model = Model_SIMpad_SL4; 1512 d-> m_model = Model_SIMpad_SL4;
1513 1513
1514 switch ( d-> m_model ) { 1514 switch ( d-> m_model ) {
1515 default: 1515 default:
1516 d-> m_rotation = Rot270; 1516 d-> m_rotation = Rot0;
1517 d-> m_direction = CCW;
1518 d-> m_holdtime = 1000; // 1000ms
1519
1517 break; 1520 break;
1518 } 1521 }
1519 1522
1520 f. setName ( "/etc/familiar-version" ); 1523 f. setName ( "/etc/familiar-version" );
1521 if ( f. open ( IO_ReadOnly )) { 1524 if ( f. open ( IO_ReadOnly )) {
1522 d-> m_systemstr = "Familiar"; 1525 d-> m_systemstr = "Familiar";
1523 d-> m_system = System_Familiar; 1526 d-> m_system = System_Familiar;
1524 1527
1525 QTextStream ts ( &f ); 1528 QTextStream ts ( &f );
1526 d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); 1529 d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
1527 1530
1528 f. close ( ); 1531 f. close ( );
1529 } else { 1532 } else {
1530 f. setName ( "/etc/oz_version" ); 1533 f. setName ( "/etc/oz_version" );
1531 1534
1532 if ( f. open ( IO_ReadOnly )) { 1535 if ( f. open ( IO_ReadOnly )) {
1533 d-> m_systemstr = "OpenEmbedded/SIMpad"; 1536 d-> m_systemstr = "OpenEmbedded/SIMpad";
1534 d-> m_system = System_OpenZaurus; 1537 d-> m_system = System_OpenZaurus;
1535 1538
1536 QTextStream ts ( &f ); 1539 QTextStream ts ( &f );
1537 ts.setDevice ( &f ); 1540 ts.setDevice ( &f );
1538 d-> m_sysverstr = ts. readLine ( ); 1541 d-> m_sysverstr = ts. readLine ( );
1539 f. close ( ); 1542 f. close ( );
1540 } 1543 }
1541 } 1544 }
1542 1545
1543 m_leds [0] = m_leds [1] = Led_Off; 1546 m_leds [0] = m_leds [1] = Led_Off;
1544 1547
1545 m_power_timer = 0; 1548 m_power_timer = 0;
1546 1549
1547} 1550}
1548 1551
1549void SIMpad::initButtons ( ) 1552void SIMpad::initButtons ( )
1550{ 1553{
1551 if ( d-> m_buttons ) 1554 if ( d-> m_buttons )
1552 return; 1555 return;
1553 1556
1554 if ( isQWS( ) ) 1557 if ( isQWS( ) )
1555 QWSServer::setKeyboardFilter ( this ); 1558 QWSServer::setKeyboardFilter ( this );
1556 1559
1557 d-> m_buttons = new QValueList <ODeviceButton>; 1560 d-> m_buttons = new QValueList <ODeviceButton>;
1558 1561
1559 for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { 1562 for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) {
1560 s_button *sb = simpad_buttons + i; 1563 s_button *sb = simpad_buttons + i;
1561 ODeviceButton b; 1564 ODeviceButton b;
1562 1565
1563 if (( sb-> model & d-> m_model ) == d-> m_model ) { 1566 if (( sb-> model & d-> m_model ) == d-> m_model ) {
1564 b. setKeycode ( sb-> code ); 1567 b. setKeycode ( sb-> code );
1565 b. setUserText ( QObject::tr ( "Button", sb-> utext )); 1568 b. setUserText ( QObject::tr ( "Button", sb-> utext ));
1566 b. setPixmap ( Resource::loadPixmap ( sb-> pix )); 1569 b. setPixmap ( Resource::loadPixmap ( sb-> pix ));
1567 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction )); 1570 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction ));
1568 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction )); 1571 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction ));
1569 1572
1570 d-> m_buttons-> append ( b ); 1573 d-> m_buttons-> append ( b );
1571 } 1574 }
1572 } 1575 }
1573 reloadButtonMapping ( ); 1576 reloadButtonMapping ( );
1574 1577
1575 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 1578 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
1576 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 1579 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
1577} 1580}
1578 1581
1579// SIMpad boardcontrol register CS3 1582// SIMpad boardcontrol register CS3
1580#define SIMPAD_BOARDCONTROL "/proc/cs3" 1583#define SIMPAD_BOARDCONTROL "/proc/cs3"
1581#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA 1584#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA
1582#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA 1585#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA
1583#define SIMPAD_EN1 0x0004 // This is only for EPROM's 1586#define SIMPAD_EN1 0x0004 // This is only for EPROM's
1584#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V 1587#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V
1585#define SIMPAD_DISPLAY_ON 0x0010 1588#define SIMPAD_DISPLAY_ON 0x0010
1586#define SIMPAD_PCMCIA_BUFF_DIS 0x0020 1589#define SIMPAD_PCMCIA_BUFF_DIS 0x0020
1587#define SIMPAD_MQ_RESET 0x0040 1590#define SIMPAD_MQ_RESET 0x0040
1588#define SIMPAD_PCMCIA_RESET 0x0080 1591#define SIMPAD_PCMCIA_RESET 0x0080
1589#define SIMPAD_DECT_POWER_ON 0x0100 1592#define SIMPAD_DECT_POWER_ON 0x0100
1590#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave 1593#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave
1591#define SIMPAD_RS232_ON 0x0400 1594#define SIMPAD_RS232_ON 0x0400
1592#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave 1595#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave
1593#define SIMPAD_LED2_ON 0x1000 1596#define SIMPAD_LED2_ON 0x1000
1594#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode 1597#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode
1595#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit 1598#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit
1596#define SIMPAD_RESET_SIMCARD 0x8000 1599#define SIMPAD_RESET_SIMCARD 0x8000
1597 1600
1598//SIMpad touchscreen backlight strength control 1601//SIMpad touchscreen backlight strength control
1599#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" 1602#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL"
1600#define SIMPAD_BACKLIGHT_MASK 0x00a10044 1603#define SIMPAD_BACKLIGHT_MASK 0x00a10044
1601 1604
1602QValueList <OLed> SIMpad::ledList ( ) const 1605QValueList <OLed> SIMpad::ledList ( ) const
1603{ 1606{
1604 QValueList <OLed> vl; 1607 QValueList <OLed> vl;
1605 vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? 1608 vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one?
1606 //vl << Led_Mail; //TODO find out if LED1 is accessible anyway 1609 //vl << Led_Mail; //TODO find out if LED1 is accessible anyway
1607 return vl; 1610 return vl;
1608} 1611}
1609 1612
1610QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const 1613QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const
1611{ 1614{
1612 QValueList <OLedState> vl; 1615 QValueList <OLedState> vl;