summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp92
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.h20
2 files changed, 45 insertions, 67 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;
}
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h
index dc21546..37ab876 100644
--- a/libopie2/opiecore/device/odevice_zaurus.h
+++ b/libopie2/opiecore/device/odevice_zaurus.h
@@ -78,11 +78,8 @@
// Brightness
-#define FL_IOCTL_STEP_CONTRAST 100
-
-#define CORGI_TOSA_BL_IOCTL_ON 1
-#define CORGI_TOSA_BL_IOCTL_OFF 2
-#define CORGI_TOSA_BL_IOCTL_STEP_CONTRAST 100
-#define CORGI_TOSA_BL_IOCTL_GET_STEP_CONTRAST 101
-#define CORGI_TOSA_BL_IOCTL_GET_STEP 102
-#define CORGI_BL_PROC_DEVICE corgi-bl
-#define TOSA_BL_PROC_DEVICE tosa-bl
+#define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl"
+#define SHARP_FL_IOCTL_ON 1
+#define SHARP_FL_IOCTL_OFF 2
+#define SHARP_FL_IOCTL_STEP_CONTRAST 100
+#define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101
+#define SHARP_FL_IOCTL_GET_STEP 102
@@ -98,5 +95,6 @@ class Zaurus : public ODevice
public:
- virtual bool setSoftSuspend ( bool soft );
+ virtual bool setSoftSuspend( bool soft );
- virtual bool setDisplayBrightness ( int b );
+ virtual bool setDisplayBrightness( int b );
+ virtual bool setDisplayStatus( bool on );
virtual int displayBrightnessResolution() const;