summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice_zaurus.cpp
authormickeyl <mickeyl>2005-01-01 19:33:30 (UTC)
committer mickeyl <mickeyl>2005-01-01 19:33:30 (UTC)
commit5f310dcd91f574c1b34ca99c157c0b93e6ae1e16 (patch) (side-by-side diff)
tree50157690d75a8f925385a8ef5964b52e22d922ad /libopie2/opiecore/device/odevice_zaurus.cpp
parenta62cf9bfb9814a6f5ce5aa8d59fbe5b0cfb8414a (diff)
downloadopie-5f310dcd91f574c1b34ca99c157c0b93e6ae1e16.zip
opie-5f310dcd91f574c1b34ca99c157c0b93e6ae1e16.tar.gz
opie-5f310dcd91f574c1b34ca99c157c0b93e6ae1e16.tar.bz2
rewrite backlight stuff
Diffstat (limited to 'libopie2/opiecore/device/odevice_zaurus.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp92
1 files changed, 36 insertions, 56 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 1894e15..e75e777 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -410,3 +410,2 @@ bool Zaurus::setDisplayBrightness( int bright )
bool res = false;
- int fd;
@@ -417,41 +416,9 @@ bool Zaurus::setDisplayBrightness( int bright )
{
- if ( d->m_model == Model_Zaurus_SLC7x0 )
- {
- //qDebug( "using special treatment for devices with the corgi backlight interface" );
- // special treatment for devices with the corgi backlight interface
- if (( fd = ::open ( "/proc/driver/fl/corgi-bl", O_WRONLY )) >= 0 )
- {
- int value = ( bright == 1 ) ? 1 : static_cast<int>( bright * ( 17.0 / 255.0 ) );
- char writeCommand[100];
- const int count = sprintf( writeCommand, "%x\n", value );
- res = ( ::write ( fd, writeCommand, count ) != -1 );
- ::close ( fd );
- }
- return res;
- }
- else
- if ( d->m_model == Model_Zaurus_SL6000 )
- {
- //qDebug( "using special treatment for devices with the tosa backlight interface" );
- // special treatment for devices with the tosa backlight interface
- if (( fd = ::open ( "/proc/driver/fl/tosa-bl", O_WRONLY )) >= 0 )
- {
- int value = ( bright == 1 ) ? 1 : static_cast<int>( bright * ( 17.0 / 255.0 ) );
- char writeCommand[100];
- const int count = sprintf( writeCommand, "%x\n", value );
- res = ( ::write ( fd, writeCommand, count ) != -1 );
- ::close ( fd );
- }
- return res;
- }
- else
+ int numberOfSteps = displayBrightnessResolution();
+ int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK );
+ if ( fd )
{
- // standard treatment for devices with the dumb embedix frontlight interface
- if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) {
- int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus
- if ( bright && !bl )
- bl = 1;
- res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 );
- ::close ( fd );
- }
+ int val = ( numberOfSteps * 255 ) / 255;
+ res = ( ::ioctl ( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 );
+ ::close ( fd );
}
@@ -460,6 +427,17 @@ bool Zaurus::setDisplayBrightness( int bright )
{
- // special treatment for the OpenZaurus unified interface
- #define FB_BACKLIGHT_SET_BRIGHTNESS _IOW('F', 1, u_int) /* set brightness */
- if (( fd = ::open ( "/dev/fb0", O_WRONLY )) >= 0 ) {
- res = ( ::ioctl ( fd , FB_BACKLIGHT_SET_BRIGHTNESS, bright ) == 0 );
+ qDebug( "ODevice handling for non-embedix kernels not yet implemented" );
+ }
+ return res;
+}
+
+bool Zaurus::setDisplayStatus( bool on )
+{
+ bool res = false;
+ if ( m_embedix )
+ {
+ int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK );
+ if ( fd )
+ {
+ int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF;
+ res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 );
::close ( fd );
@@ -467,4 +445,8 @@ bool Zaurus::setDisplayBrightness( int bright )
}
+ else
+ {
+ qDebug( "ODevice handling for non-embedix kernels not yet implemented" );
+ }
return res;
-}
+}
@@ -488,8 +470,6 @@ bool Zaurus::suspend()
- // This is needed because the iPAQ apm implementation is asynchronous and we
+ // This is needed because the apm implementation is asynchronous and we
// can not be sure when exactly the device is really suspended
- // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
-
if ( res ) {
- do { // Yes, wait 15 seconds. This APM bug sucks big time.
+ do { // Yes, wait 15 seconds. This APM sucks big time.
::usleep ( 200 * 1000 );
@@ -543,3 +523,3 @@ ODirection Zaurus::direction() const
case Model_Zaurus_SLC7x0:
- handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK);
+ handle = ::open( "/dev/apm_bios", O_RDWR|O_NONBLOCK );
if (handle == -1) {
@@ -547,3 +527,3 @@ ODirection Zaurus::direction() const
} else {
- retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION);
+ retval = ::ioctl( handle, SHARP_IOCTL_GET_ROTATION );
::close (handle);
@@ -559,4 +539,3 @@ ODirection Zaurus::direction() const
case Model_Zaurus_SL5000:
- default:
- dir = d->m_direction;
+ default: dir = d->m_direction;
break;
@@ -571,5 +550,5 @@ int Zaurus::displayBrightnessResolution() const
{
- if ( d->m_model == Model_Zaurus_SLC7x0 ) return 18;
- if ( d->m_model == Model_Zaurus_SL6000 ) return 18;
- return 5;
+ int handle = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK );
+ if ( handle != -1 ) return ::ioctl( handle, SHARP_FL_IOCTL_GET_STEP, 0 );
+ else return 1;
}
@@ -577,3 +556,4 @@ int Zaurus::displayBrightnessResolution() const
{
- return 256;
+ qDebug( "ODevice handling for non-embedix kernels not yet implemented" );
+ return 1;
}