Diffstat (limited to 'libopie2/opiecore/device/odevice_zaurus.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 96 |
1 files changed, 59 insertions, 37 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index fb23e1d..75a2fdc 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp @@ -170,4 +170,7 @@ void Zaurus::init(const QString& cpu_info) d->m_model = Model_Zaurus_SLC7x0; d->m_modelstr = "Zaurus SL-C760 or SL-C860"; + } else if ( model == "SHARP Boxer" ) { + d->m_model = Model_Zaurus_SLC7x0; + d->m_modelstr = "Zaurus SL-C760 or SL-C860"; } else if ( model == "SHARP Poodle" ) { d->m_model = Model_Zaurus_SLB600; @@ -179,7 +182,10 @@ void Zaurus::init(const QString& cpu_info) d->m_model = Model_Zaurus_SL6000; d->m_modelstr = "Zaurus SL-6000"; + } else if ( model == "SHARP Spitz" ) { + d->m_model = Model_Zaurus_SLC3000; + d->m_modelstr = "Zaurus SL-C3000"; } else { d->m_model = Model_Zaurus_SL5500; - d->m_modelstr = "Unkown Zaurus"; + d->m_modelstr = "Unknown Zaurus"; } @@ -190,4 +196,5 @@ void Zaurus::init(const QString& cpu_info) d->m_rotation = Rot0; break; + case Model_Zaurus_SLC3000: // fallthrough case Model_Zaurus_SLC7x0: d->m_rotation = rotation(); @@ -195,11 +202,11 @@ void Zaurus::init(const QString& cpu_info) break; case Model_Zaurus_SLB600: // fallthrough + case Model_Zaurus_SL5000: // fallthrough case Model_Zaurus_SL5500: // fallthrough - case Model_Zaurus_SL5000: default: d->m_rotation = Rot270; break; } - m_leds [0] = Led_Off; + m_leds[0] = Led_Off; } @@ -254,8 +261,7 @@ void Zaurus::buzzer( int sound ) Sound *snd = 0; - // Not all devices have real sound - if ( d->m_model == Model_Zaurus_SLC7x0 - || d->m_model == Model_Zaurus_SLB600 - || d->m_model == Model_Zaurus_SL6000 ) { + // All devices except SL5500 have a DSP device + if ( d->m_model != Model_Zaurus_SL5000 + && d->m_model != Model_Zaurus_SL5500 ) { switch ( sound ){ @@ -263,10 +269,10 @@ void Zaurus::buzzer( int sound ) static Sound touch_sound("touchsound"); snd = &touch_sound; - } + } break; case SHARP_BUZ_KEYSOUND: { static Sound key_sound( "keysound" ); snd = &key_sound; - } + } break; case SHARP_BUZ_SCHEDULE_ALARM: @@ -274,5 +280,5 @@ void Zaurus::buzzer( int sound ) static Sound alarm_sound("alarm"); snd = &alarm_sound; - } + } break; } @@ -321,5 +327,5 @@ QValueList <OLed> Zaurus::ledList() const } -QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const +QValueList <OLedState> Zaurus::ledStateList( OLed l ) const { QValueList <OLedState> vl; @@ -330,5 +336,5 @@ QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const } -OLedState Zaurus::ledState ( OLed which ) const +OLedState Zaurus::ledState( OLed which ) const { if ( which == Led_Mail ) @@ -338,8 +344,12 @@ OLedState Zaurus::ledState ( OLed which ) const } -bool Zaurus::setLedState ( OLed which, OLedState st ) +bool Zaurus::setLedState( OLed which, OLedState st ) { - if (!m_embedix) // Currently not supported on non_embedix kernels + // Currently not supported on non_embedix kernels + if (!m_embedix) + { + qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" ); return false; + } static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); @@ -416,5 +426,5 @@ bool Zaurus::setDisplayBrightness( int bright ) { int numberOfSteps = displayBrightnessResolution(); - int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); + int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); if ( fd ) { @@ -426,5 +436,5 @@ bool Zaurus::setDisplayBrightness( int bright ) else { - qDebug( "ODevice handling for non-embedix kernels not yet implemented" ); + qDebug( "Zaurus::setDisplayBrightness: ODevice handling for non-embedix kernels not yet implemented" ); } return res; @@ -436,5 +446,5 @@ bool Zaurus::setDisplayStatus( bool on ) if ( m_embedix ) { - int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); + int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); if ( fd ) { @@ -446,8 +456,8 @@ bool Zaurus::setDisplayStatus( bool on ) else { - qDebug( "ODevice handling for non-embedix kernels not yet implemented" ); + qDebug( "Zaurus::setDisplayStatus: ODevice handling for non-embedix kernels not yet implemented" ); } return res; -} +} bool Zaurus::suspend() @@ -490,4 +500,5 @@ Transformation Zaurus::rotation() const switch ( d->m_model ) { + case Model_Zaurus_SLC3000: // fallthrough case Model_Zaurus_SLC7x0: handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); @@ -504,6 +515,7 @@ Transformation Zaurus::rotation() const } break; - case Model_Zaurus_SLA300: + case Model_Zaurus_SL6000: case Model_Zaurus_SLB600: + case Model_Zaurus_SLA300: case Model_Zaurus_SL5500: case Model_Zaurus_SL5000: @@ -521,4 +533,5 @@ ODirection Zaurus::direction() const int retval = 0; switch ( d->m_model ) { + case Model_Zaurus_SLC3000: // fallthrough case Model_Zaurus_SLC7x0: handle = ::open( "/dev/apm_bios", O_RDWR|O_NONBLOCK ); @@ -534,9 +547,10 @@ ODirection Zaurus::direction() const } break; + case Model_Zaurus_SL6000: case Model_Zaurus_SLA300: case Model_Zaurus_SLB600: case Model_Zaurus_SL5500: case Model_Zaurus_SL5000: - default: dir = d->m_direction; + default: dir = d->m_direction; break; } @@ -555,5 +569,5 @@ int Zaurus::displayBrightnessResolution() const else { - qDebug( "ODevice handling for non-embedix kernels not yet implemented" ); + qDebug( "Zaurus::displayBrightnessResolution: ODevice handling for non-embedix kernels not yet implemented" ); return 1; } @@ -562,29 +576,37 @@ int Zaurus::displayBrightnessResolution() const bool Zaurus::hasHingeSensor() const { - return d->m_model == Model_Zaurus_SLC7x0; + return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000; } OHingeStatus Zaurus::readHingeSensor() { - int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); - if (handle == -1) - { - qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror - return CASE_UNKNOWN; - } - else + if (m_embedix) { - int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); - ::close (handle); - if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE ) + int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); + if (handle == -1) { - qDebug( "Zaurus::readHingeSensor() - result = %d", retval ); - return static_cast<OHingeStatus>( retval ); + qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror + return CASE_UNKNOWN; } else { - qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); - return CASE_UNKNOWN; + int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); + ::close (handle); + if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE ) + { + qDebug( "Zaurus::readHingeSensor() - result = %d", retval ); + return static_cast<OHingeStatus>( retval ); + } + else + { + qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); + return CASE_UNKNOWN; + } } } + else + { + qDebug( "Zaurus::readHingeSensor: ODevice handling for non-embedix kernels not yet implemented" ); + return CASE_UNKNOWN; + } } |