summaryrefslogtreecommitdiff
path: root/libopie2
authormickeyl <mickeyl>2005-06-09 09:14:22 (UTC)
committer mickeyl <mickeyl>2005-06-09 09:14:22 (UTC)
commit9a4b3a90fdd4ac0288034657d4818e3d10ed0193 (patch) (unidiff)
treeb65dc74dce17f4f709242753152b53767bb1a4fc /libopie2
parent15978c2609cc29d2eb2b21922dd52627015889c1 (diff)
downloadopie-9a4b3a90fdd4ac0288034657d4818e3d10ed0193.zip
opie-9a4b3a90fdd4ac0288034657d4818e3d10ed0193.tar.gz
opie-9a4b3a90fdd4ac0288034657d4818e3d10ed0193.tar.bz2
add support for the linux 2.6 backlight interface on tosa, poodle, and collie
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp65
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.h5
2 files changed, 42 insertions, 28 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 1742100..21d2342 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -1,28 +1,27 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 3              Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org>
4 Copyright (C)2002-2005 The Opie Team <opie-devel@handhelds.org>
5 =. 4 =.
6 .=l. 5 .=l.
7           .>+-= 6           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; version 2 of the License.
13     ._= =}       : or (at your option) any later version. 12     ._= =}       :
14    .%`+i>       _;_. 13    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 20++=   -.     .`     .: details.
22:     =  ...= . :.=- 21 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
@@ -120,7 +119,7 @@ struct z_button z_buttons_c700 [] = {
120// 119//
121// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) 120// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000)
122// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) 121// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600)
123// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000) 122// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100)
124// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) 123// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000)
125 124
126void Zaurus::init(const QString& cpu_info) 125void Zaurus::init(const QString& cpu_info)
@@ -199,6 +198,20 @@ void Zaurus::init(const QString& cpu_info)
199 d->m_modelstr = "Unknown Zaurus"; 198 d->m_modelstr = "Unknown Zaurus";
200 } 199 }
201 200
201 // set path to backlight device in kernel 2.6
202 switch ( d->m_model ) {
203 case Model_Zaurus_SLB600: // fallthrough
204 case Model_Zaurus_SL5500:
205 m_backlightdev = "/sys/class/backlight/locomo-backlight/";
206 break;
207 case Model_Zaurus_SL6000:
208 m_backlightdev = "/sys/class/backlight/tosa-bl/";
209 break;
210 default:
211 m_backlightdev = "/sys/class/backlight/corgi-bl/";
212 break;
213 }
214
202 // set initial rotation 215 // set initial rotation
203 switch( d->m_model ) { 216 switch( d->m_model ) {
204 case Model_Zaurus_SL6000: // fallthrough 217 case Model_Zaurus_SL6000: // fallthrough
@@ -411,7 +424,7 @@ int Zaurus::displayBrightnessResolution() const
411 } 424 }
412 else 425 else
413 { 426 {
414 int fd = ::open( "/sys/class/backlight/corgi-bl/max_brightness", O_RDONLY|O_NONBLOCK ); 427 int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK );
415 if ( fd ) 428 if ( fd )
416 { 429 {
417 char buf[100]; 430 char buf[100];
@@ -444,7 +457,7 @@ bool Zaurus::setDisplayBrightness( int bright )
444 } 457 }
445 else 458 else
446 { 459 {
447 int fd = ::open( "/sys/class/backlight/corgi-bl/brightness", O_WRONLY|O_NONBLOCK ); 460 int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK );
448 if ( fd ) 461 if ( fd )
449 { 462 {
450 char buf[100]; 463 char buf[100];
@@ -471,7 +484,7 @@ bool Zaurus::setDisplayStatus( bool on )
471 } 484 }
472 else 485 else
473 { 486 {
474 int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK ); 487 int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK );
475 if ( fd ) 488 if ( fd )
476 { 489 {
477 char buf[10]; 490 char buf[10];
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h
index 4250356..4314aff 100644
--- a/libopie2/opiecore/device/odevice_zaurus.h
+++ b/libopie2/opiecore/device/odevice_zaurus.h
@@ -8,8 +8,8 @@
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; version 2 of the License.
12     ._= =}       : or (at your option) any later version. 12     ._= =}       :
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
@@ -125,6 +125,7 @@ class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter
125 virtual void buzzer( int snd ); 125 virtual void buzzer( int snd );
126 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 126 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
127 127
128 QString m_backlightdev;
128 OLedState m_leds[1]; 129 OLedState m_leds[1];
129 bool m_embedix; 130 bool m_embedix;
130}; 131};