-rw-r--r-- | libopie2/opiecore/device/odevice_htc.cpp | 10 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_motorola_ezx.cpp | 45 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_palm.cpp | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 10 |
4 files changed, 16 insertions, 53 deletions
diff --git a/libopie2/opiecore/device/odevice_htc.cpp b/libopie2/opiecore/device/odevice_htc.cpp index a6ade11..44b33c0 100644 --- a/libopie2/opiecore/device/odevice_htc.cpp +++ b/libopie2/opiecore/device/odevice_htc.cpp @@ -46,135 +46,135 @@ /* STD */ #include <string.h> #include <errno.h> #include <fcntl.h> #include <math.h> #include <stdlib.h> #include <signal.h> #include <sys/ioctl.h> #include <sys/time.h> #include <unistd.h> #ifndef QT_NO_SOUND #include <linux/soundcard.h> #endif using namespace Opie::Core; using namespace Opie::Core::Internal; struct htc_button htc_buttons [] = { { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), "devicebuttons/z_calendar", "datebook", "nextView()", "today", "raise()" }, { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), "devicebuttons/z_contact", "addressbook", "raise()", "addressbook", "beamBusinessCard()" }, { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), "devicebuttons/z_home", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), "devicebuttons/z_menu", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), "devicebuttons/z_mail", "opiemail", "raise()", "opiemail", "newMail()" }, }; struct htc_button htc_buttons_universal [] = { { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), "devicebuttons/z_calendar", "datebook", "nextView()", "today", "raise()" }, { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), "devicebuttons/z_contact", "addressbook", "raise()", "addressbook", "beamBusinessCard()" }, { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), "devicebuttons/z_home", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), "devicebuttons/z_menu", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), "devicebuttons/z_mail", "opiemail", "raise()", "opiemail", "newMail()" }, { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), "devicebuttons/z_hinge1", - "QPE/Rotation", "rotateDefault()",0}, + "QPE/Rotation", "rotateDefault()",0,0}, { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), "devicebuttons/z_hinge2", - "QPE/Rotation", "rotateDefault()",0}, + "QPE/Rotation", "rotateDefault()",0,0}, { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), "devicebuttons/z_hinge3", - "QPE/Rotation", "rotateDefault()",0}, + "QPE/Rotation", "rotateDefault()",0,0}, }; // // HTC-Universal (PXA-model w/ 480x640 3.6" lcd) // HTC-Alpine (PXA-model w/ 240x320 3.5" lcd) // HTC-Apache (PXA-model w/ 240x320 2.8" lcd) // HTC-Beetles (PXA-model w/ 240x240 3.0" lcd) // HTC-Blueangel (PXA-model w/ 240x320 3.5" lcd) // HTC-Himalaya (PXA-model w/ 240x320 3.5" lcd) // HTC-Magician (PXA-model w/ 240x320 2.8" lcd) void HTC::init(const QString& cpu_info) { qDebug( "HTC::init()" ); // Set the time to wait until the system is really suspended // the delta between apm --suspend and sleeping setAPMTimeOut( 15000 ); d->m_vendorstr = "Xanadux Team"; d->m_systemstr = "Familiar"; d->m_system = System_Familiar; // check the HTC model QString model; int loc = cpu_info.find( ":" ); if ( loc != -1 ) model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); else model = cpu_info; d->m_model = Model_HTC_Universal; d->m_modelstr = "Unknown HTC"; if ( model == "HTC Universal" ) { d->m_model = Model_HTC_Universal; d->m_modelstr = "HTC Universal"; } if ( model == "HTC Alpine" ) { d->m_model = Model_HTC_Alpine; d->m_modelstr = "HTC Alpine"; } if ( model == "HTC Apache" ) { d->m_model = Model_HTC_Apache; d->m_modelstr = "HTC Apache"; } if ( model == "HTC Beetles" ) { d->m_model = Model_HTC_Beetles; d->m_modelstr = "HTC Beetles"; } if ( model == "HTC Blueangel" ) { d->m_model = Model_HTC_Blueangel; d->m_modelstr = "HTC Blueangel"; } if ( model == "HTC Himalaya" ) { d->m_model = Model_HTC_Himalaya; d->m_modelstr = "HTC Himalaya"; } if ( model == "HTC Magician" ) { d->m_model = Model_HTC_Magician; d->m_modelstr = "HTC Magician"; } @@ -294,204 +294,206 @@ void HTC::buzzer( int 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() ){ changeMixerForAlarm( 0, "/dev/mixer", snd ); snd->play(); } else if( !snd ) { int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); if ( fd >= 0 ) { ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); ::close ( fd ); } } #endif } void HTC::playAlarmSound() { buzzer( SHARP_BUZ_SCHEDULE_ALARM ); } void HTC::playTouchSound() { buzzer( SHARP_BUZ_TOUCHSOUND ); } void HTC::playKeySound() { buzzer( SHARP_BUZ_KEYSOUND ); } QValueList <OLed> HTC::ledList() const { QValueList <OLed> vl; vl << Led_Mail; return vl; } QValueList <OLedState> HTC::ledStateList( OLed l ) const { QValueList <OLedState> vl; if ( l == Led_Mail ) vl << Led_Off << Led_On << Led_BlinkSlow; return vl; } OLedState HTC::ledState( OLed which ) const { if ( which == Led_Mail ) return m_leds [0]; else return Led_Off; } -bool HTC::setLedState( OLed which, OLedState st ) +bool HTC::setLedState( OLed, OLedState ) { qDebug( "HTC::setLedState: ODevice handling not yet implemented" ); return false; } int HTC::displayBrightnessResolution() const { int res = 1; int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); if ( fd ) { char buf[100]; if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); ::close( fd ); } return res; } bool HTC::setDisplayBrightness( int bright ) { //qDebug( "HTC::setDisplayBrightness( %d )", bright ); bool res = false; if ( bright > 255 ) bright = 255; if ( bright < 0 ) bright = 0; int numberOfSteps = displayBrightnessResolution(); int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); if ( fd ) { char buf[100]; int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); res = ( ::write( fd, &buf[0], len ) == 0 ); ::close( fd ); } return res; } bool HTC::setDisplayStatus( bool on ) { bool res = false; int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK ); if ( fd ) { char buf[10]; buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; buf[1] = '\0'; res = ( ::write( fd, &buf[0], 2 ) == 0 ); ::close( fd ); } return res; } Transformation HTC::rotation() const { qDebug( "HTC::rotation()" ); Transformation rot = Rot270; switch ( d->m_model ) { case Model_HTC_Universal: { OHingeStatus hs = readHingeSensor(); qDebug( "HTC::rotation() - hinge sensor = %d", (int) hs ); if ( hs == CASE_PORTRAIT ) rot = Rot0; else if ( hs == CASE_UNKNOWN ) rot = Rot270; } break; + default: + break; } qDebug( "HTC::rotation() - returning '%d'", rot ); return rot; } ODirection HTC::direction() const { ODirection dir; switch ( d->m_model ) { case Model_HTC_Universal: { OHingeStatus hs = readHingeSensor(); if ( hs == CASE_PORTRAIT ) dir = CCW; else if ( hs == CASE_UNKNOWN ) dir = CCW; else dir = CW; } break; default: dir = d->m_direction; break; } return dir; } bool HTC::hasHingeSensor() const { return d->m_model == Model_HTC_Universal; } OHingeStatus HTC::readHingeSensor() const { /* * The HTC Universal keyboard is event source 1 in kernel 2.6. * Hinge status is reported via Input System Switchs 0 and 1 like that: * * ------------------------- * | SW0 | SW1 | CASE | * |-----|-----|-----------| * | 0 0 Unknown | * | 1 0 Portrait | * | 0 1 Closed | * | 1 1 Landscape | * ------------------------- */ OInputDevice* keyboard = OInputSystem::instance()->device( "event1" ); bool switch0 = true; bool switch1 = false; if ( keyboard ) { switch0 = keyboard->isHeld( OInputDevice::Switch0 ); switch1 = keyboard->isHeld( OInputDevice::Switch1 ); } if ( switch0 ) { return switch1 ? CASE_LANDSCAPE : CASE_PORTRAIT; } else { return switch1 ? CASE_CLOSED : CASE_UNKNOWN; } } void HTC::initHingeSensor() { diff --git a/libopie2/opiecore/device/odevice_motorola_ezx.cpp b/libopie2/opiecore/device/odevice_motorola_ezx.cpp index eed81ac..67a2b9b 100644 --- a/libopie2/opiecore/device/odevice_motorola_ezx.cpp +++ b/libopie2/opiecore/device/odevice_motorola_ezx.cpp @@ -66,227 +66,186 @@ struct ezx_button ezx_buttons [] = { "datebook", "nextView()", "today", "raise()" }, { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), "devicebuttons/z_contact", "addressbook", "raise()", "addressbook", "beamBusinessCard()" }, { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), "devicebuttons/z_home", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), "devicebuttons/z_menu", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), "devicebuttons/z_mail", "opiemail", "raise()", "opiemail", "newMail()" }, }; void Motorola_EZX::init(const QString& cpu_info) { qDebug( "Motorola_EZX::init()" ); // Set the time to wait until the system is really suspended // the delta between apm --suspend and sleeping setAPMTimeOut( 15000 ); d->m_vendorstr = "OpenEZX Team"; d->m_systemstr = "OpenEZX"; d->m_system = System_OpenEZX; // sysver already gathered // check the Motorola_EZX model QString model; int loc = cpu_info.find( ":" ); if ( loc != -1 ) model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); else model = cpu_info; if ( model == "Motorola Ezx Platform" ) { d->m_model = Model_Motorola_EZX; d->m_modelstr = "Motorola_EZX"; } else assert( 0 ); // set path to backlight device in kernel 2.6 m_backlightdev = "/sys/class/backlight/ezx-bl/"; d->m_rotation = Rot0; //initHingeSensor(); // set default qte driver and led state d->m_qteDriver = "Transformed"; m_leds[0] = Led_Off; qDebug( "Motorola_EZX::init() - Using the 2.6 OpenEZX HAL on a %s", (const char*) d->m_modelstr ); } void Motorola_EZX::initButtons() { qDebug( "Motorola_EZX::initButtons()" ); if ( d->m_buttons ) return; d->m_buttons = new QValueList <ODeviceButton>; - - struct ezx_button * ezx_buttons; - int buttoncount; - -/* - - switch ( d->m_model ) - { - case Model_Motorola_EZX_SL6000: - pezx_buttons = ezx_buttons_6000; - buttoncount = ARRAY_SIZE(ezx_buttons_6000); - break; - case Model_Motorola_EZX_SLC3100: // fallthrough - case Model_Motorola_EZX_SLC3000: // fallthrough - case Model_Motorola_EZX_SLC1000: // fallthrough - case Model_Motorola_EZX_SLC7x0: - if ( isQWS( ) ) - { - addPreHandler(this); - } - pezx_buttons = ezx_buttons_c700; - buttoncount = ARRAY_SIZE(ezx_buttons_c700); - break; - default: - pezx_buttons = ezx_buttons; - buttoncount = ARRAY_SIZE(ezx_buttons); - break; - } - - for ( int i = 0; i < buttoncount; i++ ) { - struct ezx_button *zb = pezx_buttons + i; - ODeviceButton b; - - b.setKeycode( zb->code ); - b.setUserText( QObject::tr( "Button", zb->utext )); - b.setPixmap( OResource::loadPixmap( zb->pix )); - b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); - b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); - d->m_buttons->append( b ); - } -*/ reloadButtonMapping(); } void Motorola_EZX::playAlarmSound() { #ifndef QT_NO_SOUND static Sound snd ( "alarm" ); if(!snd.isFinished()) return; changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); snd. play(); #endif } QValueList <OLed> Motorola_EZX::ledList() const { QValueList <OLed> vl; vl << Led_Mail; return vl; } QValueList <OLedState> Motorola_EZX::ledStateList( OLed l ) const { QValueList <OLedState> vl; if ( l == Led_Mail ) vl << Led_Off << Led_On << Led_BlinkSlow; return vl; } OLedState Motorola_EZX::ledState( OLed which ) const { if ( which == Led_Mail ) return m_leds [0]; else return Led_Off; } -bool Motorola_EZX::setLedState( OLed which, OLedState st ) +bool Motorola_EZX::setLedState( OLed, OLedState ) { // Currently not supported qDebug( "Motorola_EZX::setLedState: ODevice handling not yet implemented" ); return false; } int Motorola_EZX::displayBrightnessResolution() const { int res = 1; int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); if ( fd ) { char buf[100]; if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); ::close( fd ); } return res; } bool Motorola_EZX::setDisplayBrightness( int bright ) { qDebug( "Motorola_EZX::setDisplayBrightness( %d )", bright ); return false; bool res = false; if ( bright > 255 ) bright = 255; if ( bright < 0 ) bright = 0; int numberOfSteps = displayBrightnessResolution(); int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); if ( fd ) { char buf[100]; int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); res = ( ::write( fd, &buf[0], len ) == 0 ); ::close( fd ); } return res; } bool Motorola_EZX::setDisplayStatus( bool on ) { bool res = false; int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK ); if ( fd ) { char buf[10]; buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; buf[1] = '\0'; res = ( ::write( fd, &buf[0], 2 ) == 0 ); ::close( fd ); } return res; } void Motorola_EZX::systemMessage( const QCString &msg, const QByteArray & ) { if ( msg == "deviceButtonMappingChanged()" ) { reloadButtonMapping(); } } bool Motorola_EZX::suspend() { if ( !isQWS( ) ) // only qwsserver is allowed to suspend return false; bool res = false; QCopChannel::send( "QPE/System", "aboutToSuspend()" ); - struct timeval tvs, tvn; + struct timeval tvs; ::gettimeofday ( &tvs, 0 ); ::sync(); // flush fs caches res = ( ::system ( "apm --suspend" ) == 0 ); QCopChannel::send( "QPE/System", "returnFromSuspend()" ); return res; } diff --git a/libopie2/opiecore/device/odevice_palm.cpp b/libopie2/opiecore/device/odevice_palm.cpp index 76399f8..399c08c 100644 --- a/libopie2/opiecore/device/odevice_palm.cpp +++ b/libopie2/opiecore/device/odevice_palm.cpp @@ -28,255 +28,257 @@ Boston, MA 02111-1307, USA. */ #include "odevice_palm.h" /* QT */ #include <qapplication.h> #include <qfile.h> #include <qtextstream.h> #include <qwindowsystem_qws.h> #include <qgfx_qws.h> /* OPIE */ #include <qpe/config.h> #include <qpe/sound.h> #include <qpe/qcopenvelope_qws.h> #include <opie2/okeyfilter.h> #include <opie2/oresource.h> /* STD */ #include <fcntl.h> #include <math.h> #include <stdlib.h> #include <signal.h> #include <sys/ioctl.h> #include <sys/time.h> #include <unistd.h> #ifndef QT_NO_SOUND #include <linux/soundcard.h> #endif using namespace Opie::Core; using namespace Opie::Core::Internal; struct palm_button palm_buttons [] = { { Model_Palm_TX | Model_Palm_LD | Model_Palm_Z72, Qt::Key_F9, QT_TRANSLATE_NOOP( "Button", "Home Button" ), "devicebuttons/palm_home", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, { Model_Palm_TX | Model_Palm_LD | Model_Palm_Z72, Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Calendar Button" ), "devicebuttons/palm_calendar", "datebook", "nextView()", "today", "raise()" }, { Model_Palm_TX | Model_Palm_LD | Model_Palm_Z72, Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "Todo Button" ), "devicebuttons/palm_todo", "todolist", "raise()", "todolist", "create()" }, { Model_Palm_TX | Model_Palm_LD | Model_Palm_Z72, Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "Mail Button" ), "devicebuttons/palm_mail", "opiemail", "raise()", "opiemail", "newmail()" }, { Model_Palm_LD, Qt::Key_F7, QT_TRANSLATE_NOOP( "Button", "Voice Memo Button" ), "devicebuttons/palm_voice_memo", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, { Model_Palm_LD, Qt::Key_F8, QT_TRANSLATE_NOOP( "Button", "Rotate Button" ), "devicebuttons/palm_rotate", - "QPE/Rotation", "flip()",0}, + "QPE/Rotation", "flip()",0,0}, }; void Palm::init(const QString& cpu_info) { d->m_vendorstr = "Palm"; d->m_vendor = Vendor_Palm; QString model = "unknown"; int loc = cpu_info.find( ":" ); if ( loc != -1 ) model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); else model = cpu_info; if ( model == "Palm LifeDrive" ) { d->m_modelstr = "Palm LifeDrive"; d->m_model = Model_Palm_LD; } else if ( model == "Palm TX" ) { d->m_modelstr = "Palm TX"; d->m_model = Model_Palm_TX; } else if ( model == "Palm Zire 72" ) { d->m_modelstr = "Palm Zire 72"; d->m_model = Model_Palm_Z72; } else d->m_model = Model_Unknown; switch ( d->m_model ) { case Model_Palm_LD: case Model_Palm_TX: case Model_Palm_Z72: m_backlightdev = "/sys/class/backlight/pxapwm-bl/"; d->m_rotation = Rot0; d->m_direction = CCW; d->m_qteDriver = "Transformed"; break; default: m_backlightdev = ""; } } void Palm::initButtons() { if ( d->m_buttons ) return ; if ( isQWS( ) ) { addPreHandler(this); } d->m_buttons = new QValueList <ODeviceButton>; for ( uint i = 0; i < ( sizeof( palm_buttons ) / sizeof( palm_button ) ); i++ ) { palm_button *ib = palm_buttons + i; ODeviceButton b; if (( ib->model & d->m_model ) == d->m_model ) { b. setKeycode ( ib->code ); b. setUserText ( QObject::tr ( "Button", ib->utext )); b. setPixmap ( OResource::loadPixmap ( ib->pix )); b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); d->m_buttons->append ( b ); } } reloadButtonMapping(); } bool Palm::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) { int newkeycode = keycode; if (qt_screen->transformOrientation() != Rot0){ switch ( keycode ) { case Key_Left : case Key_Right: case Key_Up : case Key_Down : newkeycode = Key_Left + ( keycode - Key_Left + (int) qt_screen->transformOrientation() ) % 4; default: break; } if (newkeycode!=keycode) { if ( newkeycode != Key_unknown ) { QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); } return true; } } return false; } bool Palm::suspend() { // some Palms do not implement their own power management at the moment. bool res = false; if ( !isQWS( ) ) // only qwsserver is allowed to suspend return false; switch ( d->m_model ) { case Model_Palm_LD: case Model_Palm_Z72: { QCopChannel::send( "QPE/System", "aboutToSuspend()" ); ::sync(); // flush fs caches res = ( ::system ( "apm --suspend" ) == 0 ); QCopChannel::send( "QPE/System", "returnFromSuspend()" ); } break; + default: + break; } return res; } int Palm::displayBrightnessResolution() const { int res = 1; switch ( d->m_model ) { case Model_Palm_LD: case Model_Palm_TX: case Model_Palm_Z72: int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); if ( fd ) { char buf[100]; if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); ::close( fd ); } break; default: res = 1; } return res; } bool Palm::setDisplayBrightness( int bright ) { bool res = false; if ( bright > 255 ) bright = 255; if ( bright < 0 ) bright = 0; int numberOfSteps = displayBrightnessResolution(); int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; switch ( d->m_model ) { case Model_Palm_LD: case Model_Palm_TX: case Model_Palm_Z72: int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); if ( fd ) { char buf[100]; int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); res = ( ::write( fd, &buf[0], len ) == 0 ); ::close( fd ); } break; default: res = false; } return res; } diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 4963f54..9d2ebbb 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp @@ -46,162 +46,162 @@ /* STD */ #include <string.h> #include <errno.h> #include <fcntl.h> #include <math.h> #include <stdlib.h> #include <signal.h> #include <sys/ioctl.h> #include <sys/time.h> #include <unistd.h> #ifndef QT_NO_SOUND #include <linux/soundcard.h> #endif using namespace Opie::Core; using namespace Opie::Core::Internal; struct z_button z_buttons [] = { { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), "devicebuttons/z_calendar", "datebook", "nextView()", "today", "raise()" }, { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), "devicebuttons/z_contact", "addressbook", "raise()", "addressbook", "beamBusinessCard()" }, { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), "devicebuttons/z_home", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), "devicebuttons/z_menu", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), "devicebuttons/z_mail", "opiemail", "raise()", "opiemail", "newMail()" }, }; struct z_button z_buttons_c700 [] = { { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), "devicebuttons/z_calendar", "datebook", "nextView()", "today", "raise()" }, { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), "devicebuttons/z_contact", "addressbook", "raise()", "addressbook", "beamBusinessCard()" }, { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), "devicebuttons/z_home", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), "devicebuttons/z_menu", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), "devicebuttons/z_mail", "opiemail", "raise()", "opiemail", "newMail()" }, { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), "devicebuttons/z_hinge1", - "QPE/Rotation", "rotateDefault()",0}, + "QPE/Rotation", "rotateDefault()",0,0}, { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), "devicebuttons/z_hinge2", - "QPE/Rotation", "rotateDefault()",0}, + "QPE/Rotation", "rotateDefault()",0,0}, { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), "devicebuttons/z_hinge3", - "QPE/Rotation", "rotateDefault()",0}, + "QPE/Rotation", "rotateDefault()",0,0}, }; struct z_button z_buttons_6000 [] = { { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), "devicebuttons/z_calendar", "datebook", "nextView()", "today", "raise()" }, { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), "devicebuttons/z_contact", "addressbook", "raise()", "addressbook", "beamBusinessCard()" }, { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), "devicebuttons/z_home", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), "devicebuttons/z_menu", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), "devicebuttons/z_mail", "opiemail", "raise()", "opiemail", "newMail()" }, { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Rotate Button"), "devicebuttons/z_rotate", - 0, - "QPE/Rotation", "rotateDefault()" }, + 0, "QPE/Rotation", + "rotateDefault()", 0 }, { Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), "devicebuttons/z_hinge3", "QPE/VMemo", "toggleRecord()", "sound", "raise()" }, }; // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus // class up into individual classes. We would need three classes // // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100) // Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) void Zaurus::init(const QString& cpu_info) { qDebug( "Zaurus::init()" ); // Set the time to wait until the system is really suspended // the delta between apm --suspend and sleeping setAPMTimeOut( 15000 ); // generic distribution code already scanned /etc/issue at that point - // embedix releases contain "Embedix <version> | Linux for Embedded Devices" if ( d->m_sysverstr.contains( "embedix", false ) ) { d->m_vendorstr = "Sharp"; d->m_vendor = Vendor_Sharp; d->m_systemstr = "Zaurus"; d->m_system = System_Zaurus; m_embedix = true; } else { d->m_vendorstr = "OpenZaurus Team"; d->m_systemstr = "OpenZaurus"; d->m_system = System_OpenZaurus; // sysver already gathered // OpenZaurus sometimes uses the 2.4 (embedix) kernel, check if this is one FILE *uname = popen("uname -r", "r"); QFile f; QString line; if ( f.open(IO_ReadOnly, uname) ) { QTextStream ts ( &f ); line = ts.readLine(); m_embedix = line.startsWith( "2.4." ); f.close(); } pclose(uname); } // check the Zaurus model QString model; int loc = cpu_info.find( ":" ); if ( loc != -1 ) model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); else model = cpu_info; if ( model == "SHARP Corgi" ) { d->m_model = Model_Zaurus_SLC7x0; d->m_modelstr = "Zaurus SL-C700"; } else if ( model == "SHARP Shepherd" ) { d->m_model = Model_Zaurus_SLC7x0; |