Re: Re: Opie bug ??
Erik Hovland <[email protected]> Mon, 12 Feb 2007 13:16:27 -0800
| Newsgroups | gmane.comp.handhelds.opie.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sun, Feb 11, 2007 at 01:32:30PM -0800, Erik Hovland wrote: > 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? The attached patch is the one I am going to go with unless anyone objects. It compiles for arm. 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, 1.8 KB)
Index: opie-arm/libopie2/opiecore/device/odevice_palm.cpp
===================================================================
--- opie-arm.orig/libopie2/opiecore/device/odevice_palm.cpp
+++ opie-arm/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;
@@ -261,6 +263,7 @@ bool Palm::setDisplayBrightness( int bri
int numberOfSteps = displayBrightnessResolution();
int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255;
+ int fd = -1;
switch ( d->m_model )
{
@@ -268,8 +271,8 @@ bool Palm::setDisplayBrightness( int bri
case Model_Palm_LD:
case Model_Palm_TX:
case Model_Palm_Z72:
- int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK );
- if ( fd )
+ fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK );
+ if ( fd != -1 )
{
char buf[100];
int len = ::snprintf( &buf[0], sizeof buf, "%d", val );
@@ -278,7 +281,8 @@ bool Palm::setDisplayBrightness( int bri
}
break;
- default: res = false;
+ default:
+ res = false;
}
return res;
}