summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-12-30 02:17:25 (UTC)
committer mickeyl <mickeyl>2003-12-30 02:17:25 (UTC)
commitb53d9bc11a1e35e52f2fda4586ba8a53f8e0b48a (patch) (unidiff)
tree98db0a0053c53e98ba758773f80ad8e14c9564c9
parentb636d3d91e8456b22bc450b3d7f3a862b7f615a9 (diff)
downloadopie-b53d9bc11a1e35e52f2fda4586ba8a53f8e0b48a.zip
opie-b53d9bc11a1e35e52f2fda4586ba8a53f8e0b48a.tar.gz
opie-b53d9bc11a1e35e52f2fda4586ba8a53f8e0b48a.tar.bz2
fix a problem in the c7x0 backlight handling...
Bah! Got confused by the input interval for ODevice::setDisplayBrightness() (once) again - it has been ridiculous to scale that down from [0-255] to the actual interval since the day we invented ODevice::displayBrightnessResolution(). I'm going to remove that antique cruft soon.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index bc09e92..82a0099 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1546,51 +1546,51 @@ bool Zaurus::isZaurus()
1546 QFile f ( "/proc/cpuinfo" ); 1546 QFile f ( "/proc/cpuinfo" );
1547 1547
1548 QTextStream ts ( &f ); 1548 QTextStream ts ( &f );
1549 QString line; 1549 QString line;
1550 while( line = ts. readLine ( ) ) { 1550 while( line = ts. readLine ( ) ) {
1551 if ( line. left ( 8 ) == "Hardware" ) 1551 if ( line. left ( 8 ) == "Hardware" )
1552 break; 1552 break;
1553 } 1553 }
1554 int loc = line. find ( ":" ); 1554 int loc = line. find ( ":" );
1555 if ( loc != -1 ) 1555 if ( loc != -1 )
1556 model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); 1556 model = line. mid ( loc + 2 ). simplifyWhiteSpace( );
1557 1557
1558 if ( model == "Sharp-Collie" 1558 if ( model == "Sharp-Collie"
1559 || model == "Collie" 1559 || model == "Collie"
1560 || model == "SHARP Corgi" 1560 || model == "SHARP Corgi"
1561 || model == "SHARP Shepherd" 1561 || model == "SHARP Shepherd"
1562 || model == "SHARP Poodle" 1562 || model == "SHARP Poodle"
1563 || model == "SHARP Husky" 1563 || model == "SHARP Husky"
1564 ) 1564 )
1565 is_zaurus = true; 1565 is_zaurus = true;
1566 1566
1567 } 1567 }
1568 return is_zaurus; 1568 return is_zaurus;
1569} 1569}
1570 1570
1571 1571
1572void Zaurus::init ( ) 1572void Zaurus::init ( )
1573{ 1573{
1574 d-> m_vendorstr = "Sharp"; 1574 d-> m_vendorstr = "Sharp";
1575 d-> m_vendor = Vendor_Sharp; 1575 d-> m_vendor = Vendor_Sharp;
1576 m_embedix = true; // Not openzaurus means: It has an embedix kernel ! 1576 m_embedix = true; // Not openzaurus means: It has an embedix kernel !
1577 1577
1578 // QFile f ( "/proc/filesystems" ); 1578 // QFile f ( "/proc/filesystems" );
1579 QString model; 1579 QString model;
1580 1580
1581 // It isn't a good idea to check the system configuration to 1581 // It isn't a good idea to check the system configuration to
1582 // detect the distribution ! 1582 // detect the distribution !
1583 // Otherwise it may happen that any other distribution is detected as openzaurus, just 1583 // Otherwise it may happen that any other distribution is detected as openzaurus, just
1584 // because it uses a jffs2 filesystem.. 1584 // because it uses a jffs2 filesystem..
1585 // (eilers) 1585 // (eilers)
1586 // if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { 1586 // if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) {
1587 QFile f ("/etc/oz_version"); 1587 QFile f ("/etc/oz_version");
1588 if ( f.exists() ){ 1588 if ( f.exists() ){
1589 d-> m_vendorstr = "OpenZaurus Team"; 1589 d-> m_vendorstr = "OpenZaurus Team";
1590 d-> m_systemstr = "OpenZaurus"; 1590 d-> m_systemstr = "OpenZaurus";
1591 d-> m_system = System_OpenZaurus; 1591 d-> m_system = System_OpenZaurus;
1592 1592
1593 if ( f. open ( IO_ReadOnly )) { 1593 if ( f. open ( IO_ReadOnly )) {
1594 QTextStream ts ( &f ); 1594 QTextStream ts ( &f );
1595 d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); 1595 d-> m_sysverstr = ts. readLine ( );//. mid ( 10 );
1596 f. close ( ); 1596 f. close ( );
@@ -1687,36 +1687,36 @@ void Zaurus::initButtons ( )
1687 pz_buttons = z_buttons; 1687 pz_buttons = z_buttons;
1688 buttoncount = ARRAY_SIZE(z_buttons); 1688 buttoncount = ARRAY_SIZE(z_buttons);
1689 break; 1689 break;
1690 } 1690 }
1691 1691
1692 for ( int i = 0; i < buttoncount; i++ ) { 1692 for ( int i = 0; i < buttoncount; i++ ) {
1693 struct z_button *zb = pz_buttons + i; 1693 struct z_button *zb = pz_buttons + i;
1694 ODeviceButton b; 1694 ODeviceButton b;
1695 1695
1696 b. setKeycode ( zb-> code ); 1696 b. setKeycode ( zb-> code );
1697 b. setUserText ( QObject::tr ( "Button", zb-> utext )); 1697 b. setUserText ( QObject::tr ( "Button", zb-> utext ));
1698 b. setPixmap ( Resource::loadPixmap ( zb-> pix )); 1698 b. setPixmap ( Resource::loadPixmap ( zb-> pix ));
1699 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), 1699 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ),
1700 zb-> fpressedaction )); 1700 zb-> fpressedaction ));
1701 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), 1701 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ),
1702 zb-> fheldaction )); 1702 zb-> fheldaction ));
1703 1703
1704 d-> m_buttons-> append ( b ); 1704 d-> m_buttons-> append ( b );
1705 } 1705 }
1706 1706
1707 reloadButtonMapping ( ); 1707 reloadButtonMapping ( );
1708 1708
1709 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 1709 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
1710 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), 1710 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )),
1711 this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 1711 this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
1712} 1712}
1713 1713
1714#include <unistd.h> 1714#include <unistd.h>
1715#include <fcntl.h> 1715#include <fcntl.h>
1716#include <sys/ioctl.h> 1716#include <sys/ioctl.h>
1717 1717
1718//#include <asm/sharp_char.h> // including kernel headers is evil ... 1718//#include <asm/sharp_char.h> // including kernel headers is evil ...
1719 1719
1720#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 1720#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
1721 1721
1722 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1722 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
@@ -1955,40 +1955,42 @@ bool Zaurus::setSoftSuspend ( bool soft )
1955 1955
1956 ::close ( fd ); 1956 ::close ( fd );
1957 } 1957 }
1958 else 1958 else
1959 perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); 1959 perror ( "/dev/apm_bios or /dev/misc/apm_bios" );
1960 1960
1961 return res; 1961 return res;
1962} 1962}
1963 1963
1964 1964
1965bool Zaurus::setDisplayBrightness ( int bright ) 1965bool Zaurus::setDisplayBrightness ( int bright )
1966{ 1966{
1967 //qDebug( "Zaurus::setDisplayBrightness( %d )", bright );
1967 bool res = false; 1968 bool res = false;
1968 int fd; 1969 int fd;
1969 1970
1970 if ( bright > 255 ) bright = 255; 1971 if ( bright > 255 ) bright = 255;
1971 if ( bright < 0 ) bright = 0; 1972 if ( bright < 0 ) bright = 0;
1972 1973
1973 if ( m_embedix ) 1974 if ( m_embedix )
1974 { 1975 {
1975 if ( d->m_model == Model_Zaurus_SLC7x0 ) 1976 if ( d->m_model == Model_Zaurus_SLC7x0 )
1976 { 1977 {
1978 //qDebug( "using special treatment for devices with the corgi backlight interface" );
1977 // special treatment for devices with the corgi backlight interface 1979 // special treatment for devices with the corgi backlight interface
1978 if (( fd = ::open ( "/proc/driver/fl/corgi-bl", O_WRONLY )) >= 0 ) 1980 if (( fd = ::open ( "/proc/driver/fl/corgi-bl", O_WRONLY )) >= 0 )
1979 { 1981 {
1980 if ( bright > 0x11 ) bright = 0x11; 1982 int value = ( bright == 1 ) ? 1 : bright * ( 17.0 / 255.0 );
1981 char writeCommand[100]; 1983 char writeCommand[100];
1982 const int count = sprintf( writeCommand, "0x%x\n", bright ); 1984 const int count = sprintf( writeCommand, "0x%x\n", value );
1983 res = ( ::write ( fd, writeCommand, count ) != -1 ); 1985 res = ( ::write ( fd, writeCommand, count ) != -1 );
1984 ::close ( fd ); 1986 ::close ( fd );
1985 } 1987 }
1986 return res; 1988 return res;
1987 } 1989 }
1988 else 1990 else
1989 { 1991 {
1990 // standard treatment for devices with the dumb embedix frontlight interface 1992 // standard treatment for devices with the dumb embedix frontlight interface
1991 if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { 1993 if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) {
1992 int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus 1994 int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus
1993 if ( bright && !bl ) 1995 if ( bright && !bl )
1994 bl = 1; 1996 bl = 1;