-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 @@ -1546,51 +1546,51 @@ bool Zaurus::isZaurus() QFile f ( "/proc/cpuinfo" ); QTextStream ts ( &f ); QString line; while( line = ts. readLine ( ) ) { if ( line. left ( 8 ) == "Hardware" ) break; } int loc = line. find ( ":" ); if ( loc != -1 ) model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); - if ( model == "Sharp-Collie" - || model == "Collie" + if ( model == "Sharp-Collie" + || model == "Collie" || model == "SHARP Corgi" - || model == "SHARP Shepherd" - || model == "SHARP Poodle" + || model == "SHARP Shepherd" + || model == "SHARP Poodle" || model == "SHARP Husky" ) is_zaurus = true; } return is_zaurus; } void Zaurus::init ( ) { d-> m_vendorstr = "Sharp"; d-> m_vendor = Vendor_Sharp; m_embedix = true; // Not openzaurus means: It has an embedix kernel ! // QFile f ( "/proc/filesystems" ); QString model; - // It isn't a good idea to check the system configuration to - // detect the distribution ! + // It isn't a good idea to check the system configuration to + // detect the distribution ! // Otherwise it may happen that any other distribution is detected as openzaurus, just - // because it uses a jffs2 filesystem.. + // because it uses a jffs2 filesystem.. // (eilers) // if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { QFile f ("/etc/oz_version"); if ( f.exists() ){ d-> m_vendorstr = "OpenZaurus Team"; d-> m_systemstr = "OpenZaurus"; d-> m_system = System_OpenZaurus; if ( f. open ( IO_ReadOnly )) { QTextStream ts ( &f ); d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); f. close ( ); @@ -1687,36 +1687,36 @@ void Zaurus::initButtons ( ) pz_buttons = z_buttons; buttoncount = ARRAY_SIZE(z_buttons); break; } for ( int i = 0; i < buttoncount; i++ ) { struct z_button *zb = pz_buttons + i; ODeviceButton b; b. setKeycode ( zb-> code ); b. setUserText ( QObject::tr ( "Button", zb-> utext )); b. setPixmap ( Resource::loadPixmap ( zb-> pix )); - b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), + b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), zb-> fpressedaction )); - b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), + b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction )); d-> m_buttons-> append ( b ); } reloadButtonMapping ( ); QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); - connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), + connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); } #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h> //#include <asm/sharp_char.h> // including kernel headers is evil ... #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 #define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) @@ -1955,40 +1955,42 @@ bool Zaurus::setSoftSuspend ( bool soft ) ::close ( fd ); } else perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); return res; } bool Zaurus::setDisplayBrightness ( int bright ) { + //qDebug( "Zaurus::setDisplayBrightness( %d )", bright ); bool res = false; int fd; if ( bright > 255 ) bright = 255; if ( bright < 0 ) bright = 0; if ( m_embedix ) { 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 ) { - if ( bright > 0x11 ) bright = 0x11; + int value = ( bright == 1 ) ? 1 : bright * ( 17.0 / 255.0 ); char writeCommand[100]; - const int count = sprintf( writeCommand, "0x%x\n", bright ); + const int count = sprintf( writeCommand, "0x%x\n", value ); res = ( ::write ( fd, writeCommand, count ) != -1 ); ::close ( fd ); } return res; } else { // 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; |