summaryrefslogtreecommitdiff
Unidiff
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
@@ -1542,59 +1542,59 @@ bool Zaurus::isZaurus()
1542 bool is_zaurus = false; 1542 bool is_zaurus = false;
1543 QFile f ( "/proc/cpuinfo" ); 1543 QFile f ( "/proc/cpuinfo" );
1544 if ( f. open ( IO_ReadOnly ) ) { 1544 if ( f. open ( IO_ReadOnly ) ) {
1545 QString model; 1545 QString model;
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 ( );
1597 } 1597 }
1598 1598
1599 // Openzaurus sometimes uses the embedix kernel! 1599 // Openzaurus sometimes uses the embedix kernel!
1600 // => Check whether this is an embedix kernel 1600 // => Check whether this is an embedix kernel
@@ -1683,44 +1683,44 @@ void Zaurus::initButtons ( )
1683 pz_buttons = z_buttons_c700; 1683 pz_buttons = z_buttons_c700;
1684 buttoncount = ARRAY_SIZE(z_buttons_c700); 1684 buttoncount = ARRAY_SIZE(z_buttons_c700);
1685 break; 1685 break;
1686 default: 1686 default:
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)
1723#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1723#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1724 1724
1725#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1725#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1726#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1726#define SHARP_BUZ_KEYSOUND 2 /* key sound */
@@ -1951,48 +1951,50 @@ bool Zaurus::setSoftSuspend ( bool soft )
1951 perror ( "APM_IOCGEVTSRC" ); 1951 perror ( "APM_IOCGEVTSRC" );
1952 } 1952 }
1953 else 1953 else
1954 perror ( "APM_IOCGEVTSRC" ); 1954 perror ( "APM_IOCGEVTSRC" );
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;
1995 res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 ); 1997 res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 );
1996 ::close ( fd ); 1998 ::close ( fd );
1997 } 1999 }
1998 } 2000 }