author | chicken <chicken> | 2004-11-05 10:34:02 (UTC) |
---|---|---|
committer | chicken <chicken> | 2004-11-05 10:34:02 (UTC) |
commit | aea18d994988507f6153552698cbb67054715a92 (patch) (unidiff) | |
tree | 704b7ec91f59e432910343a6d3efc73b90fae613 | |
parent | 586ba5bb2842d80911ea22bf47eaa2f1b39362e1 (diff) | |
download | opie-aea18d994988507f6153552698cbb67054715a92.zip opie-aea18d994988507f6153552698cbb67054715a92.tar.gz opie-aea18d994988507f6153552698cbb67054715a92.tar.bz2 |
correct simpad cs3 readout
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index 2e54216..d6c2c80 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp | |||
@@ -201,65 +201,65 @@ void SIMpad::initButtons() | |||
201 | #define SIMPAD_RESET_SIMCARD 0x8000 | 201 | #define SIMPAD_RESET_SIMCARD 0x8000 |
202 | 202 | ||
203 | //SIMpad touchscreen backlight strength control | 203 | //SIMpad touchscreen backlight strength control |
204 | #define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/backlight" | 204 | #define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/backlight" |
205 | 205 | ||
206 | 206 | ||
207 | /* | 207 | /* |
208 | * The SIMpad exposes ChipSelect3 to userspace | 208 | * The SIMpad exposes ChipSelect3 to userspace |
209 | * via a proc filesystem file. Using this register | 209 | * via a proc filesystem file. Using this register |
210 | * one can toggle power of serial, irda, dect circuits | 210 | * one can toggle power of serial, irda, dect circuits |
211 | * change the video driver and display status and | 211 | * change the video driver and display status and |
212 | * many more things. | 212 | * many more things. |
213 | * To not lose the current setting we read the current | 213 | * To not lose the current setting we read the current |
214 | * cs3 setting and toggle the necessary bits and then | 214 | * cs3 setting and toggle the necessary bits and then |
215 | * write it. | 215 | * write it. |
216 | */ | 216 | */ |
217 | static bool setCS3Bit( bool bitset, int bit ) { | 217 | static bool setCS3Bit( bool bitset, int bit ) { |
218 | QFile file( SIMPAD_BOARDCONTROL ); | 218 | QFile file( SIMPAD_BOARDCONTROL ); |
219 | if ( !file.open( IO_ReadOnly ) ) | 219 | if ( !file.open( IO_ReadOnly ) ) |
220 | return false; | 220 | return false; |
221 | 221 | ||
222 | unsigned int val = 0; | 222 | unsigned int val = 0; |
223 | bool ok = false; | 223 | bool ok = false; |
224 | QTextStream stream( &file ); | 224 | QTextStream stream( &file ); |
225 | 225 | ||
226 | /* | 226 | /* |
227 | * Use QFile and QTextStream for parsing to be more | 227 | * Use QFile and QTextStream for parsing to be more |
228 | * robust | 228 | * robust |
229 | */ | 229 | */ |
230 | while ( !stream.atEnd() ) { | 230 | while ( !stream.atEnd() ) { |
231 | QString line = stream.readLine(); | 231 | QString line = stream.readLine(); |
232 | if ( line.startsWith( "Chipselect3 : " ) ) { | 232 | if ( line.startsWith( "Chipselect3 : " ) ) { |
233 | val = line.mid( 15 ).toUInt( 0, 16 ); | 233 | val = line.mid( 14 ).toUInt( 0, 16 ); |
234 | ok = true; | 234 | ok = true; |
235 | break; | 235 | break; |
236 | } | 236 | } |
237 | } | 237 | } |
238 | 238 | ||
239 | if ( !ok ) | 239 | if ( !ok ) |
240 | return false; | 240 | return false; |
241 | 241 | ||
242 | file.close(); | 242 | file.close(); |
243 | 243 | ||
244 | /* | 244 | /* |
245 | * change the value | 245 | * change the value |
246 | */ | 246 | */ |
247 | val = bitset ? (val | bit) : (val & ~bit); | 247 | val = bitset ? (val | bit) : (val & ~bit); |
248 | 248 | ||
249 | /* | 249 | /* |
250 | * write it back | 250 | * write it back |
251 | */ | 251 | */ |
252 | int cs3_fd = ::open( SIMPAD_BOARDCONTROL, O_WRONLY ); | 252 | int cs3_fd = ::open( SIMPAD_BOARDCONTROL, O_WRONLY ); |
253 | if ( cs3_fd < 0 ) | 253 | if ( cs3_fd < 0 ) |
254 | return false; | 254 | return false; |
255 | 255 | ||
256 | char line[32]; | 256 | char line[32]; |
257 | ::snprintf(line, sizeof(line), "0x%04x\n", val); | 257 | ::snprintf(line, sizeof(line), "0x%04x\n", val); |
258 | ::write(cs3_fd, line, strlen(line)); | 258 | ::write(cs3_fd, line, strlen(line)); |
259 | ::close(cs3_fd); | 259 | ::close(cs3_fd); |
260 | 260 | ||
261 | return true; | 261 | return true; |
262 | } | 262 | } |
263 | 263 | ||
264 | 264 | ||
265 | QValueList <OLed> SIMpad::ledList() const | 265 | QValueList <OLed> SIMpad::ledList() const |