Diffstat (limited to 'libopie2/opiecore/device/odevice_ipaq.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index a221e23..e6e3145 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp | |||
@@ -132,60 +132,64 @@ void iPAQ::init(const QString& model) | |||
132 | { | 132 | { |
133 | d->m_vendorstr = "HP"; | 133 | d->m_vendorstr = "HP"; |
134 | d->m_vendor = Vendor_HP; | 134 | d->m_vendor = Vendor_HP; |
135 | 135 | ||
136 | d->m_modelstr = model.mid(model.findRev('H')); | 136 | d->m_modelstr = model.mid(model.findRev('H')); |
137 | 137 | ||
138 | if ( d->m_modelstr == "H3100" ) | 138 | if ( d->m_modelstr == "H3100" ) |
139 | d->m_model = Model_iPAQ_H31xx; | 139 | d->m_model = Model_iPAQ_H31xx; |
140 | else if ( d->m_modelstr == "H3600" ) | 140 | else if ( d->m_modelstr == "H3600" ) |
141 | d->m_model = Model_iPAQ_H36xx; | 141 | d->m_model = Model_iPAQ_H36xx; |
142 | else if ( d->m_modelstr == "H3700" ) | 142 | else if ( d->m_modelstr == "H3700" ) |
143 | d->m_model = Model_iPAQ_H37xx; | 143 | d->m_model = Model_iPAQ_H37xx; |
144 | else if ( d->m_modelstr == "H3800" ) | 144 | else if ( d->m_modelstr == "H3800" ) |
145 | d->m_model = Model_iPAQ_H38xx; | 145 | d->m_model = Model_iPAQ_H38xx; |
146 | else if ( d->m_modelstr == "H3900" ) | 146 | else if ( d->m_modelstr == "H3900" ) |
147 | d->m_model = Model_iPAQ_H39xx; | 147 | d->m_model = Model_iPAQ_H39xx; |
148 | else if ( d->m_modelstr == "H5400" ) | 148 | else if ( d->m_modelstr == "H5400" ) |
149 | d->m_model = Model_iPAQ_H5xxx; | 149 | d->m_model = Model_iPAQ_H5xxx; |
150 | else if ( d->m_modelstr == "H2200" ) | 150 | else if ( d->m_modelstr == "H2200" ) |
151 | d->m_model = Model_iPAQ_H22xx; | 151 | d->m_model = Model_iPAQ_H22xx; |
152 | else if ( d->m_modelstr == "H1910" ) | 152 | else if ( d->m_modelstr == "H1910" ) |
153 | d->m_model = Model_iPAQ_H191x; | 153 | d->m_model = Model_iPAQ_H191x; |
154 | else if ( d->m_modelstr == "H1940" ) | 154 | else if ( d->m_modelstr == "H1940" ) |
155 | d->m_model = Model_iPAQ_H1940; | 155 | d->m_model = Model_iPAQ_H1940; |
156 | else if ( d->m_modelstr == "HX4700" ) | ||
157 | d->m_model = Model_iPAQ_HX4700; | ||
158 | |||
156 | else | 159 | else |
157 | d->m_model = Model_Unknown; | 160 | d->m_model = Model_Unknown; |
158 | 161 | ||
159 | switch ( d->m_model ) { | 162 | switch ( d->m_model ) { |
160 | case Model_iPAQ_H31xx: | 163 | case Model_iPAQ_H31xx: |
161 | case Model_iPAQ_H38xx: | 164 | case Model_iPAQ_H38xx: |
162 | d->m_rotation = Rot90; | 165 | d->m_rotation = Rot90; |
163 | break; | 166 | break; |
164 | case Model_iPAQ_H5xxx: | 167 | case Model_iPAQ_H5xxx: |
165 | case Model_iPAQ_H22xx: | 168 | case Model_iPAQ_H22xx: |
166 | case Model_iPAQ_H191x: | 169 | case Model_iPAQ_H191x: |
167 | case Model_iPAQ_H1940: | 170 | case Model_iPAQ_H1940: |
171 | case Model_iPAQ_HX4700: | ||
168 | d->m_rotation = Rot0; | 172 | d->m_rotation = Rot0; |
169 | break; | 173 | break; |
170 | case Model_iPAQ_H36xx: | 174 | case Model_iPAQ_H36xx: |
171 | case Model_iPAQ_H37xx: | 175 | case Model_iPAQ_H37xx: |
172 | case Model_iPAQ_H39xx: | 176 | case Model_iPAQ_H39xx: |
173 | default: | 177 | default: |
174 | d->m_rotation = Rot270; | 178 | d->m_rotation = Rot270; |
175 | break; | 179 | break; |
176 | 180 | ||
177 | } | 181 | } |
178 | 182 | ||
179 | m_leds [0] = m_leds [1] = Led_Off; | 183 | m_leds [0] = m_leds [1] = Led_Off; |
180 | 184 | ||
181 | m_power_timer = 0; | 185 | m_power_timer = 0; |
182 | 186 | ||
183 | } | 187 | } |
184 | 188 | ||
185 | void iPAQ::initButtons() | 189 | void iPAQ::initButtons() |
186 | { | 190 | { |
187 | if ( d->m_buttons ) | 191 | if ( d->m_buttons ) |
188 | return; | 192 | return; |
189 | 193 | ||
190 | if ( isQWS( ) ) { | 194 | if ( isQWS( ) ) { |
191 | addPreHandler(this); | 195 | addPreHandler(this); |
@@ -361,73 +365,82 @@ void iPAQ::playAlarmSound() | |||
361 | #endif | 365 | #endif |
362 | } | 366 | } |
363 | 367 | ||
364 | bool iPAQ::setDisplayBrightness ( int bright ) | 368 | bool iPAQ::setDisplayBrightness ( int bright ) |
365 | { | 369 | { |
366 | bool res = false; | 370 | bool res = false; |
367 | int fd; | 371 | int fd; |
368 | 372 | ||
369 | if ( bright > 255 ) | 373 | if ( bright > 255 ) |
370 | bright = 255; | 374 | bright = 255; |
371 | if ( bright < 0 ) | 375 | if ( bright < 0 ) |
372 | bright = 0; | 376 | bright = 0; |
373 | 377 | ||
374 | QString cmdline; | 378 | QString cmdline; |
375 | 379 | ||
376 | switch ( model()) { | 380 | switch ( model()) { |
377 | case Model_iPAQ_H191x: | 381 | case Model_iPAQ_H191x: |
378 | if ( !bright ) | 382 | if ( !bright ) |
379 | cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/pxafb/power"); | 383 | cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/pxafb/power"); |
380 | else | 384 | else |
381 | cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/pxafb/power; echo %1 > /sys/class/backlight/pxafb/brightness" ).arg( bright ); | 385 | cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/pxafb/power; echo %1 > /sys/class/backlight/pxafb/brightness" ).arg( bright ); |
382 | // No Global::shellQuote as we gurantee it to be sane | 386 | // No Global::shellQuote as we gurantee it to be sane |
383 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); | 387 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); |
384 | break; | 388 | break; |
389 | |||
390 | case Model_iPAQ_HX4700: | ||
391 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/backlight/w100fb/brightness" ).arg( bright ); | ||
392 | // No Global::shellQuote as we gurantee it to be sane | ||
393 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); | ||
394 | break; | ||
395 | |||
396 | |||
385 | default: | 397 | default: |
386 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { | 398 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { |
387 | FLITE_IN bl; | 399 | FLITE_IN bl; |
388 | bl. mode = 1; | 400 | bl. mode = 1; |
389 | bl. pwr = bright ? 1 : 0; | 401 | bl. pwr = bright ? 1 : 0; |
390 | bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255; | 402 | bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255; |
391 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); | 403 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); |
392 | ::close ( fd ); | 404 | ::close ( fd ); |
393 | } | 405 | } |
394 | } | 406 | } |
395 | return res; | 407 | return res; |
396 | } | 408 | } |
397 | 409 | ||
398 | int iPAQ::displayBrightnessResolution() const | 410 | int iPAQ::displayBrightnessResolution() const |
399 | { | 411 | { |
400 | switch ( model()) { | 412 | switch ( model()) { |
401 | case Model_iPAQ_H31xx: | 413 | case Model_iPAQ_H31xx: |
402 | case Model_iPAQ_H36xx: | 414 | case Model_iPAQ_H36xx: |
403 | case Model_iPAQ_H37xx: | 415 | case Model_iPAQ_H37xx: |
404 | return 128; // really 256, but >128 could damage the LCD | 416 | return 128; // really 256, but >128 could damage the LCD |
405 | 417 | ||
406 | case Model_iPAQ_H38xx: | 418 | case Model_iPAQ_H38xx: |
407 | case Model_iPAQ_H39xx: | 419 | case Model_iPAQ_H39xx: |
408 | return 64; | 420 | return 64; |
409 | case Model_iPAQ_H5xxx: | 421 | case Model_iPAQ_H5xxx: |
422 | case Model_iPAQ_HX4700: | ||
410 | return 255; | 423 | return 255; |
411 | case Model_iPAQ_H191x: | 424 | case Model_iPAQ_H191x: |
412 | return 7; | 425 | return 7; |
413 | case Model_iPAQ_H1940: | 426 | case Model_iPAQ_H1940: |
414 | return 44; | 427 | return 44; |
415 | default: | 428 | default: |
416 | return 2; | 429 | return 2; |
417 | } | 430 | } |
418 | } | 431 | } |
419 | 432 | ||
420 | bool iPAQ::setDisplayStatus ( bool on ) | 433 | bool iPAQ::setDisplayStatus ( bool on ) |
421 | { | 434 | { |
422 | bool res = false; | 435 | bool res = false; |
423 | 436 | ||
424 | QString cmdline; | 437 | QString cmdline; |
425 | 438 | ||
426 | if ( model() == Model_iPAQ_H191x ) { | 439 | if ( model() == Model_iPAQ_H191x ) { |
427 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/pxafb/power; echo %2 > /sys/class/backlight/pxafb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); | 440 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/pxafb/power; echo %2 > /sys/class/backlight/pxafb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); |
428 | } else { | 441 | } else { |
429 | return OAbstractMobileDevice::setDisplayStatus(on); | 442 | return OAbstractMobileDevice::setDisplayStatus(on); |
430 | } | 443 | } |
431 | 444 | ||
432 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); | 445 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); |
433 | 446 | ||