Re: Opie bug ??

Erik Hovland <[email protected]> Sun, 11 Feb 2007 13:32:30 -0800
Newsgroups gmane.comp.handhelds.opie.devel
Message-ID <[email protected]>
On Sat, Feb 10, 2007 at 11:30:57PM +0100, GoXbox Live wrote:
> I have seen you done some major updates in the  Opie cvs lately great job by
> the way.
> 
> But there seem like there is a bug. I have problems compiling libopie2.
> 
> But i dont know if this is Opie related or if it is OpenEmbedded. But there
> seems like there is a bug with the odevice_palm.cpp.
> 
> Take a look at the provided file in the bottom of the content and you will
> see what i mean.

Took a look. How does the attached patch work for you?

E

-- 
Erik Hovland
mail: [email protected]
web: http://hovland.org/
PGP/GPG public key available on request

_______________________________________________

http://opie.handhelds.org/cgi-bin/moin.cgi/DeveloperWikiIndex

Opie-devel mailing list
[email protected]
https://handhelds.org/mailman/listinfo/opie-devel
fix-odevice_palm.cpp-compile-problem.patch (text/plain, 952 B)
Index: src/libopie2/opiecore/device/odevice_palm.cpp
===================================================================
--- src.orig/libopie2/opiecore/device/odevice_palm.cpp
+++ src/libopie2/opiecore/device/odevice_palm.cpp
@@ -229,17 +229,19 @@ bool Palm::suspend()
 int Palm::displayBrightnessResolution() const
 {
     int res = 1;
+    int fd = -1;
 
     switch ( d->m_model )
     {
       case Model_Palm_LD:
       case Model_Palm_TX:
       case Model_Palm_Z72:
-        int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK );
-        if ( fd )
+        fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK );
+        if ( fd != -1)
         {
           char buf[100];
-          if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res );
+          if ( ::read( fd, &buf[0], sizeof buf ) > 0 )
+              ::sscanf( &buf[0], "%d", &res );
           ::close( fd );
         }
 	break;