diff options
author | Denys Dmytriyenko <denis@denix.org> | 2009-03-17 14:32:59 -0400 |
---|---|---|
committer | Denys Dmytriyenko <denis@denix.org> | 2009-03-17 14:32:59 -0400 |
commit | 709c4d66e0b107ca606941b988bad717c0b45d9b (patch) | |
tree | 37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/libopie/libopie2/ipaq-2.6-sys-class-backlight-support.patch | |
parent | fa6cd5a3b993f16c27de4ff82b42684516d433ba (diff) |
rename packages/ to recipes/ per earlier agreement
See links below for more details:
http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326
http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816
Signed-off-by: Denys Dmytriyenko <denis@denix.org>
Acked-by: Mike Westerhof <mwester@dls.net>
Acked-by: Philip Balister <philip@balister.org>
Acked-by: Khem Raj <raj.khem@gmail.com>
Acked-by: Marcin Juszkiewicz <hrw@openembedded.org>
Acked-by: Koen Kooi <koen@openembedded.org>
Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/libopie/libopie2/ipaq-2.6-sys-class-backlight-support.patch')
-rw-r--r-- | recipes/libopie/libopie2/ipaq-2.6-sys-class-backlight-support.patch | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/recipes/libopie/libopie2/ipaq-2.6-sys-class-backlight-support.patch b/recipes/libopie/libopie2/ipaq-2.6-sys-class-backlight-support.patch new file mode 100644 index 0000000000..4095502c32 --- /dev/null +++ b/recipes/libopie/libopie2/ipaq-2.6-sys-class-backlight-support.patch @@ -0,0 +1,144 @@ +Index: libopie2/opiecore/device/odevice_ipaq.cpp +=================================================================== +RCS file: /cvs/opie/libopie2/opiecore/device/odevice_ipaq.cpp,v +retrieving revision 1.26 +diff -u -r1.26 odevice_ipaq.cpp +--- libopie2/opiecore/device/odevice_ipaq.cpp 2 Aug 2006 19:12:39 -0000 1.26 ++++ libopie2/opiecore/device/odevice_ipaq.cpp 11 Oct 2006 00:46:38 -0000 +@@ -408,45 +408,19 @@ + if ( bright < 0 ) + bright = 0; + +- QString cmdline; +- +- switch ( model()) { +- case Model_iPAQ_H191x: +- case Model_iPAQ_H4xxx: +- { +- QDir sysClass( "/sys/class/backlight/pxafb/" ); +- sysClass.setFilter(QDir::Dirs); +- int fd; +- if ( sysClass.exists() ) { +- QString sysClassPath = sysClass.absFilePath( "/sys/class/backlight/pxafb/power" ); +- fd = ::open( sysClassPath, O_WRONLY | O_NONBLOCK ); +- if ( fd ) { +- char buf[10]; +- buf[0] = bright ? 0 : 4; +- buf[1] = '\0'; +- res = ( ::write( fd, &buf[0], 2 ) == 0 ); +- ::close( fd ); +- } +- sysClassPath = sysClass.absFilePath( "/sys/class/backlight/pxafb/brightness" ); +- fd = ::open( sysClassPath, O_WRONLY | O_NONBLOCK ); +- if ( fd ) { +- char buf[100]; +- int len = ::snprintf( &buf[0], sizeof buf, "%d", bright ); +- res = ( ::write( fd, &buf[0], len ) == 0 ); +- ::close( fd ); +- } +- } +- } +- 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: ++ QDir sysClass( "/sys/class/backlight/" ); ++ sysClass.setFilter(QDir::Dirs); ++ if ( sysClass.exists() && sysClass.count() > 2 ) { ++ QString sysClassPath = sysClass.absFilePath( sysClass[2] + "/brightness" ); ++ int fd = ::open( sysClassPath, O_WRONLY|O_NONBLOCK ); ++ if ( fd ) { ++ char buf[100]; ++ int val = bright * displayBrightnessResolution() / 255; ++ int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); ++ res = ( ::write( fd, &buf[0], len ) == 0 ); ++ ::close( fd ); ++ } ++ } else { + if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { + FLITE_IN bl; + bl. mode = 1; +@@ -456,11 +430,28 @@ + ::close ( fd ); + } + } ++ + return res; + } + + int iPAQ::displayBrightnessResolution() const + { ++ int res = 16; ++ ++ QDir sysClass( "/sys/class/backlight/" ); ++ sysClass.setFilter(QDir::Dirs); ++ if ( sysClass.exists() && sysClass.count() > 2 ) { ++ QString sysClassPath = sysClass.absFilePath( sysClass[2] + "/max_brightness" ); ++ int fd = ::open( sysClassPath, O_RDONLY|O_NONBLOCK ); ++ if ( fd ) { ++ char buf[100]; ++ if ( ::read( fd, &buf[0], sizeof buf ) ) ++ ::sscanf( &buf[0], "%d", &res ); ++ ::close( fd ); ++ } ++ return res; ++ } ++ + switch ( model()) { + case Model_iPAQ_H31xx: + case Model_iPAQ_H36xx: +@@ -489,27 +480,22 @@ + + QString cmdline; + +- if ( model() == Model_iPAQ_H191x ) { +- QDir sysClass( "/sys/class/lcd/pxafb/" ); +- sysClass.setFilter(QDir::Dirs); +- if ( sysClass.exists() ) { +- QString sysClassPath = sysClass.absFilePath( "/sys/class/lcd/pxafb/power" ); +- int fd = ::open( sysClassPath, O_WRONLY | O_NONBLOCK ); +- if ( fd ) { +- char buf[10]; +- buf[0] = on ? 0 : 4; +- buf[1] = '\0'; +- res = ( ::write( fd, &buf[0], 2 ) == 0 ); +- ::close( fd ); +- } +- } +- return res; ++ QDir sysClass( "/sys/class/lcd/" ); ++ sysClass.setFilter(QDir::Dirs); ++ if ( sysClass.exists() && sysClass.count() > 2 ) { ++ QString sysClassPath = sysClass.absFilePath( sysClass[2] + "/power" ); ++ int fd = ::open( sysClassPath, O_WRONLY|O_NONBLOCK ); ++ if ( fd ) { ++ char buf[10]; ++ buf[0] = on ? 0 : 4; ++ buf[1] = '\0'; ++ res = ( ::write( fd, &buf[0], 2 ) == 0 ); ++ ::close( fd ); ++ } + } else { +- return OAbstractMobileDevice::setDisplayStatus(on); ++ res = OAbstractMobileDevice::setDisplayStatus(on); + } + +- res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); +- + return res; + } + +@@ -517,6 +503,7 @@ + { + switch (model()) { + case Model_iPAQ_H191x: ++ case Model_iPAQ_H22xx: + case Model_iPAQ_H4xxx: + return false; + default: |