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 @@ -164,48 +164,55 @@ void Zaurus::init(const QString& cpu_info) d->m_model = Model_Zaurus_SLC7x0; d->m_modelstr = "Zaurus SL-C700"; } else if ( model == "SHARP Shepherd" ) { d->m_model = Model_Zaurus_SLC7x0; d->m_modelstr = "Zaurus SL-C750"; } else if ( model == "SHARP Husky" ) { 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; d->m_modelstr = "Zaurus SL-B500 or SL-5600"; } else if ( model == "Sharp-Collie" || model == "Collie" ) { d->m_model = Model_Zaurus_SL5500; d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; } else if ( model == "SHARP Tosa" ) { 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"; } // set initial rotation switch( d->m_model ) { case Model_Zaurus_SL6000: // fallthrough case Model_Zaurus_SLA300: d->m_rotation = Rot0; break; + case Model_Zaurus_SLC3000: // fallthrough case Model_Zaurus_SLC7x0: d->m_rotation = rotation(); d->m_direction = direction(); 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; } void Zaurus::initButtons() { if ( d->m_buttons ) return; d->m_buttons = new QValueList <ODeviceButton>; @@ -248,37 +255,36 @@ typedef struct sharp_led_status { int status; /* set new led status if you call SHARP_LED_SETSTATUS */ } sharp_led_status; void Zaurus::buzzer( int sound ) { #ifndef QT_NO_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 ){ case SHARP_BUZ_TOUCHSOUND: { 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: default: { static Sound alarm_sound("alarm"); snd = &alarm_sound; - } + } break; } } // If a soundname is defined, we expect that this device has // sound capabilities.. Otherwise we expect to have the buzzer // device.. if ( snd && snd->isFinished() ){ @@ -315,37 +321,41 @@ void Zaurus::playKeySound() QValueList <OLed> Zaurus::ledList() const { QValueList <OLed> vl; vl << Led_Mail; return vl; } -QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const +QValueList <OLedState> Zaurus::ledStateList( OLed l ) const { QValueList <OLedState> vl; if ( l == Led_Mail ) vl << Led_Off << Led_On << Led_BlinkSlow; return vl; } -OLedState Zaurus::ledState ( OLed which ) const +OLedState Zaurus::ledState( OLed which ) const { if ( which == Led_Mail ) return m_leds [0]; else return Led_Off; } -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 ); if ( which == Led_Mail ) { if ( fd >= 0 ) { struct sharp_led_status leds; ::memset ( &leds, 0, sizeof( leds )); leds. which = SHARP_LED_MAIL_EXISTS; @@ -410,50 +420,50 @@ bool Zaurus::setDisplayBrightness( int bright ) bool res = false; if ( bright > 255 ) bright = 255; if ( bright < 0 ) bright = 0; if ( m_embedix ) { 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 ) { int val = ( bright * numberOfSteps ) / 255; res = ( ::ioctl ( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); ::close ( fd ); } } 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; } bool Zaurus::setDisplayStatus( bool on ) { bool res = false; 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 ) { int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); ::close ( fd ); } } 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() { qDebug("ODevice::suspend"); if ( !isQWS( ) ) // only qwsserver is allowed to suspend return false; if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices @@ -484,107 +494,119 @@ bool Zaurus::suspend() Transformation Zaurus::rotation() const { Transformation rot; int handle = 0; 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); if (handle == -1) { return Rot270; } else { retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); ::close (handle); if (retval == 2 ) rot = Rot0; else rot = Rot270; } 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: default: rot = d->m_rotation; break; } return rot; } ODirection Zaurus::direction() const { ODirection dir; int handle = 0; 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 ); if (handle == -1) { dir = CW; } else { retval = ::ioctl( handle, SHARP_IOCTL_GET_ROTATION ); ::close (handle); if (retval == 2 ) dir = CCW; else dir = CW; } 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; } return dir; } int Zaurus::displayBrightnessResolution() const { if (m_embedix) { int handle = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); if ( handle != -1 ) return ::ioctl( handle, SHARP_FL_IOCTL_GET_STEP, 0 ); else return 1; } 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; } } 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; + } } |