summaryrefslogtreecommitdiff
path: root/libopie
authorschurig <schurig>2004-09-10 11:59:05 (UTC)
committer schurig <schurig>2004-09-10 11:59:05 (UTC)
commited70ec4945c7816ec6e899207ec8b99e20e10da5 (patch) (unidiff)
tree1b0a8adab9c7398a799f628297ed9d45a591008f /libopie
parent501c17ed2bb97f2062cb11daddeb698a6a9f2828 (diff)
downloadopie-ed70ec4945c7816ec6e899207ec8b99e20e10da5.zip
opie-ed70ec4945c7816ec6e899207ec8b99e20e10da5.tar.gz
opie-ed70ec4945c7816ec6e899207ec8b99e20e10da5.tar.bz2
removed some warnings
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 013f804..21070bf 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1009,193 +1009,193 @@ void ODevice::virtual_hook(int id, void* data){
1009 VirtHasHinge *hin = reinterpret_cast<VirtHasHinge*>( data ); 1009 VirtHasHinge *hin = reinterpret_cast<VirtHasHinge*>( data );
1010 hin->hasHinge = false; 1010 hin->hasHinge = false;
1011 break; 1011 break;
1012 } 1012 }
1013 case VIRTUAL_HINGE:{ 1013 case VIRTUAL_HINGE:{
1014 VirtHingeStatus *hin = reinterpret_cast<VirtHingeStatus*>( data ); 1014 VirtHingeStatus *hin = reinterpret_cast<VirtHingeStatus*>( data );
1015 hin->hingeStat = CASE_UNKNOWN; 1015 hin->hingeStat = CASE_UNKNOWN;
1016 break; 1016 break;
1017 } 1017 }
1018 } 1018 }
1019} 1019}
1020 1020
1021/************************************************** 1021/**************************************************
1022 * 1022 *
1023 * Yopy 3500/3700 1023 * Yopy 3500/3700
1024 * 1024 *
1025 **************************************************/ 1025 **************************************************/
1026 1026
1027bool Yopy::isYopy ( ) 1027bool Yopy::isYopy ( )
1028{ 1028{
1029 QFile f( "/proc/cpuinfo" ); 1029 QFile f( "/proc/cpuinfo" );
1030 if ( f. open ( IO_ReadOnly ) ) { 1030 if ( f. open ( IO_ReadOnly ) ) {
1031 QTextStream ts ( &f ); 1031 QTextStream ts ( &f );
1032 QString line; 1032 QString line;
1033 while( line = ts. readLine ( ) ) { 1033 while( line = ts. readLine ( ) ) {
1034 if ( line. left ( 8 ) == "Hardware" ) { 1034 if ( line. left ( 8 ) == "Hardware" ) {
1035 int loc = line. find ( ":" ); 1035 int loc = line. find ( ":" );
1036 if ( loc != -1 ) { 1036 if ( loc != -1 ) {
1037 QString model = 1037 QString model =
1038 line. mid ( loc + 2 ). simplifyWhiteSpace( ); 1038 line. mid ( loc + 2 ). simplifyWhiteSpace( );
1039 return ( model == "Yopy" ); 1039 return ( model == "Yopy" );
1040 } 1040 }
1041 } 1041 }
1042 } 1042 }
1043 } 1043 }
1044 return false; 1044 return false;
1045} 1045}
1046 1046
1047void Yopy::init ( ) 1047void Yopy::init ( )
1048{ 1048{
1049 d-> m_vendorstr = "G.Mate"; 1049 d-> m_vendorstr = "G.Mate";
1050 d-> m_vendor = Vendor_GMate; 1050 d-> m_vendor = Vendor_GMate;
1051 d-> m_modelstr = "Yopy3700"; 1051 d-> m_modelstr = "Yopy3700";
1052 d-> m_model = Model_Yopy_3700; 1052 d-> m_model = Model_Yopy_3700;
1053 d-> m_rotation = Rot0; 1053 d-> m_rotation = Rot0;
1054 1054
1055 d-> m_systemstr = "Linupy"; 1055 d-> m_systemstr = "Linupy";
1056 d-> m_system = System_Linupy; 1056 d-> m_system = System_Linupy;
1057 1057
1058 QFile f ( "/etc/issue" ); 1058 QFile f ( "/etc/issue" );
1059 if ( f. open ( IO_ReadOnly )) { 1059 if ( f. open ( IO_ReadOnly )) {
1060 QTextStream ts ( &f ); 1060 QTextStream ts ( &f );
1061 ts.readLine(); 1061 ts.readLine();
1062 d-> m_sysverstr = ts. readLine ( ); 1062 d-> m_sysverstr = ts. readLine ( );
1063 f. close ( ); 1063 f. close ( );
1064 } 1064 }
1065} 1065}
1066 1066
1067void Yopy::initButtons ( ) 1067void Yopy::initButtons ( )
1068{ 1068{
1069 if ( d-> m_buttons ) 1069 if ( d-> m_buttons )
1070 return; 1070 return;
1071 1071
1072 d-> m_buttons = new QValueList <ODeviceButton>; 1072 d-> m_buttons = new QValueList <ODeviceButton>;
1073 1073
1074 for (uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof(yopy_button)); i++) { 1074 for (uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof(yopy_button)); i++) {
1075 1075
1076 yopy_button *ib = yopy_buttons + i; 1076 yopy_button *ib = yopy_buttons + i;
1077 1077
1078 ODeviceButton b; 1078 ODeviceButton b;
1079 1079
1080 b. setKeycode ( ib-> code ); 1080 b. setKeycode ( ib-> code );
1081 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 1081 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
1082 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 1082 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
1083 b. setFactoryPresetPressedAction 1083 b. setFactoryPresetPressedAction
1084 (OQCopMessage(makeChannel(ib->fpressedservice), ib->fpressedaction)); 1084 (OQCopMessage(makeChannel(ib->fpressedservice), ib->fpressedaction));
1085 b. setFactoryPresetHeldAction 1085 b. setFactoryPresetHeldAction
1086 (OQCopMessage(makeChannel(ib->fheldservice), ib->fheldaction)); 1086 (OQCopMessage(makeChannel(ib->fheldservice), ib->fheldaction));
1087 1087
1088 d-> m_buttons-> append ( b ); 1088 d-> m_buttons-> append ( b );
1089 } 1089 }
1090 reloadButtonMapping ( ); 1090 reloadButtonMapping ( );
1091 1091
1092 QCopChannel *sysch = new QCopChannel("QPE/System", this); 1092 QCopChannel *sysch = new QCopChannel("QPE/System", this);
1093 connect(sysch, SIGNAL(received(const QCString&,const QByteArray&)), 1093 connect(sysch, SIGNAL(received(const QCString&,const QByteArray&)),
1094 this, SLOT(systemMessage(const QCString&,const QByteArray&))); 1094 this, SLOT(systemMessage(const QCString&,const QByteArray&)));
1095} 1095}
1096 1096
1097bool Yopy::suspend() 1097bool Yopy::suspend()
1098{ 1098{
1099 /* Opie for Yopy does not implement its own power management at the 1099 /* Opie for Yopy does not implement its own power management at the
1100 moment. The public version runs parallel to X, and relies on the 1100 moment. The public version runs parallel to X, and relies on the
1101 existing power management features. */ 1101 existing power management features. */
1102 return false; 1102 return false;
1103} 1103}
1104 1104
1105bool Yopy::setDisplayBrightness(int bright) 1105bool Yopy::setDisplayBrightness(int /*bright*/)
1106{ 1106{
1107 /* The code here works, but is disabled as the current version runs 1107 /* The code here works, but is disabled as the current version runs
1108 parallel to X, and relies on the existing backlight demon. */ 1108 parallel to X, and relies on the existing backlight demon. */
1109#if 0 1109#if 0
1110 if ( QFile::exists("/proc/sys/pm/light") ) { 1110 if ( QFile::exists("/proc/sys/pm/light") ) {
1111 int fd = ::open("/proc/sys/pm/light", O_WRONLY); 1111 int fd = ::open("/proc/sys/pm/light", O_WRONLY);
1112 if (fd >= 0 ) { 1112 if (fd >= 0 ) {
1113 if (bright) 1113 if (bright)
1114 ::write(fd, "1\n", 2); 1114 ::write(fd, "1\n", 2);
1115 else 1115 else
1116 ::write(fd, "0\n", 2); 1116 ::write(fd, "0\n", 2);
1117 ::close(fd); 1117 ::close(fd);
1118 return true; 1118 return true;
1119 } 1119 }
1120 } 1120 }
1121#endif 1121#endif
1122 return false; 1122 return false;
1123} 1123}
1124 1124
1125int Yopy::displayBrightnessResolution() const 1125int Yopy::displayBrightnessResolution() const
1126{ 1126{
1127 return 2; 1127 return 2;
1128} 1128}
1129 1129
1130/************************************************** 1130/**************************************************
1131 * 1131 *
1132 * iPAQ 1132 * iPAQ
1133 * 1133 *
1134 **************************************************/ 1134 **************************************************/
1135 1135
1136void iPAQ::init ( ) 1136void iPAQ::init ( )
1137{ 1137{
1138 d-> m_vendorstr = "HP"; 1138 d-> m_vendorstr = "HP";
1139 d-> m_vendor = Vendor_HP; 1139 d-> m_vendor = Vendor_HP;
1140 1140
1141 QFile f ( "/proc/hal/model" ); 1141 QFile f ( "/proc/hal/model" );
1142 1142
1143 if ( f. open ( IO_ReadOnly )) { 1143 if ( f. open ( IO_ReadOnly )) {
1144 QTextStream ts ( &f ); 1144 QTextStream ts ( &f );
1145 1145
1146 d-> m_modelstr = "H" + ts. readLine ( ); 1146 d-> m_modelstr = "H" + ts. readLine ( );
1147 1147
1148 if ( d-> m_modelstr == "H3100" ) 1148 if ( d-> m_modelstr == "H3100" )
1149 d-> m_model = Model_iPAQ_H31xx; 1149 d-> m_model = Model_iPAQ_H31xx;
1150 else if ( d-> m_modelstr == "H3600" ) 1150 else if ( d-> m_modelstr == "H3600" )
1151 d-> m_model = Model_iPAQ_H36xx; 1151 d-> m_model = Model_iPAQ_H36xx;
1152 else if ( d-> m_modelstr == "H3700" ) 1152 else if ( d-> m_modelstr == "H3700" )
1153 d-> m_model = Model_iPAQ_H37xx; 1153 d-> m_model = Model_iPAQ_H37xx;
1154 else if ( d-> m_modelstr == "H3800" ) 1154 else if ( d-> m_modelstr == "H3800" )
1155 d-> m_model = Model_iPAQ_H38xx; 1155 d-> m_model = Model_iPAQ_H38xx;
1156 else if ( d-> m_modelstr == "H3900" ) 1156 else if ( d-> m_modelstr == "H3900" )
1157 d-> m_model = Model_iPAQ_H39xx; 1157 d-> m_model = Model_iPAQ_H39xx;
1158 else if ( d-> m_modelstr == "H5400" ) 1158 else if ( d-> m_modelstr == "H5400" )
1159 d-> m_model = Model_iPAQ_H5xxx; 1159 d-> m_model = Model_iPAQ_H5xxx;
1160 else 1160 else
1161 d-> m_model = Model_Unknown; 1161 d-> m_model = Model_Unknown;
1162 1162
1163 f. close ( ); 1163 f. close ( );
1164 } 1164 }
1165 1165
1166 switch ( d-> m_model ) { 1166 switch ( d-> m_model ) {
1167 case Model_iPAQ_H31xx: 1167 case Model_iPAQ_H31xx:
1168 case Model_iPAQ_H38xx: 1168 case Model_iPAQ_H38xx:
1169 d-> m_rotation = Rot90; 1169 d-> m_rotation = Rot90;
1170 break; 1170 break;
1171 case Model_iPAQ_H36xx: 1171 case Model_iPAQ_H36xx:
1172 case Model_iPAQ_H37xx: 1172 case Model_iPAQ_H37xx:
1173 case Model_iPAQ_H39xx: 1173 case Model_iPAQ_H39xx:
1174 1174
1175 default: 1175 default:
1176 d-> m_rotation = Rot270; 1176 d-> m_rotation = Rot270;
1177 break; 1177 break;
1178 case Model_iPAQ_H5xxx: 1178 case Model_iPAQ_H5xxx:
1179 d-> m_rotation = Rot0; 1179 d-> m_rotation = Rot0;
1180 } 1180 }
1181 1181
1182 f. setName ( "/etc/familiar-version" ); 1182 f. setName ( "/etc/familiar-version" );
1183 if ( f. open ( IO_ReadOnly )) { 1183 if ( f. open ( IO_ReadOnly )) {
1184 d-> m_systemstr = "Familiar"; 1184 d-> m_systemstr = "Familiar";
1185 d-> m_system = System_Familiar; 1185 d-> m_system = System_Familiar;
1186 1186
1187 QTextStream ts ( &f ); 1187 QTextStream ts ( &f );
1188 d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); 1188 d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
1189 1189
1190 f. close ( ); 1190 f. close ( );
1191 } else { 1191 } else {
1192 f. setName ( "/etc/oz_version" ); 1192 f. setName ( "/etc/oz_version" );
1193 1193
1194 if ( f. open ( IO_ReadOnly )) { 1194 if ( f. open ( IO_ReadOnly )) {
1195 d-> m_systemstr = "OpenEmbedded/iPaq"; 1195 d-> m_systemstr = "OpenEmbedded/iPaq";
1196 d-> m_system = System_Familiar; 1196 d-> m_system = System_Familiar;
1197 1197
1198 QTextStream ts ( &f ); 1198 QTextStream ts ( &f );
1199 ts.setDevice ( &f ); 1199 ts.setDevice ( &f );
1200 d-> m_sysverstr = ts. readLine ( ); 1200 d-> m_sysverstr = ts. readLine ( );
1201 f. close ( ); 1201 f. close ( );
@@ -1575,193 +1575,192 @@ bool Zaurus::isZaurus()
1575 1575
1576 if ( model == "Sharp-Collie" 1576 if ( model == "Sharp-Collie"
1577 || model == "Collie" 1577 || model == "Collie"
1578 || model == "SHARP Corgi" 1578 || model == "SHARP Corgi"
1579 || model == "SHARP Shepherd" 1579 || model == "SHARP Shepherd"
1580 || model == "SHARP Poodle" 1580 || model == "SHARP Poodle"
1581 || model == "SHARP Husky" 1581 || model == "SHARP Husky"
1582 ) 1582 )
1583 is_zaurus = true; 1583 is_zaurus = true;
1584 1584
1585 } 1585 }
1586 return is_zaurus; 1586 return is_zaurus;
1587} 1587}
1588 1588
1589 1589
1590void Zaurus::init ( ) 1590void Zaurus::init ( )
1591{ 1591{
1592 d-> m_vendorstr = "Sharp"; 1592 d-> m_vendorstr = "Sharp";
1593 d-> m_vendor = Vendor_Sharp; 1593 d-> m_vendor = Vendor_Sharp;
1594 m_embedix = true; // Not openzaurus means: It has an embedix kernel ! 1594 m_embedix = true; // Not openzaurus means: It has an embedix kernel !
1595 1595
1596 // QFile f ( "/proc/filesystems" ); 1596 // QFile f ( "/proc/filesystems" );
1597 QString model; 1597 QString model;
1598 1598
1599 // It isn't a good idea to check the system configuration to 1599 // It isn't a good idea to check the system configuration to
1600 // detect the distribution ! 1600 // detect the distribution !
1601 // Otherwise it may happen that any other distribution is detected as openzaurus, just 1601 // Otherwise it may happen that any other distribution is detected as openzaurus, just
1602 // because it uses a jffs2 filesystem.. 1602 // because it uses a jffs2 filesystem..
1603 // (eilers) 1603 // (eilers)
1604 // if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { 1604 // if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) {
1605 QFile f ("/etc/oz_version"); 1605 QFile f ("/etc/oz_version");
1606 if ( f.exists() ){ 1606 if ( f.exists() ){
1607 d-> m_vendorstr = "OpenZaurus Team"; 1607 d-> m_vendorstr = "OpenZaurus Team";
1608 d-> m_systemstr = "OpenZaurus"; 1608 d-> m_systemstr = "OpenZaurus";
1609 d-> m_system = System_OpenZaurus; 1609 d-> m_system = System_OpenZaurus;
1610 1610
1611 if ( f. open ( IO_ReadOnly )) { 1611 if ( f. open ( IO_ReadOnly )) {
1612 QTextStream ts ( &f ); 1612 QTextStream ts ( &f );
1613 d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); 1613 d-> m_sysverstr = ts. readLine ( );//. mid ( 10 );
1614 f. close ( ); 1614 f. close ( );
1615 } 1615 }
1616 1616
1617 // Openzaurus sometimes uses the embedix kernel! 1617 // Openzaurus sometimes uses the embedix kernel!
1618 // => Check whether this is an embedix kernel 1618 // => Check whether this is an embedix kernel
1619 FILE *uname = popen("uname -r", "r"); 1619 FILE *uname = popen("uname -r", "r");
1620 QString line; 1620 QString line;
1621 if ( f.open(IO_ReadOnly, uname) ) { 1621 if ( f.open(IO_ReadOnly, uname) ) {
1622 QTextStream ts ( &f ); 1622 QTextStream ts ( &f );
1623 line = ts. readLine ( ); 1623 line = ts. readLine ( );
1624 int loc = line. find ( "embedix" ); 1624 int loc = line. find ( "embedix" );
1625 if ( loc != -1 ) 1625 if ( loc != -1 )
1626 m_embedix = true; 1626 m_embedix = true;
1627 else 1627 else
1628 m_embedix = false; 1628 m_embedix = false;
1629 f. close ( ); 1629 f. close ( );
1630 } 1630 }
1631 pclose(uname); 1631 pclose(uname);
1632 } 1632 }
1633 else { 1633 else {
1634 d-> m_systemstr = "Zaurus"; 1634 d-> m_systemstr = "Zaurus";
1635 d-> m_system = System_Zaurus; 1635 d-> m_system = System_Zaurus;
1636 } 1636 }
1637 1637
1638 f. setName ( "/proc/cpuinfo" ); 1638 f. setName ( "/proc/cpuinfo" );
1639 if ( f. open ( IO_ReadOnly ) ) { 1639 if ( f. open ( IO_ReadOnly ) ) {
1640 QTextStream ts ( &f ); 1640 QTextStream ts ( &f );
1641 QString line; 1641 QString line;
1642 while( line = ts. readLine ( ) ) { 1642 while( line = ts. readLine ( ) ) {
1643 if ( line. left ( 8 ) == "Hardware" ) 1643 if ( line. left ( 8 ) == "Hardware" )
1644 break; 1644 break;
1645 } 1645 }
1646 int loc = line. find ( ":" ); 1646 int loc = line. find ( ":" );
1647 if ( loc != -1 ) 1647 if ( loc != -1 )
1648 model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); 1648 model = line. mid ( loc + 2 ). simplifyWhiteSpace( );
1649 } 1649 }
1650 1650
1651 if ( model == "SHARP Corgi" ) { 1651 if ( model == "SHARP Corgi" ) {
1652 d-> m_model = Model_Zaurus_SLC7x0; 1652 d-> m_model = Model_Zaurus_SLC7x0;
1653 d-> m_modelstr = "Zaurus SL-C700"; 1653 d-> m_modelstr = "Zaurus SL-C700";
1654 } else if ( model == "SHARP Shepherd" ) { 1654 } else if ( model == "SHARP Shepherd" ) {
1655 d-> m_model = Model_Zaurus_SLC7x0; 1655 d-> m_model = Model_Zaurus_SLC7x0;
1656 d-> m_modelstr = "Zaurus SL-C750"; 1656 d-> m_modelstr = "Zaurus SL-C750";
1657 } else if ( model == "SHARP Husky" ) { 1657 } else if ( model == "SHARP Husky" ) {
1658 d-> m_model = Model_Zaurus_SLC7x0; 1658 d-> m_model = Model_Zaurus_SLC7x0;
1659 d-> m_modelstr = "Zaurus SL-C760"; 1659 d-> m_modelstr = "Zaurus SL-C760";
1660 } else if ( model == "SHARP Poodle" ) { 1660 } else if ( model == "SHARP Poodle" ) {
1661 d-> m_model = Model_Zaurus_SLB600; 1661 d-> m_model = Model_Zaurus_SLB600;
1662 d-> m_modelstr = "Zaurus SL-B500 or SL-5600"; 1662 d-> m_modelstr = "Zaurus SL-B500 or SL-5600";
1663 } else if ( model == "Sharp-Collie" || model == "Collie" ) { 1663 } else if ( model == "Sharp-Collie" || model == "Collie" ) {
1664 d-> m_model = Model_Zaurus_SL5500; 1664 d-> m_model = Model_Zaurus_SL5500;
1665 d-> m_modelstr = "Zaurus SL-5500 or SL-5000d"; 1665 d-> m_modelstr = "Zaurus SL-5500 or SL-5000d";
1666 } else { 1666 } else {
1667 d-> m_model = Model_Zaurus_SL5500; 1667 d-> m_model = Model_Zaurus_SL5500;
1668 d-> m_modelstr = "Zaurus (Model unknown)"; 1668 d-> m_modelstr = "Zaurus (Model unknown)";
1669 } 1669 }
1670 1670
1671 bool flipstate = false;
1672 switch ( d-> m_model ) { 1671 switch ( d-> m_model ) {
1673 case Model_Zaurus_SLA300: 1672 case Model_Zaurus_SLA300:
1674 d-> m_rotation = Rot0; 1673 d-> m_rotation = Rot0;
1675 break; 1674 break;
1676 case Model_Zaurus_SLC7x0: 1675 case Model_Zaurus_SLC7x0:
1677 d-> m_rotation = rotation(); 1676 d-> m_rotation = rotation();
1678 d-> m_direction = direction(); 1677 d-> m_direction = direction();
1679 break; 1678 break;
1680 case Model_Zaurus_SLB600: 1679 case Model_Zaurus_SLB600:
1681 case Model_Zaurus_SL5500: 1680 case Model_Zaurus_SL5500:
1682 case Model_Zaurus_SL5000: 1681 case Model_Zaurus_SL5000:
1683 default: 1682 default:
1684 d-> m_rotation = Rot270; 1683 d-> m_rotation = Rot270;
1685 break; 1684 break;
1686 } 1685 }
1687 m_leds [0] = Led_Off; 1686 m_leds [0] = Led_Off;
1688} 1687}
1689 1688
1690void Zaurus::initButtons ( ) 1689void Zaurus::initButtons ( )
1691{ 1690{
1692 if ( d-> m_buttons ) 1691 if ( d-> m_buttons )
1693 return; 1692 return;
1694 1693
1695 d-> m_buttons = new QValueList <ODeviceButton>; 1694 d-> m_buttons = new QValueList <ODeviceButton>;
1696 1695
1697 struct z_button * pz_buttons; 1696 struct z_button * pz_buttons;
1698 int buttoncount; 1697 int buttoncount;
1699 switch ( d-> m_model ) { 1698 switch ( d-> m_model ) {
1700 case Model_Zaurus_SLC7x0: 1699 case Model_Zaurus_SLC7x0:
1701 pz_buttons = z_buttons_c700; 1700 pz_buttons = z_buttons_c700;
1702 buttoncount = ARRAY_SIZE(z_buttons_c700); 1701 buttoncount = ARRAY_SIZE(z_buttons_c700);
1703 break; 1702 break;
1704 default: 1703 default:
1705 pz_buttons = z_buttons; 1704 pz_buttons = z_buttons;
1706 buttoncount = ARRAY_SIZE(z_buttons); 1705 buttoncount = ARRAY_SIZE(z_buttons);
1707 break; 1706 break;
1708 } 1707 }
1709 1708
1710 for ( int i = 0; i < buttoncount; i++ ) { 1709 for ( int i = 0; i < buttoncount; i++ ) {
1711 struct z_button *zb = pz_buttons + i; 1710 struct z_button *zb = pz_buttons + i;
1712 ODeviceButton b; 1711 ODeviceButton b;
1713 1712
1714 b. setKeycode ( zb-> code ); 1713 b. setKeycode ( zb-> code );
1715 b. setUserText ( QObject::tr ( "Button", zb-> utext )); 1714 b. setUserText ( QObject::tr ( "Button", zb-> utext ));
1716 b. setPixmap ( Resource::loadPixmap ( zb-> pix )); 1715 b. setPixmap ( Resource::loadPixmap ( zb-> pix ));
1717 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), 1716 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ),
1718 zb-> fpressedaction )); 1717 zb-> fpressedaction ));
1719 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), 1718 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ),
1720 zb-> fheldaction )); 1719 zb-> fheldaction ));
1721 1720
1722 d-> m_buttons-> append ( b ); 1721 d-> m_buttons-> append ( b );
1723 } 1722 }
1724 1723
1725 reloadButtonMapping ( ); 1724 reloadButtonMapping ( );
1726 1725
1727 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 1726 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
1728 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), 1727 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)),
1729 this, SLOT( systemMessage(const QCString&,const QByteArray&))); 1728 this, SLOT( systemMessage(const QCString&,const QByteArray&)));
1730} 1729}
1731 1730
1732#include <unistd.h> 1731#include <unistd.h>
1733#include <fcntl.h> 1732#include <fcntl.h>
1734#include <sys/ioctl.h> 1733#include <sys/ioctl.h>
1735 1734
1736//#include <asm/sharp_char.h> // including kernel headers is evil ... 1735//#include <asm/sharp_char.h> // including kernel headers is evil ...
1737 1736
1738#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 1737#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
1739 1738
1740 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1739 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1741#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1740#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1742 1741
1743#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1742#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1744#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1743#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1745#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 1744#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
1746 1745
1747/* --- for SHARP_BUZZER device --- */ 1746/* --- for SHARP_BUZZER device --- */
1748 1747
1749 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1748 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1750//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1749//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1751 1750
1752#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) 1751#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
1753#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 1752#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
1754#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 1753#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
1755#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 1754#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
1756#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 1755#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
1757 1756
1758//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1757//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1759//#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1758//#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1760 1759
1761//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ 1760//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */
1762//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ 1761//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */
1763//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ 1762//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */
1764//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ 1763//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */
1765//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ 1764//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */
1766//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ 1765//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */
1767//#define SHARP_PDA_APPSTART 9 /* application start */ 1766//#define SHARP_PDA_APPSTART 9 /* application start */
@@ -2274,276 +2273,275 @@ void SIMpad::initButtons ( )
2274 } 2273 }
2275 } 2274 }
2276 reloadButtonMapping ( ); 2275 reloadButtonMapping ( );
2277 2276
2278 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 2277 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
2279 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); 2278 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
2280} 2279}
2281 2280
2282// SIMpad boardcontrol register CS3 2281// SIMpad boardcontrol register CS3
2283#define SIMPAD_BOARDCONTROL "/proc/cs3" 2282#define SIMPAD_BOARDCONTROL "/proc/cs3"
2284#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA 2283#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA
2285#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA 2284#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA
2286#define SIMPAD_EN1 0x0004 // This is only for EPROM's 2285#define SIMPAD_EN1 0x0004 // This is only for EPROM's
2287#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V 2286#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V
2288#define SIMPAD_DISPLAY_ON 0x0010 2287#define SIMPAD_DISPLAY_ON 0x0010
2289#define SIMPAD_PCMCIA_BUFF_DIS 0x0020 2288#define SIMPAD_PCMCIA_BUFF_DIS 0x0020
2290#define SIMPAD_MQ_RESET 0x0040 2289#define SIMPAD_MQ_RESET 0x0040
2291#define SIMPAD_PCMCIA_RESET 0x0080 2290#define SIMPAD_PCMCIA_RESET 0x0080
2292#define SIMPAD_DECT_POWER_ON 0x0100 2291#define SIMPAD_DECT_POWER_ON 0x0100
2293#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave 2292#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave
2294#define SIMPAD_RS232_ON 0x0400 2293#define SIMPAD_RS232_ON 0x0400
2295#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave 2294#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave
2296#define SIMPAD_LED2_ON 0x1000 2295#define SIMPAD_LED2_ON 0x1000
2297#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode 2296#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode
2298#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit 2297#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit
2299#define SIMPAD_RESET_SIMCARD 0x8000 2298#define SIMPAD_RESET_SIMCARD 0x8000
2300 2299
2301//SIMpad touchscreen backlight strength control 2300//SIMpad touchscreen backlight strength control
2302#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" 2301#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL"
2303#define SIMPAD_BACKLIGHT_MASK 0x00a10044 2302#define SIMPAD_BACKLIGHT_MASK 0x00a10044
2304 2303
2305QValueList <OLed> SIMpad::ledList ( ) const 2304QValueList <OLed> SIMpad::ledList ( ) const
2306{ 2305{
2307 QValueList <OLed> vl; 2306 QValueList <OLed> vl;
2308 vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? 2307 vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one?
2309 //vl << Led_Mail; //TODO find out if LED1 is accessible anyway 2308 //vl << Led_Mail; //TODO find out if LED1 is accessible anyway
2310 return vl; 2309 return vl;
2311} 2310}
2312 2311
2313QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const 2312QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const
2314{ 2313{
2315 QValueList <OLedState> vl; 2314 QValueList <OLedState> vl;
2316 2315
2317 if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? 2316 if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one?
2318 vl << Led_Off << Led_On; 2317 vl << Led_Off << Led_On;
2319 //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway 2318 //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway
2320 //vl << Led_Off; 2319 //vl << Led_Off;
2321 return vl; 2320 return vl;
2322} 2321}
2323 2322
2324OLedState SIMpad::ledState ( OLed l ) const 2323OLedState SIMpad::ledState ( OLed l ) const
2325{ 2324{
2326 switch ( l ) { 2325 switch ( l ) {
2327 case Led_Power: 2326 case Led_Power:
2328 return m_leds [0]; 2327 return m_leds [0];
2329 //case Led_Mail: 2328 //case Led_Mail:
2330 //return m_leds [1]; 2329 //return m_leds [1];
2331 default: 2330 default:
2332 return Led_Off; 2331 return Led_Off;
2333 } 2332 }
2334} 2333}
2335 2334
2336bool SIMpad::setLedState ( OLed l, OLedState st ) 2335bool SIMpad::setLedState ( OLed l, OLedState st )
2337{ 2336{
2338 static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK ); 2337 static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK );
2339 2338
2340 if ( l == Led_Power ) { 2339 if ( l == Led_Power ) {
2341 if ( fd >= 0 ) { 2340 if ( fd >= 0 ) {
2342 LED_IN leds; 2341 LED_IN leds;
2343 ::memset ( &leds, 0, sizeof( leds )); 2342 ::memset ( &leds, 0, sizeof( leds ));
2344 leds. TotalTime = 0; 2343 leds. TotalTime = 0;
2345 leds. OnTime = 0; 2344 leds. OnTime = 0;
2346 leds. OffTime = 1; 2345 leds. OffTime = 1;
2347 leds. OffOnBlink = 2; 2346 leds. OffOnBlink = 2;
2348 2347
2349 switch ( st ) { 2348 switch ( st ) {
2350 case Led_Off : leds. OffOnBlink = 0; break; 2349 case Led_Off : leds. OffOnBlink = 0; break;
2351 case Led_On : leds. OffOnBlink = 1; break; 2350 case Led_On : leds. OffOnBlink = 1; break;
2352 case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; 2351 case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break;
2353 case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; 2352 case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break;
2354 } 2353 }
2355 2354
2356 { 2355 {
2357 /*TODO Implement this like that: 2356 /*TODO Implement this like that:
2358 read from cs3 2357 read from cs3
2359 && with SIMPAD_LED2_ON 2358 && with SIMPAD_LED2_ON
2360 write to cs3 */ 2359 write to cs3 */
2361 m_leds [0] = st; 2360 m_leds [0] = st;
2362 return true; 2361 return true;
2363 } 2362 }
2364 } 2363 }
2365 } 2364 }
2366 return false; 2365 return false;
2367} 2366}
2368 2367
2369 2368
2370bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) 2369bool SIMpad::filter ( int /*unicode*/, int /*keycode*/, int /*modifiers*/, bool /*isPress*/, bool /*autoRepeat*/ )
2371{ 2370{
2372 //TODO 2371 //TODO
2373 return false; 2372 return false;
2374} 2373}
2375 2374
2376void SIMpad::timerEvent ( QTimerEvent * ) 2375void SIMpad::timerEvent ( QTimerEvent * )
2377{ 2376{
2378 killTimer ( m_power_timer ); 2377 killTimer ( m_power_timer );
2379 m_power_timer = 0; 2378 m_power_timer = 0;
2380 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); 2379 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false );
2381 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); 2380 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false );
2382} 2381}
2383 2382
2384 2383
2385void SIMpad::alarmSound ( ) 2384void SIMpad::alarmSound ( )
2386{ 2385{
2387#ifndef QT_NO_SOUND 2386#ifndef QT_NO_SOUND
2388 static Sound snd ( "alarm" ); 2387 static Sound snd ( "alarm" );
2389 int fd; 2388 int fd;
2390 int vol; 2389 int vol;
2391 bool vol_reset = false; 2390 bool vol_reset = false;
2392 2391
2393 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { 2392 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
2394 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { 2393 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
2395 Config cfg ( "qpe" ); 2394 Config cfg ( "qpe" );
2396 cfg. setGroup ( "Volume" ); 2395 cfg. setGroup ( "Volume" );
2397 2396
2398 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); 2397 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
2399 if ( volalarm < 0 ) 2398 if ( volalarm < 0 )
2400 volalarm = 0; 2399 volalarm = 0;
2401 else if ( volalarm > 100 ) 2400 else if ( volalarm > 100 )
2402 volalarm = 100; 2401 volalarm = 100;
2403 volalarm |= ( volalarm << 8 ); 2402 volalarm |= ( volalarm << 8 );
2404 2403
2405 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) 2404 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
2406 vol_reset = true; 2405 vol_reset = true;
2407 } 2406 }
2408 } 2407 }
2409 2408
2410 snd. play ( ); 2409 snd. play ( );
2411 while ( !snd. isFinished ( )) 2410 while ( !snd. isFinished ( ))
2412 qApp-> processEvents ( ); 2411 qApp-> processEvents ( );
2413 2412
2414 if ( fd >= 0 ) { 2413 if ( fd >= 0 ) {
2415 if ( vol_reset ) 2414 if ( vol_reset )
2416 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); 2415 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
2417 ::close ( fd ); 2416 ::close ( fd );
2418 } 2417 }
2419#endif 2418#endif
2420} 2419}
2421 2420
2422 2421
2423bool SIMpad::suspend ( ) // Must override because SIMpad does NOT have apm 2422bool SIMpad::suspend ( ) // Must override because SIMpad does NOT have apm
2424{ 2423{
2425 qDebug( "ODevice for SIMpad: suspend()" ); 2424 qDebug( "ODevice for SIMpad: suspend()" );
2426 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 2425 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
2427 return false; 2426 return false;
2428 2427
2429 bool res = false; 2428 bool res = false;
2430 2429
2431 struct timeval tvs, tvn; 2430 struct timeval tvs;
2432 ::gettimeofday ( &tvs, 0 ); 2431 ::gettimeofday ( &tvs, 0 );
2433 2432
2434 ::sync ( ); // flush fs caches 2433 ::sync ( ); // flush fs caches
2435 res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :) 2434 res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :)
2436 2435
2437 return res; 2436 return res;
2438} 2437}
2439 2438
2440 2439
2441bool SIMpad::setSoftSuspend ( bool soft ) 2440bool SIMpad::setSoftSuspend ( bool soft )
2442{ 2441{
2443 qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" ); 2442 qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" );
2444 return false; 2443 return false;
2445} 2444}
2446 2445
2447 2446
2448bool SIMpad::setDisplayStatus ( bool on ) 2447bool SIMpad::setDisplayStatus ( bool on )
2449{ 2448{
2450 qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); 2449 qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" );
2451 2450
2452 bool res = false; 2451 bool res = false;
2453 int fd;
2454 2452
2455 QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :) 2453 QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :)
2456 2454
2457 res = ( ::system( (const char*) cmdline ) == 0 ); 2455 res = ( ::system( (const char*) cmdline ) == 0 );
2458 2456
2459 return res; 2457 return res;
2460} 2458}
2461 2459
2462 2460
2463bool SIMpad::setDisplayBrightness ( int bright ) 2461bool SIMpad::setDisplayBrightness ( int bright )
2464{ 2462{
2465 qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright ); 2463 qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright );
2466 bool res = false; 2464 bool res = false;
2467 int fd; 2465 int fd;
2468 2466
2469 if ( bright > 255 ) 2467 if ( bright > 255 )
2470 bright = 255; 2468 bright = 255;
2471 if ( bright < 1 ) 2469 if ( bright < 1 )
2472 bright = 0; 2470 bright = 0;
2473 2471
2474 if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { 2472 if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) {
2475 int value = 255 - bright; 2473 int value = 255 - bright;
2476 const int mask = SIMPAD_BACKLIGHT_MASK; 2474 const int mask = SIMPAD_BACKLIGHT_MASK;
2477 value = value << 8; 2475 value = value << 8;
2478 value += mask; 2476 value += mask;
2479 char writeCommand[100]; 2477 char writeCommand[100];
2480 const int count = sprintf( writeCommand, "0x%x\n", value ); 2478 const int count = sprintf( writeCommand, "0x%x\n", value );
2481 res = ( ::write ( fd, writeCommand, count ) != -1 ); 2479 res = ( ::write ( fd, writeCommand, count ) != -1 );
2482 ::close ( fd ); 2480 ::close ( fd );
2483 } 2481 }
2484 return res; 2482 return res;
2485} 2483}
2486 2484
2487 2485
2488int SIMpad::displayBrightnessResolution ( ) const 2486int SIMpad::displayBrightnessResolution ( ) const
2489{ 2487{
2490 return 255; // All SIMpad models share the same display 2488 return 255; // All SIMpad models share the same display
2491} 2489}
2492 2490
2493/************************************************** 2491/**************************************************
2494 * 2492 *
2495 * Ramses 2493 * Ramses
2496 * 2494 *
2497 **************************************************/ 2495 **************************************************/
2498 2496
2499void Ramses::init() 2497void Ramses::init()
2500{ 2498{
2501 d->m_vendorstr = "M und N"; 2499 d->m_vendorstr = "M und N";
2502 d->m_vendor = Vendor_MundN; 2500 d->m_vendor = Vendor_MundN;
2503 2501
2504 QFile f("/proc/sys/board/ramses"); 2502 QFile f("/proc/sys/board/ramses");
2505 2503
2506 d->m_modelstr = "Ramses"; 2504 d->m_modelstr = "Ramses";
2507 d->m_model = Model_Ramses_MNCI; 2505 d->m_model = Model_Ramses_MNCI;
2508 2506
2509 d->m_rotation = Rot90; 2507 d->m_rotation = Rot90;
2510 d->m_holdtime = 1000; 2508 d->m_holdtime = 1000;
2511 2509
2512 f.setName("/etc/oz_version"); 2510 f.setName("/etc/oz_version");
2513 2511
2514 if (f.open(IO_ReadOnly)) { 2512 if (f.open(IO_ReadOnly)) {
2515 d->m_systemstr = "OpenEmbedded/Ramses"; 2513 d->m_systemstr = "OpenEmbedded/Ramses";
2516 d->m_system = System_OpenZaurus; 2514 d->m_system = System_OpenZaurus;
2517 2515
2518 QTextStream ts(&f); 2516 QTextStream ts(&f);
2519 ts.setDevice(&f); 2517 ts.setDevice(&f);
2520 d->m_sysverstr = ts.readLine(); 2518 d->m_sysverstr = ts.readLine();
2521 f.close(); 2519 f.close();
2522 } 2520 }
2523 2521
2524 m_power_timer = 0; 2522 m_power_timer = 0;
2525 2523
2526#ifdef QT_QWS_ALLOW_OVERCLOCK 2524#ifdef QT_QWS_ALLOW_OVERCLOCK
2527#warning *** Overclocking enabled - this may fry your hardware - you have been warned *** 2525#warning *** Overclocking enabled - this may fry your hardware - you have been warned ***
2528#define OC(x...) x 2526#define OC(x...) x
2529#else 2527#else
2530#define OC(x...) 2528#define OC(x...)
2531#endif 2529#endif
2532 2530
2533 2531
2534 // This table is true for a Intel XScale PXA 255 2532 // This table is true for a Intel XScale PXA 255
2535 2533
2536 d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50 2534 d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50
2537 OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem 2535 OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem
2538 d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99 2536 d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99
2539 OC(d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem 2537 OC(d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem
2540 d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99 2538 d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99
2541 OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem 2539 OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem
2542 d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99 2540 d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99
2543 d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196 2541 d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196
2544 OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus 2542 OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus
2545 2543
2546} 2544}
2547 2545
2548bool Ramses::filter(int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat) 2546bool Ramses::filter(int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat)
2549{ 2547{
@@ -2688,137 +2686,138 @@ bool Ramses::setDisplayContrast(int contr)
2688 char writeCommand[100]; 2686 char writeCommand[100];
2689 const int count = sprintf(writeCommand, "%d\n", contr); 2687 const int count = sprintf(writeCommand, "%d\n", contr);
2690 res = (::write(fd, writeCommand, count) != -1); 2688 res = (::write(fd, writeCommand, count) != -1);
2691 res = true; 2689 res = true;
2692 ::close(fd); 2690 ::close(fd);
2693 } 2691 }
2694 return res; 2692 return res;
2695} 2693}
2696 2694
2697 2695
2698int Ramses::displayContrastResolution() const 2696int Ramses::displayContrastResolution() const
2699{ 2697{
2700 return 20; 2698 return 20;
2701} 2699}
2702 2700
2703 2701
2704/************************************************** 2702/**************************************************
2705 * * 2703 * *
2706 * Jornada * 2704 * Jornada *
2707 * * 2705 * *
2708 **************************************************/ 2706 **************************************************/
2709 2707
2710 2708
2711bool Jornada::isJornada ( ) 2709bool Jornada::isJornada ( )
2712{ 2710{
2713 QFile f( "/proc/cpuinfo" ); 2711 QFile f( "/proc/cpuinfo" );
2714 if ( f. open ( IO_ReadOnly ) ) { 2712 if ( f. open ( IO_ReadOnly ) ) {
2715 QTextStream ts ( &f ); 2713 QTextStream ts ( &f );
2716 QString line; 2714 QString line;
2717 while( line = ts. readLine ( ) ) { 2715 while( line = ts. readLine ( ) ) {
2718 if ( line. left ( 8 ) == "Hardware" ) { 2716 if ( line. left ( 8 ) == "Hardware" ) {
2719 int loc = line. find ( ":" ); 2717 int loc = line. find ( ":" );
2720 if ( loc != -1 ) { 2718 if ( loc != -1 ) {
2721 QString model = 2719 QString model =
2722 line. mid ( loc + 2 ). simplifyWhiteSpace( ); 2720 line. mid ( loc + 2 ). simplifyWhiteSpace( );
2723 return ( model == "HP Jornada 56x" ); 2721 return ( model == "HP Jornada 56x" );
2724 } 2722 }
2725 } 2723 }
2726 } 2724 }
2727 } 2725 }
2728 return false; 2726 return false;
2729} 2727}
2730 2728
2731void Jornada::init ( ) 2729void Jornada::init ( )
2732{ 2730{
2733 d-> m_vendorstr = "HP"; 2731 d-> m_vendorstr = "HP";
2734 d-> m_vendor = Vendor_HP; 2732 d-> m_vendor = Vendor_HP;
2735 d-> m_modelstr = "Jornada 56x"; 2733 d-> m_modelstr = "Jornada 56x";
2736 d-> m_model = Model_Jornada_56x; 2734 d-> m_model = Model_Jornada_56x;
2737 d-> m_systemstr = "Familiar"; 2735 d-> m_systemstr = "Familiar";
2738 d-> m_system = System_Familiar; 2736 d-> m_system = System_Familiar;
2739 d-> m_rotation = Rot0; 2737 d-> m_rotation = Rot0;
2740 2738
2741 QFile f ( "/etc/familiar-version" ); 2739 QFile f ( "/etc/familiar-version" );
2742 f. setName ( "/etc/familiar-version" ); 2740 f. setName ( "/etc/familiar-version" );
2743 if ( f. open ( IO_ReadOnly )) { 2741 if ( f. open ( IO_ReadOnly )) {
2744 2742
2745 QTextStream ts ( &f ); 2743 QTextStream ts ( &f );
2746 d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); 2744 d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
2747 2745
2748 f. close ( ); 2746 f. close ( );
2749 } 2747 }
2750} 2748}
2751 2749
2752#if 0 2750#if 0
2753void Jornada::initButtons ( ) 2751void Jornada::initButtons ( )
2754{ 2752{
2755 if ( d-> m_buttons ) 2753 if ( d-> m_buttons )
2756 return; 2754 return;
2757 2755
2758 // Simulation uses iPAQ 3660 device buttons 2756 // Simulation uses iPAQ 3660 device buttons
2759 2757
2760 qDebug ( "init Buttons" ); 2758 qDebug ( "init Buttons" );
2761 d-> m_buttons = new QValueList <ODeviceButton>; 2759 d-> m_buttons = new QValueList <ODeviceButton>;
2762 2760
2763 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 2761 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
2764 i_button *ib = ipaq_buttons + i; 2762 i_button *ib = ipaq_buttons + i;
2765 ODeviceButton b; 2763 ODeviceButton b;
2766 2764
2767 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { 2765 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) {
2768 b. setKeycode ( ib-> code ); 2766 b. setKeycode ( ib-> code );
2769 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 2767 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
2770 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 2768 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
2771 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 2769 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
2772 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 2770 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
2773 d-> m_buttons-> append ( b ); 2771 d-> m_buttons-> append ( b );
2774 } 2772 }
2775 } 2773 }
2776 reloadButtonMapping ( ); 2774 reloadButtonMapping ( );
2777 2775
2778 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 2776 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
2779 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); 2777 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
2780} 2778}
2781#endif 2779#endif
2782int Jornada::displayBrightnessResolution ( ) const 2780int Jornada::displayBrightnessResolution ( ) const
2783{ 2781{
2782 return 255;
2784} 2783}
2785 2784
2786bool Jornada::setDisplayBrightness ( int bright ) 2785bool Jornada::setDisplayBrightness ( int bright )
2787{ 2786{
2788 bool res = false; 2787 bool res = false;
2789 int fd; 2788 int fd;
2790 2789
2791 if ( bright > 255 ) 2790 if ( bright > 255 )
2792 bright = 255; 2791 bright = 255;
2793 if ( bright < 0 ) 2792 if ( bright < 0 )
2794 bright = 0; 2793 bright = 0;
2795 2794
2796 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { 2795 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
2797 FLITE_IN bl; 2796 FLITE_IN bl;
2798 bl. mode = 1; 2797 bl. mode = 1;
2799 bl. pwr = bright ? 1 : 0; 2798 bl. pwr = bright ? 1 : 0;
2800 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; 2799 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255;
2801 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 2800 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
2802 ::close ( fd ); 2801 ::close ( fd );
2803 } 2802 }
2804 return res; 2803 return res;
2805} 2804}
2806 2805
2807bool Jornada::setSoftSuspend ( bool soft ) 2806bool Jornada::setSoftSuspend ( bool soft )
2808{ 2807{
2809 bool res = false; 2808 bool res = false;
2810 int fd; 2809 int fd;
2811 2810
2812 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { 2811 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) {
2813 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) 2812 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 )
2814 res = true; 2813 res = true;
2815 else 2814 else
2816 ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); 2815 ::perror ( "write to /proc/sys/ts/suspend_button_mode" );
2817 2816
2818 ::close ( fd ); 2817 ::close ( fd );
2819 } 2818 }
2820 else 2819 else
2821 ::perror ( "/proc/sys/ts/suspend_button_mode" ); 2820 ::perror ( "/proc/sys/ts/suspend_button_mode" );
2822 2821
2823 return res; 2822 return res;
2824} 2823}