summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
Unidiff
Diffstat (limited to 'libopie/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index c0b6efa..4258d60 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -487,97 +487,97 @@ ODevice::ODevice ( )
487 d-> m_rotation = Rot0; 487 d-> m_rotation = Rot0;
488 d-> m_direction = CW; 488 d-> m_direction = CW;
489 489
490 d-> m_holdtime = 1000; // 1000ms 490 d-> m_holdtime = 1000; // 1000ms
491 d-> m_buttons = 0; 491 d-> m_buttons = 0;
492 d-> m_cpu_frequencies = new QStrList; 492 d-> m_cpu_frequencies = new QStrList;
493} 493}
494 494
495void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) 495void ODevice::systemMessage ( const QCString &msg, const QByteArray & )
496{ 496{
497 if ( msg == "deviceButtonMappingChanged()" ) { 497 if ( msg == "deviceButtonMappingChanged()" ) {
498 reloadButtonMapping ( ); 498 reloadButtonMapping ( );
499 } 499 }
500} 500}
501 501
502void ODevice::init ( ) 502void ODevice::init ( )
503{ 503{
504} 504}
505 505
506/** 506/**
507 * This method initialises the button mapping 507 * This method initialises the button mapping
508 */ 508 */
509void ODevice::initButtons ( ) 509void ODevice::initButtons ( )
510{ 510{
511 if ( d-> m_buttons ) 511 if ( d-> m_buttons )
512 return; 512 return;
513 513
514 // Simulation uses iPAQ 3660 device buttons 514 // Simulation uses iPAQ 3660 device buttons
515 515
516 qDebug ( "init Buttons" ); 516 qDebug ( "init Buttons" );
517 d-> m_buttons = new QValueList <ODeviceButton>; 517 d-> m_buttons = new QValueList <ODeviceButton>;
518 518
519 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 519 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
520 i_button *ib = ipaq_buttons + i; 520 i_button *ib = ipaq_buttons + i;
521 ODeviceButton b; 521 ODeviceButton b;
522 522
523 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { 523 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) {
524 b. setKeycode ( ib-> code ); 524 b. setKeycode ( ib-> code );
525 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 525 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
526 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 526 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
527 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 527 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
528 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 528 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
529 d-> m_buttons-> append ( b ); 529 d-> m_buttons-> append ( b );
530 } 530 }
531 } 531 }
532 reloadButtonMapping ( ); 532 reloadButtonMapping ( );
533 533
534 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 534 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
535 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 535 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
536} 536}
537 537
538ODevice::~ODevice ( ) 538ODevice::~ODevice ( )
539{ 539{
540// we leak m_devicebuttons and m_cpu_frequency 540// we leak m_devicebuttons and m_cpu_frequency
541// but it's a singleton and it is not so importantant 541// but it's a singleton and it is not so importantant
542// -zecke 542// -zecke
543 delete d; 543 delete d;
544} 544}
545 545
546bool ODevice::setSoftSuspend ( bool /*soft*/ ) 546bool ODevice::setSoftSuspend ( bool /*soft*/ )
547{ 547{
548 return false; 548 return false;
549} 549}
550 550
551//#include <linux/apm_bios.h> 551//#include <linux/apm_bios.h>
552 552
553#define APM_IOC_SUSPEND OD_IO( 'A', 2 ) 553#define APM_IOC_SUSPEND OD_IO( 'A', 2 )
554 554
555/** 555/**
556 * This method will try to suspend the device 556 * This method will try to suspend the device
557 * It only works if the user is the QWS Server and the apm application 557 * It only works if the user is the QWS Server and the apm application
558 * is installed. 558 * is installed.
559 * It tries to suspend and then waits some time cause some distributions 559 * It tries to suspend and then waits some time cause some distributions
560 * do have asynchronus apm implementations. 560 * do have asynchronus apm implementations.
561 * This method will either fail and return false or it'll suspend the 561 * This method will either fail and return false or it'll suspend the
562 * device and return once the device got woken up 562 * device and return once the device got woken up
563 * 563 *
564 * @return if the device got suspended 564 * @return if the device got suspended
565 */ 565 */
566bool ODevice::suspend ( ) 566bool ODevice::suspend ( )
567{ 567{
568 qDebug("ODevice::suspend"); 568 qDebug("ODevice::suspend");
569 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 569 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
570 return false; 570 return false;
571 571
572 if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices 572 if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
573 return false; 573 return false;
574 574
575 bool res = false; 575 bool res = false;
576 576
577 struct timeval tvs, tvn; 577 struct timeval tvs, tvn;
578 ::gettimeofday ( &tvs, 0 ); 578 ::gettimeofday ( &tvs, 0 );
579 579
580 ::sync ( ); // flush fs caches 580 ::sync ( ); // flush fs caches
581 res = ( ::system ( "apm --suspend" ) == 0 ); 581 res = ( ::system ( "apm --suspend" ) == 0 );
582 582
583 // This is needed because the iPAQ apm implementation is asynchronous and we 583 // This is needed because the iPAQ apm implementation is asynchronous and we
@@ -1067,98 +1067,98 @@ bool Yopy::isYopy ( )
1067} 1067}
1068 1068
1069void Yopy::init ( ) 1069void Yopy::init ( )
1070{ 1070{
1071 d-> m_vendorstr = "G.Mate"; 1071 d-> m_vendorstr = "G.Mate";
1072 d-> m_vendor = Vendor_GMate; 1072 d-> m_vendor = Vendor_GMate;
1073 d-> m_modelstr = "Yopy3700"; 1073 d-> m_modelstr = "Yopy3700";
1074 d-> m_model = Model_Yopy_3700; 1074 d-> m_model = Model_Yopy_3700;
1075 d-> m_rotation = Rot0; 1075 d-> m_rotation = Rot0;
1076 1076
1077 d-> m_systemstr = "Linupy"; 1077 d-> m_systemstr = "Linupy";
1078 d-> m_system = System_Linupy; 1078 d-> m_system = System_Linupy;
1079 1079
1080 QFile f ( "/etc/issue" ); 1080 QFile f ( "/etc/issue" );
1081 if ( f. open ( IO_ReadOnly )) { 1081 if ( f. open ( IO_ReadOnly )) {
1082 QTextStream ts ( &f ); 1082 QTextStream ts ( &f );
1083 ts.readLine(); 1083 ts.readLine();
1084 d-> m_sysverstr = ts. readLine ( ); 1084 d-> m_sysverstr = ts. readLine ( );
1085 f. close ( ); 1085 f. close ( );
1086 } 1086 }
1087} 1087}
1088 1088
1089void Yopy::initButtons ( ) 1089void Yopy::initButtons ( )
1090{ 1090{
1091 if ( d-> m_buttons ) 1091 if ( d-> m_buttons )
1092 return; 1092 return;
1093 1093
1094 d-> m_buttons = new QValueList <ODeviceButton>; 1094 d-> m_buttons = new QValueList <ODeviceButton>;
1095 1095
1096 for (uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof(yopy_button)); i++) { 1096 for (uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof(yopy_button)); i++) {
1097 1097
1098 yopy_button *ib = yopy_buttons + i; 1098 yopy_button *ib = yopy_buttons + i;
1099 1099
1100 ODeviceButton b; 1100 ODeviceButton b;
1101 1101
1102 b. setKeycode ( ib-> code ); 1102 b. setKeycode ( ib-> code );
1103 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 1103 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
1104 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 1104 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
1105 b. setFactoryPresetPressedAction 1105 b. setFactoryPresetPressedAction
1106 (OQCopMessage(makeChannel(ib->fpressedservice), ib->fpressedaction)); 1106 (OQCopMessage(makeChannel(ib->fpressedservice), ib->fpressedaction));
1107 b. setFactoryPresetHeldAction 1107 b. setFactoryPresetHeldAction
1108 (OQCopMessage(makeChannel(ib->fheldservice), ib->fheldaction)); 1108 (OQCopMessage(makeChannel(ib->fheldservice), ib->fheldaction));
1109 1109
1110 d-> m_buttons-> append ( b ); 1110 d-> m_buttons-> append ( b );
1111 } 1111 }
1112 reloadButtonMapping ( ); 1112 reloadButtonMapping ( );
1113 1113
1114 QCopChannel *sysch = new QCopChannel("QPE/System", this); 1114 QCopChannel *sysch = new QCopChannel("QPE/System", this);
1115 connect(sysch, SIGNAL(received(const QCString &, const QByteArray & )), 1115 connect(sysch, SIGNAL(received(const QCString&,const QByteArray&)),
1116 this, SLOT(systemMessage(const QCString &, const QByteArray & ))); 1116 this, SLOT(systemMessage(const QCString&,const QByteArray&)));
1117} 1117}
1118 1118
1119bool Yopy::suspend() 1119bool Yopy::suspend()
1120{ 1120{
1121 /* Opie for Yopy does not implement its own power management at the 1121 /* Opie for Yopy does not implement its own power management at the
1122 moment. The public version runs parallel to X, and relies on the 1122 moment. The public version runs parallel to X, and relies on the
1123 existing power management features. */ 1123 existing power management features. */
1124 return false; 1124 return false;
1125} 1125}
1126 1126
1127bool Yopy::setDisplayBrightness(int bright) 1127bool Yopy::setDisplayBrightness(int bright)
1128{ 1128{
1129 /* The code here works, but is disabled as the current version runs 1129 /* The code here works, but is disabled as the current version runs
1130 parallel to X, and relies on the existing backlight demon. */ 1130 parallel to X, and relies on the existing backlight demon. */
1131#if 0 1131#if 0
1132 if ( QFile::exists("/proc/sys/pm/light") ) { 1132 if ( QFile::exists("/proc/sys/pm/light") ) {
1133 int fd = ::open("/proc/sys/pm/light", O_WRONLY); 1133 int fd = ::open("/proc/sys/pm/light", O_WRONLY);
1134 if (fd >= 0 ) { 1134 if (fd >= 0 ) {
1135 if (bright) 1135 if (bright)
1136 ::write(fd, "1\n", 2); 1136 ::write(fd, "1\n", 2);
1137 else 1137 else
1138 ::write(fd, "0\n", 2); 1138 ::write(fd, "0\n", 2);
1139 ::close(fd); 1139 ::close(fd);
1140 return true; 1140 return true;
1141 } 1141 }
1142 } 1142 }
1143#endif 1143#endif
1144 return false; 1144 return false;
1145} 1145}
1146 1146
1147int Yopy::displayBrightnessResolution() const 1147int Yopy::displayBrightnessResolution() const
1148{ 1148{
1149 return 2; 1149 return 2;
1150} 1150}
1151 1151
1152/************************************************** 1152/**************************************************
1153 * 1153 *
1154 * iPAQ 1154 * iPAQ
1155 * 1155 *
1156 **************************************************/ 1156 **************************************************/
1157 1157
1158void iPAQ::init ( ) 1158void iPAQ::init ( )
1159{ 1159{
1160 d-> m_vendorstr = "HP"; 1160 d-> m_vendorstr = "HP";
1161 d-> m_vendor = Vendor_HP; 1161 d-> m_vendor = Vendor_HP;
1162 1162
1163 QFile f ( "/proc/hal/model" ); 1163 QFile f ( "/proc/hal/model" );
1164 1164
@@ -1216,97 +1216,97 @@ void iPAQ::init ( )
1216 if ( f. open ( IO_ReadOnly )) { 1216 if ( f. open ( IO_ReadOnly )) {
1217 d-> m_systemstr = "OpenEmbedded/iPaq"; 1217 d-> m_systemstr = "OpenEmbedded/iPaq";
1218 d-> m_system = System_Familiar; 1218 d-> m_system = System_Familiar;
1219 1219
1220 QTextStream ts ( &f ); 1220 QTextStream ts ( &f );
1221 ts.setDevice ( &f ); 1221 ts.setDevice ( &f );
1222 d-> m_sysverstr = ts. readLine ( ); 1222 d-> m_sysverstr = ts. readLine ( );
1223 f. close ( ); 1223 f. close ( );
1224 } 1224 }
1225 } 1225 }
1226 1226
1227 1227
1228 1228
1229 1229
1230 1230
1231 m_leds [0] = m_leds [1] = Led_Off; 1231 m_leds [0] = m_leds [1] = Led_Off;
1232 1232
1233 m_power_timer = 0; 1233 m_power_timer = 0;
1234 1234
1235} 1235}
1236 1236
1237void iPAQ::initButtons ( ) 1237void iPAQ::initButtons ( )
1238{ 1238{
1239 if ( d-> m_buttons ) 1239 if ( d-> m_buttons )
1240 return; 1240 return;
1241 1241
1242 if ( isQWS( ) ) 1242 if ( isQWS( ) )
1243 QWSServer::setKeyboardFilter ( this ); 1243 QWSServer::setKeyboardFilter ( this );
1244 1244
1245 d-> m_buttons = new QValueList <ODeviceButton>; 1245 d-> m_buttons = new QValueList <ODeviceButton>;
1246 1246
1247 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 1247 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
1248 i_button *ib = ipaq_buttons + i; 1248 i_button *ib = ipaq_buttons + i;
1249 ODeviceButton b; 1249 ODeviceButton b;
1250 1250
1251 if (( ib-> model & d-> m_model ) == d-> m_model ) { 1251 if (( ib-> model & d-> m_model ) == d-> m_model ) {
1252 b. setKeycode ( ib-> code ); 1252 b. setKeycode ( ib-> code );
1253 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 1253 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
1254 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 1254 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
1255 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 1255 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
1256 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 1256 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
1257 1257
1258 d-> m_buttons-> append ( b ); 1258 d-> m_buttons-> append ( b );
1259 } 1259 }
1260 } 1260 }
1261 reloadButtonMapping ( ); 1261 reloadButtonMapping ( );
1262 1262
1263 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 1263 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
1264 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 1264 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
1265} 1265}
1266 1266
1267 1267
1268//#include <linux/h3600_ts.h> // including kernel headers is evil ... 1268//#include <linux/h3600_ts.h> // including kernel headers is evil ...
1269 1269
1270typedef struct { 1270typedef struct {
1271 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ 1271 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */
1272 unsigned char TotalTime; /* Units of 5 seconds */ 1272 unsigned char TotalTime; /* Units of 5 seconds */
1273 unsigned char OnTime; /* units of 100m/s */ 1273 unsigned char OnTime; /* units of 100m/s */
1274 unsigned char OffTime; /* units of 100m/s */ 1274 unsigned char OffTime; /* units of 100m/s */
1275} LED_IN; 1275} LED_IN;
1276 1276
1277typedef struct { 1277typedef struct {
1278 unsigned char mode; 1278 unsigned char mode;
1279 unsigned char pwr; 1279 unsigned char pwr;
1280 unsigned char brightness; 1280 unsigned char brightness;
1281} FLITE_IN; 1281} FLITE_IN;
1282 1282
1283#define LED_ON OD_IOW( 'f', 5, LED_IN ) 1283#define LED_ON OD_IOW( 'f', 5, LED_IN )
1284#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) 1284#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
1285 1285
1286 1286
1287QValueList <OLed> iPAQ::ledList ( ) const 1287QValueList <OLed> iPAQ::ledList ( ) const
1288{ 1288{
1289 QValueList <OLed> vl; 1289 QValueList <OLed> vl;
1290 vl << Led_Power; 1290 vl << Led_Power;
1291 1291
1292 if ( d-> m_model == Model_iPAQ_H38xx ) 1292 if ( d-> m_model == Model_iPAQ_H38xx )
1293 vl << Led_BlueTooth; 1293 vl << Led_BlueTooth;
1294 return vl; 1294 return vl;
1295} 1295}
1296 1296
1297QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const 1297QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const
1298{ 1298{
1299 QValueList <OLedState> vl; 1299 QValueList <OLedState> vl;
1300 1300
1301 if ( l == Led_Power ) 1301 if ( l == Led_Power )
1302 vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; 1302 vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast;
1303 else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx ) 1303 else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx )
1304 vl << Led_Off; // << Led_On << ??? 1304 vl << Led_Off; // << Led_On << ???
1305 1305
1306 return vl; 1306 return vl;
1307} 1307}
1308 1308
1309OLedState iPAQ::ledState ( OLed l ) const 1309OLedState iPAQ::ledState ( OLed l ) const
1310{ 1310{
1311 switch ( l ) { 1311 switch ( l ) {
1312 case Led_Power: 1312 case Led_Power:
@@ -1702,98 +1702,98 @@ void Zaurus::init ( )
1702 case Model_Zaurus_SLB600: 1702 case Model_Zaurus_SLB600:
1703 case Model_Zaurus_SL5500: 1703 case Model_Zaurus_SL5500:
1704 case Model_Zaurus_SL5000: 1704 case Model_Zaurus_SL5000:
1705 default: 1705 default:
1706 d-> m_rotation = Rot270; 1706 d-> m_rotation = Rot270;
1707 break; 1707 break;
1708 } 1708 }
1709 m_leds [0] = Led_Off; 1709 m_leds [0] = Led_Off;
1710} 1710}
1711 1711
1712void Zaurus::initButtons ( ) 1712void Zaurus::initButtons ( )
1713{ 1713{
1714 if ( d-> m_buttons ) 1714 if ( d-> m_buttons )
1715 return; 1715 return;
1716 1716
1717 d-> m_buttons = new QValueList <ODeviceButton>; 1717 d-> m_buttons = new QValueList <ODeviceButton>;
1718 1718
1719 struct z_button * pz_buttons; 1719 struct z_button * pz_buttons;
1720 int buttoncount; 1720 int buttoncount;
1721 switch ( d-> m_model ) { 1721 switch ( d-> m_model ) {
1722 case Model_Zaurus_SLC7x0: 1722 case Model_Zaurus_SLC7x0:
1723 pz_buttons = z_buttons_c700; 1723 pz_buttons = z_buttons_c700;
1724 buttoncount = ARRAY_SIZE(z_buttons_c700); 1724 buttoncount = ARRAY_SIZE(z_buttons_c700);
1725 break; 1725 break;
1726 default: 1726 default:
1727 pz_buttons = z_buttons; 1727 pz_buttons = z_buttons;
1728 buttoncount = ARRAY_SIZE(z_buttons); 1728 buttoncount = ARRAY_SIZE(z_buttons);
1729 break; 1729 break;
1730 } 1730 }
1731 1731
1732 for ( int i = 0; i < buttoncount; i++ ) { 1732 for ( int i = 0; i < buttoncount; i++ ) {
1733 struct z_button *zb = pz_buttons + i; 1733 struct z_button *zb = pz_buttons + i;
1734 ODeviceButton b; 1734 ODeviceButton b;
1735 1735
1736 b. setKeycode ( zb-> code ); 1736 b. setKeycode ( zb-> code );
1737 b. setUserText ( QObject::tr ( "Button", zb-> utext )); 1737 b. setUserText ( QObject::tr ( "Button", zb-> utext ));
1738 b. setPixmap ( Resource::loadPixmap ( zb-> pix )); 1738 b. setPixmap ( Resource::loadPixmap ( zb-> pix ));
1739 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), 1739 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ),
1740 zb-> fpressedaction )); 1740 zb-> fpressedaction ));
1741 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), 1741 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ),
1742 zb-> fheldaction )); 1742 zb-> fheldaction ));
1743 1743
1744 d-> m_buttons-> append ( b ); 1744 d-> m_buttons-> append ( b );
1745 } 1745 }
1746 1746
1747 reloadButtonMapping ( ); 1747 reloadButtonMapping ( );
1748 1748
1749 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 1749 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
1750 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), 1750 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)),
1751 this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 1751 this, SLOT( systemMessage(const QCString&,const QByteArray&)));
1752} 1752}
1753 1753
1754#include <unistd.h> 1754#include <unistd.h>
1755#include <fcntl.h> 1755#include <fcntl.h>
1756#include <sys/ioctl.h> 1756#include <sys/ioctl.h>
1757 1757
1758//#include <asm/sharp_char.h> // including kernel headers is evil ... 1758//#include <asm/sharp_char.h> // including kernel headers is evil ...
1759 1759
1760#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 1760#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
1761 1761
1762 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1762 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1763#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1763#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1764 1764
1765#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1765#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1766#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1766#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1767#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 1767#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
1768 1768
1769/* --- for SHARP_BUZZER device --- */ 1769/* --- for SHARP_BUZZER device --- */
1770 1770
1771 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1771 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1772//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1772//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1773 1773
1774#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) 1774#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
1775#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 1775#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
1776#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 1776#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
1777#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 1777#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
1778#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 1778#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
1779 1779
1780//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1780//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1781//#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1781//#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1782 1782
1783//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ 1783//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */
1784//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ 1784//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */
1785//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ 1785//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */
1786//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ 1786//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */
1787//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ 1787//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */
1788//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ 1788//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */
1789//#define SHARP_PDA_APPSTART 9 /* application start */ 1789//#define SHARP_PDA_APPSTART 9 /* application start */
1790//#define SHARP_PDA_APPQUIT 10 /* application ends */ 1790//#define SHARP_PDA_APPQUIT 10 /* application ends */
1791 1791
1792//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 1792//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
1793//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ 1793//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */
1794//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ 1794//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */
1795//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ 1795//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */
1796// 1796//
1797 1797
1798 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1798 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1799#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) 1799#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1)
@@ -2253,97 +2253,97 @@ void SIMpad::init ( )
2253 f. close ( ); 2253 f. close ( );
2254 } else { 2254 } else {
2255 f. setName ( "/etc/oz_version" ); 2255 f. setName ( "/etc/oz_version" );
2256 2256
2257 if ( f. open ( IO_ReadOnly )) { 2257 if ( f. open ( IO_ReadOnly )) {
2258 d-> m_systemstr = "OpenEmbedded/SIMpad"; 2258 d-> m_systemstr = "OpenEmbedded/SIMpad";
2259 d-> m_system = System_OpenZaurus; 2259 d-> m_system = System_OpenZaurus;
2260 2260
2261 QTextStream ts ( &f ); 2261 QTextStream ts ( &f );
2262 ts.setDevice ( &f ); 2262 ts.setDevice ( &f );
2263 d-> m_sysverstr = ts. readLine ( ); 2263 d-> m_sysverstr = ts. readLine ( );
2264 f. close ( ); 2264 f. close ( );
2265 } 2265 }
2266 } 2266 }
2267 2267
2268 m_leds [0] = m_leds [1] = Led_Off; 2268 m_leds [0] = m_leds [1] = Led_Off;
2269 2269
2270 m_power_timer = 0; 2270 m_power_timer = 0;
2271 2271
2272} 2272}
2273 2273
2274void SIMpad::initButtons ( ) 2274void SIMpad::initButtons ( )
2275{ 2275{
2276 if ( d-> m_buttons ) 2276 if ( d-> m_buttons )
2277 return; 2277 return;
2278 2278
2279 if ( isQWS( ) ) 2279 if ( isQWS( ) )
2280 QWSServer::setKeyboardFilter ( this ); 2280 QWSServer::setKeyboardFilter ( this );
2281 2281
2282 d-> m_buttons = new QValueList <ODeviceButton>; 2282 d-> m_buttons = new QValueList <ODeviceButton>;
2283 2283
2284 for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { 2284 for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) {
2285 s_button *sb = simpad_buttons + i; 2285 s_button *sb = simpad_buttons + i;
2286 ODeviceButton b; 2286 ODeviceButton b;
2287 2287
2288 if (( sb-> model & d-> m_model ) == d-> m_model ) { 2288 if (( sb-> model & d-> m_model ) == d-> m_model ) {
2289 b. setKeycode ( sb-> code ); 2289 b. setKeycode ( sb-> code );
2290 b. setUserText ( QObject::tr ( "Button", sb-> utext )); 2290 b. setUserText ( QObject::tr ( "Button", sb-> utext ));
2291 b. setPixmap ( Resource::loadPixmap ( sb-> pix )); 2291 b. setPixmap ( Resource::loadPixmap ( sb-> pix ));
2292 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction )); 2292 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction ));
2293 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction )); 2293 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction ));
2294 2294
2295 d-> m_buttons-> append ( b ); 2295 d-> m_buttons-> append ( b );
2296 } 2296 }
2297 } 2297 }
2298 reloadButtonMapping ( ); 2298 reloadButtonMapping ( );
2299 2299
2300 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 2300 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
2301 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 2301 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
2302} 2302}
2303 2303
2304// SIMpad boardcontrol register CS3 2304// SIMpad boardcontrol register CS3
2305#define SIMPAD_BOARDCONTROL "/proc/cs3" 2305#define SIMPAD_BOARDCONTROL "/proc/cs3"
2306#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA 2306#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA
2307#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA 2307#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA
2308#define SIMPAD_EN1 0x0004 // This is only for EPROM's 2308#define SIMPAD_EN1 0x0004 // This is only for EPROM's
2309#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V 2309#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V
2310#define SIMPAD_DISPLAY_ON 0x0010 2310#define SIMPAD_DISPLAY_ON 0x0010
2311#define SIMPAD_PCMCIA_BUFF_DIS 0x0020 2311#define SIMPAD_PCMCIA_BUFF_DIS 0x0020
2312#define SIMPAD_MQ_RESET 0x0040 2312#define SIMPAD_MQ_RESET 0x0040
2313#define SIMPAD_PCMCIA_RESET 0x0080 2313#define SIMPAD_PCMCIA_RESET 0x0080
2314#define SIMPAD_DECT_POWER_ON 0x0100 2314#define SIMPAD_DECT_POWER_ON 0x0100
2315#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave 2315#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave
2316#define SIMPAD_RS232_ON 0x0400 2316#define SIMPAD_RS232_ON 0x0400
2317#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave 2317#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave
2318#define SIMPAD_LED2_ON 0x1000 2318#define SIMPAD_LED2_ON 0x1000
2319#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode 2319#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode
2320#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit 2320#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit
2321#define SIMPAD_RESET_SIMCARD 0x8000 2321#define SIMPAD_RESET_SIMCARD 0x8000
2322 2322
2323//SIMpad touchscreen backlight strength control 2323//SIMpad touchscreen backlight strength control
2324#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" 2324#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL"
2325#define SIMPAD_BACKLIGHT_MASK 0x00a10044 2325#define SIMPAD_BACKLIGHT_MASK 0x00a10044
2326 2326
2327QValueList <OLed> SIMpad::ledList ( ) const 2327QValueList <OLed> SIMpad::ledList ( ) const
2328{ 2328{
2329 QValueList <OLed> vl; 2329 QValueList <OLed> vl;
2330 vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? 2330 vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one?
2331 //vl << Led_Mail; //TODO find out if LED1 is accessible anyway 2331 //vl << Led_Mail; //TODO find out if LED1 is accessible anyway
2332 return vl; 2332 return vl;
2333} 2333}
2334 2334
2335QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const 2335QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const
2336{ 2336{
2337 QValueList <OLedState> vl; 2337 QValueList <OLedState> vl;
2338 2338
2339 if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? 2339 if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one?
2340 vl << Led_Off << Led_On; 2340 vl << Led_Off << Led_On;
2341 //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway 2341 //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway
2342 //vl << Led_Off; 2342 //vl << Led_Off;
2343 return vl; 2343 return vl;
2344} 2344}
2345 2345
2346OLedState SIMpad::ledState ( OLed l ) const 2346OLedState SIMpad::ledState ( OLed l ) const
2347{ 2347{
2348 switch ( l ) { 2348 switch ( l ) {
2349 case Led_Power: 2349 case Led_Power:
@@ -2753,94 +2753,94 @@ bool Jornada::isJornada ( )
2753void Jornada::init ( ) 2753void Jornada::init ( )
2754{ 2754{
2755 d-> m_vendorstr = "HP"; 2755 d-> m_vendorstr = "HP";
2756 d-> m_vendor = Vendor_HP; 2756 d-> m_vendor = Vendor_HP;
2757 d-> m_modelstr = "Jornada 56x"; 2757 d-> m_modelstr = "Jornada 56x";
2758 d-> m_model = Model_Jornada_56x; 2758 d-> m_model = Model_Jornada_56x;
2759 d-> m_systemstr = "Familiar"; 2759 d-> m_systemstr = "Familiar";
2760 d-> m_system = System_Familiar; 2760 d-> m_system = System_Familiar;
2761 d-> m_rotation = Rot0; 2761 d-> m_rotation = Rot0;
2762 2762
2763 QFile f ( "/etc/familiar-version" ); 2763 QFile f ( "/etc/familiar-version" );
2764 f. setName ( "/etc/familiar-version" ); 2764 f. setName ( "/etc/familiar-version" );
2765 if ( f. open ( IO_ReadOnly )) { 2765 if ( f. open ( IO_ReadOnly )) {
2766 2766
2767 QTextStream ts ( &f ); 2767 QTextStream ts ( &f );
2768 d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); 2768 d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
2769 2769
2770 f. close ( ); 2770 f. close ( );
2771 } 2771 }
2772} 2772}
2773 2773
2774#if 0 2774#if 0
2775void Jornada::initButtons ( ) 2775void Jornada::initButtons ( )
2776{ 2776{
2777 if ( d-> m_buttons ) 2777 if ( d-> m_buttons )
2778 return; 2778 return;
2779 2779
2780 // Simulation uses iPAQ 3660 device buttons 2780 // Simulation uses iPAQ 3660 device buttons
2781 2781
2782 qDebug ( "init Buttons" ); 2782 qDebug ( "init Buttons" );
2783 d-> m_buttons = new QValueList <ODeviceButton>; 2783 d-> m_buttons = new QValueList <ODeviceButton>;
2784 2784
2785 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 2785 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
2786 i_button *ib = ipaq_buttons + i; 2786 i_button *ib = ipaq_buttons + i;
2787 ODeviceButton b; 2787 ODeviceButton b;
2788 2788
2789 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { 2789 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) {
2790 b. setKeycode ( ib-> code ); 2790 b. setKeycode ( ib-> code );
2791 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 2791 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
2792 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 2792 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
2793 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 2793 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
2794 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 2794 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
2795 d-> m_buttons-> append ( b ); 2795 d-> m_buttons-> append ( b );
2796 } 2796 }
2797 } 2797 }
2798 reloadButtonMapping ( ); 2798 reloadButtonMapping ( );
2799 2799
2800 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 2800 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
2801 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 2801 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
2802} 2802}
2803#endif 2803#endif
2804int Jornada::displayBrightnessResolution ( ) const 2804int Jornada::displayBrightnessResolution ( ) const
2805{ 2805{
2806} 2806}
2807 2807
2808bool Jornada::setDisplayBrightness ( int bright ) 2808bool Jornada::setDisplayBrightness ( int bright )
2809{ 2809{
2810 bool res = false; 2810 bool res = false;
2811 int fd; 2811 int fd;
2812 2812
2813 if ( bright > 255 ) 2813 if ( bright > 255 )
2814 bright = 255; 2814 bright = 255;
2815 if ( bright < 0 ) 2815 if ( bright < 0 )
2816 bright = 0; 2816 bright = 0;
2817 2817
2818 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { 2818 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
2819 FLITE_IN bl; 2819 FLITE_IN bl;
2820 bl. mode = 1; 2820 bl. mode = 1;
2821 bl. pwr = bright ? 1 : 0; 2821 bl. pwr = bright ? 1 : 0;
2822 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; 2822 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255;
2823 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 2823 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
2824 ::close ( fd ); 2824 ::close ( fd );
2825 } 2825 }
2826 return res; 2826 return res;
2827} 2827}
2828 2828
2829bool Jornada::setSoftSuspend ( bool soft ) 2829bool Jornada::setSoftSuspend ( bool soft )
2830{ 2830{
2831 bool res = false; 2831 bool res = false;
2832 int fd; 2832 int fd;
2833 2833
2834 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { 2834 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) {
2835 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) 2835 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 )
2836 res = true; 2836 res = true;
2837 else 2837 else
2838 ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); 2838 ::perror ( "write to /proc/sys/ts/suspend_button_mode" );
2839 2839
2840 ::close ( fd ); 2840 ::close ( fd );
2841 } 2841 }
2842 else 2842 else
2843 ::perror ( "/proc/sys/ts/suspend_button_mode" ); 2843 ::perror ( "/proc/sys/ts/suspend_button_mode" );
2844 2844
2845 return res; 2845 return res;
2846} 2846}