summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp320
-rw-r--r--libopie/odevice.h11
2 files changed, 330 insertions, 1 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 7d862cd..921a94e 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -103,64 +103,90 @@ protected:
103 103
104 int m_power_timer; 104 int m_power_timer;
105 105
106 OLedState m_leds [2]; 106 OLedState m_leds [2];
107}; 107};
108 108
109class Zaurus : public ODevice { 109class Zaurus : public ODevice {
110protected: 110protected:
111 virtual void init ( ); 111 virtual void init ( );
112 virtual void initButtons ( ); 112 virtual void initButtons ( );
113 113
114public: 114public:
115 virtual bool setSoftSuspend ( bool soft ); 115 virtual bool setSoftSuspend ( bool soft );
116 116
117 virtual bool setDisplayBrightness ( int b ); 117 virtual bool setDisplayBrightness ( int b );
118 virtual int displayBrightnessResolution ( ) const; 118 virtual int displayBrightnessResolution ( ) const;
119 119
120 virtual void alarmSound ( ); 120 virtual void alarmSound ( );
121 virtual void keySound ( ); 121 virtual void keySound ( );
122 virtual void touchSound ( ); 122 virtual void touchSound ( );
123 123
124 virtual QValueList <OLed> ledList ( ) const; 124 virtual QValueList <OLed> ledList ( ) const;
125 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 125 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
126 virtual OLedState ledState ( OLed led ) const; 126 virtual OLedState ledState ( OLed led ) const;
127 virtual bool setLedState ( OLed led, OLedState st ); 127 virtual bool setLedState ( OLed led, OLedState st );
128 128
129protected: 129protected:
130 virtual void buzzer ( int snd ); 130 virtual void buzzer ( int snd );
131 131
132 OLedState m_leds [1]; 132 OLedState m_leds [1];
133}; 133};
134 134
135class SIMpad : public ODevice, public QWSServer::KeyboardFilter {
136protected:
137 virtual void init ( );
138 virtual void initButtons ( );
139
140public:
141 virtual bool setSoftSuspend ( bool soft );
142
143 virtual bool setDisplayBrightness ( int b );
144 virtual int displayBrightnessResolution ( ) const;
145
146 virtual void alarmSound ( );
147
148 virtual QValueList <OLed> ledList ( ) const;
149 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
150 virtual OLedState ledState ( OLed led ) const;
151 virtual bool setLedState ( OLed led, OLedState st );
152
153protected:
154 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
155 virtual void timerEvent ( QTimerEvent *te );
156
157 int m_power_timer;
158
159 OLedState m_leds [1]; //FIXME check if really only one
160};
135 161
136struct i_button { 162struct i_button {
137 uint model; 163 uint model;
138 Qt::Key code; 164 Qt::Key code;
139 char *utext; 165 char *utext;
140 char *pix; 166 char *pix;
141 char *fpressedservice; 167 char *fpressedservice;
142 char *fpressedaction; 168 char *fpressedaction;
143 char *fheldservice; 169 char *fheldservice;
144 char *fheldaction; 170 char *fheldaction;
145} ipaq_buttons [] = { 171} ipaq_buttons [] = {
146 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, 172 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
147 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 173 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
148 "devicebuttons/ipaq_calendar", 174 "devicebuttons/ipaq_calendar",
149 "datebook", "nextView()", 175 "datebook", "nextView()",
150 "today", "raise()" }, 176 "today", "raise()" },
151 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, 177 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
152 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 178 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
153 "devicebuttons/ipaq_contact", 179 "devicebuttons/ipaq_contact",
154 "addressbook", "raise()", 180 "addressbook", "raise()",
155 "addressbook", "beamBusinessCard()" }, 181 "addressbook", "beamBusinessCard()" },
156 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, 182 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx,
157 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 183 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
158 "devicebuttons/ipaq_menu", 184 "devicebuttons/ipaq_menu",
159 "QPE/TaskBar", "toggleMenu()", 185 "QPE/TaskBar", "toggleMenu()",
160 "QPE/TaskBar", "toggleStartMenu()" }, 186 "QPE/TaskBar", "toggleStartMenu()" },
161 { Model_iPAQ_H38xx | Model_iPAQ_H39xx, 187 { Model_iPAQ_H38xx | Model_iPAQ_H39xx,
162 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 188 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
163 "devicebuttons/ipaq_mail", 189 "devicebuttons/ipaq_mail",
164 "mail", "raise()", 190 "mail", "raise()",
165 "mail", "newMail()" }, 191 "mail", "newMail()" },
166 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, 192 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
@@ -200,86 +226,110 @@ struct z_button {
200 "devicebuttons/z_menu", 226 "devicebuttons/z_menu",
201 "QPE/TaskBar", "toggleMenu()", 227 "QPE/TaskBar", "toggleMenu()",
202 "QPE/TaskBar", "toggleStartMenu()" }, 228 "QPE/TaskBar", "toggleStartMenu()" },
203 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 229 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
204 "devicebuttons/z_mail", 230 "devicebuttons/z_mail",
205 "mail", "raise()", 231 "mail", "raise()",
206 "mail", "newMail()" }, 232 "mail", "newMail()" },
207}; 233};
208 234
209struct z_button z_buttons_c700 [] = { 235struct z_button z_buttons_c700 [] = {
210 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 236 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
211 "devicebuttons/z_calendar", 237 "devicebuttons/z_calendar",
212 "datebook", "nextView()", 238 "datebook", "nextView()",
213 "today", "raise()" }, 239 "today", "raise()" },
214 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 240 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
215 "devicebuttons/z_contact", 241 "devicebuttons/z_contact",
216 "addressbook", "raise()", 242 "addressbook", "raise()",
217 "addressbook", "beamBusinessCard()" }, 243 "addressbook", "beamBusinessCard()" },
218 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 244 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
219 "devicebuttons/z_home", 245 "devicebuttons/z_home",
220 "QPE/Launcher", "home()", 246 "QPE/Launcher", "home()",
221 "buttonsettings", "raise()" }, 247 "buttonsettings", "raise()" },
222 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 248 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
223 "devicebuttons/z_menu", 249 "devicebuttons/z_menu",
224 "QPE/TaskBar", "toggleMenu()", 250 "QPE/TaskBar", "toggleMenu()",
225 "QPE/TaskBar", "toggleStartMenu()" }, 251 "QPE/TaskBar", "toggleStartMenu()" },
226 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"), 252 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
227 "", 253 "",
228 "QPE/Rotation", "flip()", 254 "QPE/Rotation", "flip()",
229 "QPE/Rotation", "flip()" }, 255 "QPE/Rotation", "flip()" },
230}; 256};
231 257
258struct s_button {
259 uint model;
260 Qt::Key code;
261 char *utext;
262 char *pix;
263 char *fpressedservice;
264 char *fpressedaction;
265 char *fheldservice;
266 char *fheldaction;
267} simpad_buttons [] = {
268 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
269 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
270 "devicebuttons/simpad_menu",
271 "QPE/TaskBar", "toggleMenu()",
272 "QPE/TaskBar", "toggleStartMenu()" },
273 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
274 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
275 "devicebuttons/ipaq_home",
276 "QPE/Launcher", "home()",
277 "buttonsettings", "raise()" },
278};
279
232static QCString makeChannel ( const char *str ) 280static QCString makeChannel ( const char *str )
233{ 281{
234 if ( str && !::strchr ( str, '/' )) 282 if ( str && !::strchr ( str, '/' ))
235 return QCString ( "QPE/Application/" ) + str; 283 return QCString ( "QPE/Application/" ) + str;
236 else 284 else
237 return str; 285 return str;
238} 286}
239 287
240static inline bool isQWS() 288static inline bool isQWS()
241{ 289{
242 return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; 290 return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false;
243} 291}
244 292
245ODevice *ODevice::inst ( ) 293ODevice *ODevice::inst ( )
246{ 294{
247 static ODevice *dev = 0; 295 static ODevice *dev = 0;
248 296
249 if ( !dev ) { 297 if ( !dev ) {
250 if ( QFile::exists ( "/proc/hal/model" )) 298 if ( QFile::exists ( "/proc/hal/model" ))
251 dev = new iPAQ ( ); 299 dev = new iPAQ ( );
252 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" ))
253 dev = new Zaurus ( ); 301 dev = new Zaurus ( );
302 else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/CS3" ))
303 dev = new SIMpad ( );
254 else 304 else
255 dev = new ODevice ( ); 305 dev = new ODevice ( );
256 306
257 dev-> init ( ); 307 dev-> init ( );
258 } 308 }
259 return dev; 309 return dev;
260} 310}
261 311
262 312
263/************************************************** 313/**************************************************
264 * 314 *
265 * common 315 * common
266 * 316 *
267 **************************************************/ 317 **************************************************/
268 318
269 319
270ODevice::ODevice ( ) 320ODevice::ODevice ( )
271{ 321{
272 d = new ODeviceData; 322 d = new ODeviceData;
273 323
274 d-> m_modelstr = "Unknown"; 324 d-> m_modelstr = "Unknown";
275 d-> m_model = Model_Unknown; 325 d-> m_model = Model_Unknown;
276 d-> m_vendorstr = "Unknown"; 326 d-> m_vendorstr = "Unknown";
277 d-> m_vendor = Vendor_Unknown; 327 d-> m_vendor = Vendor_Unknown;
278 d-> m_systemstr = "Unknown"; 328 d-> m_systemstr = "Unknown";
279 d-> m_system = System_Unknown; 329 d-> m_system = System_Unknown;
280 d-> m_sysverstr = "0.0"; 330 d-> m_sysverstr = "0.0";
281 d-> m_rotation = Rot0; 331 d-> m_rotation = Rot0;
282 d-> m_direction = CW; 332 d-> m_direction = CW;
283 333
284 d-> m_holdtime = 1000; // 1000ms 334 d-> m_holdtime = 1000; // 1000ms
285 d-> m_buttons = 0; 335 d-> m_buttons = 0;
@@ -1411,32 +1461,302 @@ bool Zaurus::setSoftSuspend ( bool soft )
1411 1461
1412 return res; 1462 return res;
1413} 1463}
1414 1464
1415 1465
1416bool Zaurus::setDisplayBrightness ( int bright ) 1466bool Zaurus::setDisplayBrightness ( int bright )
1417{ 1467{
1418 bool res = false; 1468 bool res = false;
1419 int fd; 1469 int fd;
1420 1470
1421 if ( bright > 255 ) 1471 if ( bright > 255 )
1422 bright = 255; 1472 bright = 255;
1423 if ( bright < 0 ) 1473 if ( bright < 0 )
1424 bright = 0; 1474 bright = 0;
1425 1475
1426 if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { 1476 if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) {
1427 int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus 1477 int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus
1428 if ( bright && !bl ) 1478 if ( bright && !bl )
1429 bl = 1; 1479 bl = 1;
1430 res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 ); 1480 res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 );
1431 ::close ( fd ); 1481 ::close ( fd );
1432 } 1482 }
1433 return res; 1483 return res;
1434} 1484}
1435 1485
1436 1486
1437int Zaurus::displayBrightnessResolution ( ) const 1487int Zaurus::displayBrightnessResolution ( ) const
1438{ 1488{
1439 return 5; 1489 return 5;
1440} 1490}
1441 1491
1442 1492
1493/**************************************************
1494 *
1495 * SIMpad
1496 *
1497 **************************************************/
1498
1499void SIMpad::init ( )
1500{
1501 d-> m_vendorstr = "SIEMENS";
1502 d-> m_vendor = Vendor_SIEMENS;
1503
1504 QFile f ( "/proc/hal/model" );
1505
1506 //TODO Implement model checking
1507 //FIXME For now we assume an SL4
1508
1509 d-> m_modelstr = "SL4";
1510 d-> m_model = Model_SIMpad_SL4;
1511
1512 switch ( d-> m_model ) {
1513 default:
1514 d-> m_rotation = Rot270;
1515 break;
1516 }
1517
1518 f. setName ( "/etc/familiar-version" );
1519 if ( f. open ( IO_ReadOnly )) {
1520 d-> m_systemstr = "Familiar";
1521 d-> m_system = System_Familiar;
1522
1523 QTextStream ts ( &f );
1524 d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
1525
1526 f. close ( );
1527 } else {
1528 f. setName ( "/etc/oz_version" );
1529
1530 if ( f. open ( IO_ReadOnly )) {
1531 d-> m_systemstr = "OpenEmbedded/SIMpad";
1532 d-> m_system = System_OpenZaurus;
1533
1534 QTextStream ts ( &f );
1535 ts.setDevice ( &f );
1536 d-> m_sysverstr = ts. readLine ( );
1537 f. close ( );
1538 }
1539 }
1540
1541 m_leds [0] = m_leds [1] = Led_Off;
1542
1543 m_power_timer = 0;
1544
1545}
1546
1547void SIMpad::initButtons ( )
1548{
1549 if ( d-> m_buttons )
1550 return;
1551
1552 if ( isQWS( ) )
1553 QWSServer::setKeyboardFilter ( this );
1554
1555 d-> m_buttons = new QValueList <ODeviceButton>;
1556
1557 for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) {
1558 s_button *sb = simpad_buttons + i;
1559 ODeviceButton b;
1560
1561 if (( sb-> model & d-> m_model ) == d-> m_model ) {
1562 b. setKeycode ( sb-> code );
1563 b. setUserText ( QObject::tr ( "Button", sb-> utext ));
1564 b. setPixmap ( Resource::loadPixmap ( sb-> pix ));
1565 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction ));
1566 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction ));
1567
1568 d-> m_buttons-> append ( b );
1569 }
1570 }
1571 reloadButtonMapping ( );
1572
1573 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
1574 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
1575}
1576
1577// SIMpad boardcontrol register CS3
1578#define SIMPAD_BOARDCONTROL "/proc/CS3"
1579#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA
1580#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA
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
1583#define SIMPAD_DISPLAY_ON 0x0010
1584#define SIMPAD_PCMCIA_BUFF_DIS 0x0020
1585#define SIMPAD_MQ_RESET 0x0040
1586#define SIMPAD_PCMCIA_RESET 0x0080
1587#define SIMPAD_DECT_POWER_ON 0x0100
1588#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave
1589#define SIMPAD_RS232_ON 0x0400
1590#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave
1591#define SIMPAD_LED2_ON 0x1000
1592#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode
1593#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit
1594#define SIMPAD_RESET_SIMCARD 0x8000
1595
1596//SIMpad touchscreen backlight strength control
1597#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL"
1598#define SIMPAD_BACKLIGHT_MASK 0x00a10044
1599
1600QValueList <OLed> SIMpad::ledList ( ) const
1601{
1602 QValueList <OLed> vl;
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
1605 return vl;
1606}
1607
1608QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const
1609{
1610 QValueList <OLedState> vl;
1611
1612 if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one?
1613 vl << Led_Off << Led_On;
1614 //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway
1615 //vl << Led_Off;
1616 return vl;
1617}
1618
1619OLedState SIMpad::ledState ( OLed l ) const
1620{
1621 switch ( l ) {
1622 case Led_Power:
1623 return m_leds [0];
1624 //case Led_Mail:
1625 //return m_leds [1];
1626 default:
1627 return Led_Off;
1628 }
1629}
1630
1631bool SIMpad::setLedState ( OLed l, OLedState st )
1632{
1633 static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK );
1634
1635 if ( l == Led_Power ) {
1636 if ( fd >= 0 ) {
1637 LED_IN leds;
1638 ::memset ( &leds, 0, sizeof( leds ));
1639 leds. TotalTime = 0;
1640 leds. OnTime = 0;
1641 leds. OffTime = 1;
1642 leds. OffOnBlink = 2;
1643
1644 switch ( st ) {
1645 case Led_Off : leds. OffOnBlink = 0; break;
1646 case Led_On : leds. OffOnBlink = 1; break;
1647 case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break;
1648 case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break;
1649 }
1650
1651 {
1652 /*TODO Implement this like that:
1653 read from CS3
1654 && with SIMPAD_LED2_ON
1655 write to CS3 */
1656 m_leds [0] = st;
1657 return true;
1658 }
1659 }
1660 }
1661 return false;
1662}
1663
1664
1665bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
1666{
1667 //TODO
1668 return false;
1669}
1670
1671void SIMpad::timerEvent ( QTimerEvent * )
1672{
1673 killTimer ( m_power_timer );
1674 m_power_timer = 0;
1675 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false );
1676 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false );
1677}
1678
1679
1680void SIMpad::alarmSound ( )
1681{
1682#ifndef QT_NO_SOUND
1683 static Sound snd ( "alarm" );
1684 int fd;
1685 int vol;
1686 bool vol_reset = false;
1687
1688 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
1689 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
1690 Config cfg ( "qpe" );
1691 cfg. setGroup ( "Volume" );
1692
1693 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
1694 if ( volalarm < 0 )
1695 volalarm = 0;
1696 else if ( volalarm > 100 )
1697 volalarm = 100;
1698 volalarm |= ( volalarm << 8 );
1699
1700 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
1701 vol_reset = true;
1702 }
1703 }
1704
1705 snd. play ( );
1706 while ( !snd. isFinished ( ))
1707 qApp-> processEvents ( );
1708
1709 if ( fd >= 0 ) {
1710 if ( vol_reset )
1711 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
1712 ::close ( fd );
1713 }
1714#endif
1715}
1716
1717
1718bool SIMpad::setSoftSuspend ( bool soft )
1719{
1720 //TODO
1721 return false;
1722}
1723
1724
1725bool SIMpad::setDisplayBrightness ( int bright )
1726{
1727 bool res = false;
1728 int fd;
1729
1730 if ( bright > 255 )
1731 bright = 255;
1732 if ( bright < 0 )
1733 bright = 0;
1734
1735 if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) {
1736 int value = 255 - bright;
1737 const int mask = SIMPAD_BACKLIGHT_MASK;
1738 value = value << 8;
1739 value += mask;
1740 char writeCommand[100];
1741 const int count = sprintf( writeCommand, "0x%x\n", value );
1742 res = ( ::write ( fd, writeCommand, count ) != -1 );
1743 ::close ( fd );
1744 }
1745 return res;
1746}
1747
1748
1749int SIMpad::displayBrightnessResolution ( ) const
1750{
1751 switch ( model ( )) {
1752 case Model_SIMpad_CL4:
1753 case Model_SIMpad_SL4:
1754 case Model_SIMpad_SLC:
1755 case Model_SIMpad_TSinus:
1756 return 255; //TODO find out if this is save
1757
1758 default:
1759 return 2;
1760 }
1761}
1762
diff --git a/libopie/odevice.h b/libopie/odevice.h
index 0c55ea0..dcdd4a8 100644
--- a/libopie/odevice.h
+++ b/libopie/odevice.h
@@ -27,74 +27,83 @@
27#include <opie/odevicebutton.h> 27#include <opie/odevicebutton.h>
28 28
29#include <qpe/qpeapplication.h> /* for Transformation enum.. */ 29#include <qpe/qpeapplication.h> /* for Transformation enum.. */
30 30
31class ODeviceData; 31class ODeviceData;
32 32
33namespace Opie { 33namespace Opie {
34 34
35/** 35/**
36 * The available devices 36 * The available devices
37 */ 37 */
38enum OModel { 38enum OModel {
39 Model_Unknown, // = 0 39 Model_Unknown, // = 0
40 40
41 Model_Series_Mask = 0xff000000, 41 Model_Series_Mask = 0xff000000,
42 42
43 Model_iPAQ = ( 1 << 24 ), 43 Model_iPAQ = ( 1 << 24 ),
44 44
45 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), 45 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ),
46 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), 46 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ),
47 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), 47 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ),
48 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), 48 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ),
49 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), 49 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ),
50 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), 50 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ),
51 51
52 Model_Zaurus = ( 2 << 24 ), 52 Model_Zaurus = ( 2 << 24 ),
53 53
54 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), 54 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ),
55 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), 55 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ),
56 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), 56 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ),
57 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), 57 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ),
58 Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ), 58 Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ),
59
60 Model_SIMpad = ( 3 << 24 ),
61
62 Model_SIMpad_All = ( Model_SIMpad | 0xffffff ),
63 Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ),
64 Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ),
65 Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ),
66 Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ),
59}; 67};
60 68
61/** 69/**
62 * The vendor of the device 70 * The vendor of the device
63 */ 71 */
64enum OVendor { 72enum OVendor {
65 Vendor_Unknown, 73 Vendor_Unknown,
66 74
67 Vendor_HP, 75 Vendor_HP,
68 Vendor_Sharp 76 Vendor_Sharp,
77 Vendor_SIEMENS,
69}; 78};
70 79
71/** 80/**
72 * The System used 81 * The System used
73 */ 82 */
74enum OSystem { 83enum OSystem {
75 System_Unknown, 84 System_Unknown,
76 85
77 System_Familiar, 86 System_Familiar,
78 System_Zaurus, 87 System_Zaurus,
79 System_OpenZaurus 88 System_OpenZaurus
80}; 89};
81 90
82enum OLedState { 91enum OLedState {
83 Led_Off, 92 Led_Off,
84 Led_On, 93 Led_On,
85 Led_BlinkSlow, 94 Led_BlinkSlow,
86 Led_BlinkFast 95 Led_BlinkFast
87}; 96};
88 97
89enum OLed { 98enum OLed {
90 Led_Mail, 99 Led_Mail,
91 Led_Power, 100 Led_Power,
92 Led_BlueTooth 101 Led_BlueTooth
93}; 102};
94 103
95enum OHardKey { 104enum OHardKey {
96 HardKey_Datebook = Qt::Key_F9, 105 HardKey_Datebook = Qt::Key_F9,
97 HardKey_Contacts = Qt::Key_F10, 106 HardKey_Contacts = Qt::Key_F10,
98 HardKey_Menu = Qt::Key_F11, 107 HardKey_Menu = Qt::Key_F11,
99 HardKey_Home = Qt::Key_F12, 108 HardKey_Home = Qt::Key_F12,
100 HardKey_Mail = Qt::Key_F13, 109 HardKey_Mail = Qt::Key_F13,