-rw-r--r-- | libopie/odevice.cpp | 26 |
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 | |||
@@ -1550,21 +1550,21 @@ bool Zaurus::isZaurus() | |||
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 | ||
@@ -1573,20 +1573,20 @@ void 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 | ||
@@ -1691,28 +1691,28 @@ void Zaurus::initButtons ( ) | |||
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 ... |
@@ -1959,32 +1959,34 @@ bool Zaurus::setSoftSuspend ( bool soft ) | |||
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 | ||
1965 | bool Zaurus::setDisplayBrightness ( int bright ) | 1965 | bool 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 |