summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorPaul Sokolovsky <pmiscml@gmail.com>2006-11-18 05:04:25 +0000
committerPaul Sokolovsky <pmiscml@gmail.com>2006-11-18 05:04:25 +0000
commite188a661e62679163f444c3819c721d5626901c1 (patch)
treea27d1bd8c332ba10e337fa25ce64ec29619d4bc0 /packages
parentdfa32bdef9593634f92cad6e21762910dfc95866 (diff)
libopie2_cvs: Add ipaq-2.6-sys-class-backlight-support.patch.
* Support kernel 2.6 backlight classdev to control backlight. * From Familiar tree.
Diffstat (limited to 'packages')
-rw-r--r--packages/libopie/libopie2/ipaq-2.6-sys-class-backlight-support.patch144
-rw-r--r--packages/libopie/libopie2_cvs.bb1
2 files changed, 145 insertions, 0 deletions
diff --git a/packages/libopie/libopie2/ipaq-2.6-sys-class-backlight-support.patch b/packages/libopie/libopie2/ipaq-2.6-sys-class-backlight-support.patch
new file mode 100644
index 0000000000..4095502c32
--- /dev/null
+++ b/packages/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:
diff --git a/packages/libopie/libopie2_cvs.bb b/packages/libopie/libopie2_cvs.bb
index f196f04063..09172cb2d7 100644
--- a/packages/libopie/libopie2_cvs.bb
+++ b/packages/libopie/libopie2_cvs.bb
@@ -5,6 +5,7 @@ PV = "1.2.2+cvs${SRCDATE}"
DEFAULT_PREFERENCE = "-1"
SRC_URI = "${HANDHELDS_CVS};module=opie/libopie2 \
+ file://ipaq-2.6-sys-class-backlight-support.patch;patch=1 \
file://include.pro"
SRC_URI_append_poodle = " file://poodle-2.6-hotkeys.patch;patch=1"