author | kergoth <kergoth> | 2003-04-20 21:58:05 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-04-20 21:58:05 (UTC) |
commit | 0da3e7316b90cfa0fd84b0de3c3b92cd3159b4e0 (patch) (unidiff) | |
tree | 44ea26ac04180526bc4a5a7c859b6f4bac5609a5 | |
parent | 258feac229c2e8b5016670c1edc442e923c58628 (diff) | |
download | opie-0da3e7316b90cfa0fd84b0de3c3b92cd3159b4e0.zip opie-0da3e7316b90cfa0fd84b0de3c3b92cd3159b4e0.tar.gz opie-0da3e7316b90cfa0fd84b0de3c3b92cd3159b4e0.tar.bz2 |
Revamp the zaurus model detection to actually work on the C700.
-rw-r--r-- | libopie/odevice.cpp | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index cb7dd74..d78277f 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -1095,105 +1095,110 @@ int iPAQ::readLightSensor ( ) | |||
1095 | 1095 | ||
1096 | buffer [4] = 0; | 1096 | buffer [4] = 0; |
1097 | val = ::strtol ( buffer + 2, &endptr, 16 ); | 1097 | val = ::strtol ( buffer + 2, &endptr, 16 ); |
1098 | 1098 | ||
1099 | if ( *endptr != 0 ) | 1099 | if ( *endptr != 0 ) |
1100 | val = -1; | 1100 | val = -1; |
1101 | } | 1101 | } |
1102 | ::close ( fd ); | 1102 | ::close ( fd ); |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | return val; | 1105 | return val; |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | int iPAQ::lightSensorResolution ( ) const | 1108 | int iPAQ::lightSensorResolution ( ) const |
1109 | { | 1109 | { |
1110 | return 256; | 1110 | return 256; |
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | /************************************************** | 1113 | /************************************************** |
1114 | * | 1114 | * |
1115 | * Zaurus | 1115 | * Zaurus |
1116 | * | 1116 | * |
1117 | **************************************************/ | 1117 | **************************************************/ |
1118 | 1118 | ||
1119 | 1119 | ||
1120 | 1120 | ||
1121 | void Zaurus::init ( ) | 1121 | void Zaurus::init ( ) |
1122 | { | 1122 | { |
1123 | d-> m_vendorstr = "Sharp"; | 1123 | d-> m_vendorstr = "Sharp"; |
1124 | d-> m_vendor = Vendor_Sharp; | 1124 | d-> m_vendor = Vendor_Sharp; |
1125 | 1125 | ||
1126 | QFile f ( "/proc/filesystems" ); | 1126 | QFile f ( "/proc/filesystems" ); |
1127 | QString model; | ||
1127 | 1128 | ||
1128 | if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { | 1129 | if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { |
1129 | d-> m_vendorstr = "OpenZaurus Team"; | 1130 | d-> m_vendorstr = "OpenZaurus Team"; |
1130 | d-> m_systemstr = "OpenZaurus"; | 1131 | d-> m_systemstr = "OpenZaurus"; |
1131 | d-> m_system = System_OpenZaurus; | 1132 | d-> m_system = System_OpenZaurus; |
1132 | 1133 | ||
1133 | f. close ( ); | 1134 | f. close ( ); |
1134 | 1135 | ||
1135 | f. setName ( "/etc/oz_version" ); | 1136 | f. setName ( "/etc/oz_version" ); |
1136 | if ( f. open ( IO_ReadOnly )) { | 1137 | if ( f. open ( IO_ReadOnly )) { |
1137 | QTextStream ts ( &f ); | 1138 | QTextStream ts ( &f ); |
1138 | d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); | 1139 | d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); |
1139 | f. close ( ); | 1140 | f. close ( ); |
1140 | } | 1141 | } |
1141 | } | 1142 | } |
1142 | else { | 1143 | else { |
1143 | d-> m_systemstr = "Zaurus"; | 1144 | d-> m_systemstr = "Zaurus"; |
1144 | d-> m_system = System_Zaurus; | 1145 | d-> m_system = System_Zaurus; |
1145 | } | 1146 | } |
1146 | 1147 | ||
1147 | f. setName ( "/proc/deviceinfo/product" ); | 1148 | f. setName ( "/proc/cpuinfo" ); |
1148 | if ( f. open ( IO_ReadOnly ) ) { | 1149 | if ( f. open ( IO_ReadOnly ) ) { |
1149 | QTextStream ts ( &f ); | 1150 | QTextStream ts ( &f ); |
1150 | QString model = ts. readLine ( ); | 1151 | QString line; |
1151 | f. close ( ); | 1152 | while( line = ts. readLine ( ) ) { |
1152 | 1153 | if ( line. left ( 8 ) == "Hardware" ) | |
1153 | d-> m_modelstr = QString("Zaurus ") + model; | 1154 | break; |
1154 | if ( model == "SL-5500" ) | 1155 | } |
1155 | d-> m_model = Model_Zaurus_SL5500; | 1156 | int loc = line. find ( ":" ); |
1156 | else if ( model == "SL-C700" ) | 1157 | if ( loc != -1 ) |
1157 | d-> m_model = Model_Zaurus_SLC700; | 1158 | model = line. mid ( loc + 2 ). simplifyWhitespace( ); |
1158 | else if ( model == "SL-A300" ) | ||
1159 | d-> m_model = Model_Zaurus_SLA300; | ||
1160 | else if ( model == "SL-B600" || model == "SL-5600" ) | ||
1161 | d-> m_model = Model_Zaurus_SLB600; | ||
1162 | else | ||
1163 | d-> m_model = Model_Zaurus_SL5000; | ||
1164 | } | 1159 | } |
1165 | else { | 1160 | |
1166 | d-> m_model = Model_Zaurus_SL5000; | 1161 | if ( model == "SHARP Corgi" ) { |
1167 | d-> m_modelstr = "Zaurus (model unknown)"; | 1162 | d-> m_model = Model_Zaurus_SLC700; |
1163 | d-> m_modelstr = "Zaurus SL-C700"; | ||
1164 | } else if ( model == "SHARP Poodle" ) { | ||
1165 | d-> m_model = Model_Zaurus_SLB600; | ||
1166 | d-> m_modelstr = "Zaurus SL-B500 or SL-5600"; | ||
1167 | } else if ( model = "Sharp-Collie" ) { | ||
1168 | d-> m_model = Model_Zaurus_SL5500; | ||
1169 | d-> m_modelstr = "Zaurus SL-5500 or SL-5000d"; | ||
1170 | } else { | ||
1171 | d-> m_model = Model_Zaurus_SL5500; | ||
1172 | d-> m_modelstr = "Zaurus (Model unknown)"; | ||
1168 | } | 1173 | } |
1169 | 1174 | ||
1170 | bool flipstate = false; | 1175 | bool flipstate = false; |
1171 | switch ( d-> m_model ) { | 1176 | switch ( d-> m_model ) { |
1172 | case Model_Zaurus_SLA300: | 1177 | case Model_Zaurus_SLA300: |
1173 | d-> m_rotation = Rot0; | 1178 | d-> m_rotation = Rot0; |
1174 | break; | 1179 | break; |
1175 | case Model_Zaurus_SLC700: | 1180 | case Model_Zaurus_SLC700: |
1176 | // Note: need to 1) set flipstate based on physical screen orientation | 1181 | // Note: need to 1) set flipstate based on physical screen orientation |
1177 | // and 2) check to see if the user overrode the rotation direction | 1182 | // and 2) check to see if the user overrode the rotation direction |
1178 | // using appearance, and if so, remove that item from the Config to | 1183 | // using appearance, and if so, remove that item from the Config to |
1179 | // ensure the rotate applet flips us back to the previous state. | 1184 | // ensure the rotate applet flips us back to the previous state. |
1180 | if ( flipstate ) { | 1185 | if ( flipstate ) { |
1181 | // 480x640 | 1186 | // 480x640 |
1182 | d-> m_rotation = Rot0; | 1187 | d-> m_rotation = Rot0; |
1183 | d-> m_direction = CW; | 1188 | d-> m_direction = CW; |
1184 | } else { | 1189 | } else { |
1185 | // 640x480 | 1190 | // 640x480 |
1186 | d-> m_rotation = Rot270; | 1191 | d-> m_rotation = Rot270; |
1187 | d-> m_direction = CCW; | 1192 | d-> m_direction = CCW; |
1188 | } | 1193 | } |
1189 | break; | 1194 | break; |
1190 | case Model_Zaurus_SLB600: | 1195 | case Model_Zaurus_SLB600: |
1191 | case Model_Zaurus_SL5500: | 1196 | case Model_Zaurus_SL5500: |
1192 | case Model_Zaurus_SL5000: | 1197 | case Model_Zaurus_SL5000: |
1193 | default: | 1198 | default: |
1194 | d-> m_rotation = Rot270; | 1199 | d-> m_rotation = Rot270; |
1195 | break; | 1200 | break; |
1196 | } | 1201 | } |
1197 | m_leds [0] = Led_Off; | 1202 | m_leds [0] = Led_Off; |
1198 | } | 1203 | } |
1199 | 1204 | ||