author | zecke <zecke> | 2006-04-27 10:45:16 (UTC) |
---|---|---|
committer | zecke <zecke> | 2006-04-27 10:45:16 (UTC) |
commit | 17191b7ae7929568b9ed87a427e2eaeb28377a00 (patch) (side-by-side diff) | |
tree | 8a095f0ecd0b4a09f72b1e8295bfc3d8c8008524 /libopie2 | |
parent | c5e86199c46839e6952b8ec3dec1447e5f60a279 (diff) | |
download | opie-17191b7ae7929568b9ed87a427e2eaeb28377a00.zip opie-17191b7ae7929568b9ed87a427e2eaeb28377a00.tar.gz opie-17191b7ae7929568b9ed87a427e2eaeb28377a00.tar.bz2 |
libopie2/opiecore/device/:
Patch by hrhr to add basic backlight support for the
hx4700 series of iPAQs to ODevice
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index 0c78277..2566979 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h @@ -49,49 +49,49 @@ class Sound; namespace Opie{ namespace Core{ class ODeviceData; /** * The available devices */ enum OModel { Model_Unknown, // = 0 Model_Series_Mask = 0xffff0000, Model_iPAQ = ( 1 << 16 ), Model_iPAQ_All = ( Model_iPAQ | 0xffff ), Model_iPAQ_H31xx = ( Model_iPAQ | 0x0001 ), Model_iPAQ_H36xx = ( Model_iPAQ | 0x0002 ), Model_iPAQ_H37xx = ( Model_iPAQ | 0x0003 ), Model_iPAQ_H38xx = ( Model_iPAQ | 0x0004 ), Model_iPAQ_H39xx = ( Model_iPAQ | 0x0005 ), Model_iPAQ_H5xxx = ( Model_iPAQ | 0x0006 ), Model_iPAQ_H22xx = ( Model_iPAQ | 0x0007 ), Model_iPAQ_H191x = ( Model_iPAQ | 0x0008 ), Model_iPAQ_H1940 = ( Model_iPAQ | 0x0009 ), - + Model_iPAQ_HX4700 = ( Model_iPAQ | 0x000A ), Model_Jornada = ( 6 << 16 ), Model_Jornada_56x = ( Model_Jornada | 0x0001 ), Model_Jornada_720 = ( Model_Jornada | 0x0002 ), Model_Zaurus = ( 2 << 16 ), Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ), Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ), Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ), Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ), Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ), Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0006 ), Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0007 ), Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0008 ), Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x0009 ), Model_SIMpad = ( 3 << 16 ), Model_SIMpad_All = ( Model_SIMpad | 0xffff ), Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ), Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ), Model_SIMpad_SLC = ( Model_SIMpad | 0x0003 ), Model_SIMpad_TSinus = ( Model_SIMpad | 0x0004 ), 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) { d->m_vendorstr = "HP"; d->m_vendor = Vendor_HP; d->m_modelstr = model.mid(model.findRev('H')); if ( d->m_modelstr == "H3100" ) d->m_model = Model_iPAQ_H31xx; else if ( d->m_modelstr == "H3600" ) d->m_model = Model_iPAQ_H36xx; else if ( d->m_modelstr == "H3700" ) d->m_model = Model_iPAQ_H37xx; else if ( d->m_modelstr == "H3800" ) d->m_model = Model_iPAQ_H38xx; else if ( d->m_modelstr == "H3900" ) d->m_model = Model_iPAQ_H39xx; else if ( d->m_modelstr == "H5400" ) d->m_model = Model_iPAQ_H5xxx; else if ( d->m_modelstr == "H2200" ) d->m_model = Model_iPAQ_H22xx; else if ( d->m_modelstr == "H1910" ) d->m_model = Model_iPAQ_H191x; else if ( d->m_modelstr == "H1940" ) d->m_model = Model_iPAQ_H1940; + else if ( d->m_modelstr == "HX4700" ) + d->m_model = Model_iPAQ_HX4700; + else d->m_model = Model_Unknown; switch ( d->m_model ) { case Model_iPAQ_H31xx: case Model_iPAQ_H38xx: d->m_rotation = Rot90; break; case Model_iPAQ_H5xxx: case Model_iPAQ_H22xx: case Model_iPAQ_H191x: case Model_iPAQ_H1940: + case Model_iPAQ_HX4700: d->m_rotation = Rot0; break; case Model_iPAQ_H36xx: case Model_iPAQ_H37xx: case Model_iPAQ_H39xx: default: d->m_rotation = Rot270; break; } m_leds [0] = m_leds [1] = Led_Off; m_power_timer = 0; } void iPAQ::initButtons() { if ( d->m_buttons ) return; if ( isQWS( ) ) { addPreHandler(this); @@ -361,73 +365,82 @@ void iPAQ::playAlarmSound() #endif } bool iPAQ::setDisplayBrightness ( int bright ) { bool res = false; int fd; if ( bright > 255 ) bright = 255; if ( bright < 0 ) bright = 0; QString cmdline; switch ( model()) { case Model_iPAQ_H191x: if ( !bright ) cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/pxafb/power"); else cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/pxafb/power; echo %1 > /sys/class/backlight/pxafb/brightness" ).arg( bright ); // No Global::shellQuote as we gurantee it to be sane res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); break; + + case Model_iPAQ_HX4700: + cmdline = QString::fromLatin1( "echo %1 > /sys/class/backlight/w100fb/brightness" ).arg( bright ); + // No Global::shellQuote as we gurantee it to be sane + res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); + break; + + default: if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { FLITE_IN bl; bl. mode = 1; bl. pwr = bright ? 1 : 0; bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255; res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); ::close ( fd ); } } return res; } int iPAQ::displayBrightnessResolution() const { switch ( model()) { case Model_iPAQ_H31xx: case Model_iPAQ_H36xx: case Model_iPAQ_H37xx: return 128; // really 256, but >128 could damage the LCD case Model_iPAQ_H38xx: case Model_iPAQ_H39xx: return 64; case Model_iPAQ_H5xxx: + case Model_iPAQ_HX4700: return 255; case Model_iPAQ_H191x: return 7; case Model_iPAQ_H1940: return 44; default: return 2; } } bool iPAQ::setDisplayStatus ( bool on ) { bool res = false; QString cmdline; if ( model() == Model_iPAQ_H191x ) { 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" ); } else { return OAbstractMobileDevice::setDisplayStatus(on); } res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); |