author | mickeyl <mickeyl> | 2003-12-08 15:17:16 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-12-08 15:17:16 (UTC) |
commit | 7f2f736597490fd1592d7ed1f40e4abf824673c0 (patch) (side-by-side diff) | |
tree | 542b6f52b3556f1f4f04c18c15446c73a867ebdc /libopie | |
parent | b1182e6a5069c7109f824a916e566c9c1954ded8 (diff) | |
download | opie-7f2f736597490fd1592d7ed1f40e4abf824673c0.zip opie-7f2f736597490fd1592d7ed1f40e4abf824673c0.tar.gz opie-7f2f736597490fd1592d7ed1f40e4abf824673c0.tar.bz2 |
Rot270 is not a Direction, but a Rotation. treke, is this fix correct?
-rw-r--r-- | libopie/odevice.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 5038cc9..e24e043 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp @@ -1914,272 +1914,272 @@ bool Zaurus::setSoftSuspend ( bool soft ) bool res = false; int fd; if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources if ( sources >= 0 ) { if ( soft ) sources &= ~APM_EVT_POWER_BUTTON; else sources |= APM_EVT_POWER_BUTTON; if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources res = true; else perror ( "APM_IOCGEVTSRC" ); } else perror ( "APM_IOCGEVTSRC" ); ::close ( fd ); } else perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); return res; } bool Zaurus::setDisplayBrightness ( int bright ) { // FIXME The C7x0 have a proc-interface (/proc/drivers/corgi-bl) which // is nice to use. Currently it exposes 16+1 levels. Implement this! // (or wait for kergoth unifying the interfaces in the OpenZaurus kernel.) bool res = false; int fd; if ( bright > 255 ) bright = 255; if ( bright < 0 ) bright = 0; if (m_embedix) { if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus if ( bright && !bl ) bl = 1; res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 ); ::close ( fd ); } } else { #define FB_BACKLIGHT_SET_BRIGHTNESS _IOW('F', 1, u_int) /* set brightness */ if (( fd = ::open ( "/dev/fb0", O_WRONLY )) >= 0 ) { res = ( ::ioctl ( fd , FB_BACKLIGHT_SET_BRIGHTNESS, bright ) == 0 ); ::close ( fd ); } } 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 return false; bool res = false; struct timeval tvs, tvn; ::gettimeofday ( &tvs, 0 ); ::sync ( ); // flush fs caches res = ( ::system ( "apm --suspend" ) == 0 ); // This is needed because the iPAQ apm implementation is asynchronous and we // can not be sure when exactly the device is really suspended // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. if ( res ) { do { // Yes, wait 15 seconds. This APM bug sucks big time. ::usleep ( 200 * 1000 ); ::gettimeofday ( &tvn, 0 ); } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 ); } QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); return res; } Transformation Zaurus::rotation ( ) const { Transformation rot; int handle = 0; int retval = 0; switch ( d-> m_model ) { 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_SLB600: case Model_Zaurus_SL5500: case Model_Zaurus_SL5000: default: rot = d-> m_rotation; break; } return rot; } -ODirection Zaurus::direction ( ) const +ODirection Zaurus::direction ( ) const { ODirection dir; int handle = 0; int retval = 0; switch ( d-> m_model ) { case Model_Zaurus_SLC7x0: handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); if (handle == -1) { - dir = Rot270; + dir = CW; } else { retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); ::close (handle); - if (retval == 2 ) + if (retval == 2 ) dir = CCW; - else + else dir = CW; } break; case Model_Zaurus_SLA300: case Model_Zaurus_SLB600: case Model_Zaurus_SL5500: case Model_Zaurus_SL5000: default: dir = d-> m_direction; break; } return dir; } int Zaurus::displayBrightnessResolution ( ) const { if (m_embedix) return 5; else return 256; } /************************************************** * * SIMpad * **************************************************/ void SIMpad::init ( ) { d-> m_vendorstr = "SIEMENS"; d-> m_vendor = Vendor_SIEMENS; QFile f ( "/proc/hal/model" ); //TODO Implement model checking //FIXME For now we assume an SL4 d-> m_modelstr = "SL4"; d-> m_model = Model_SIMpad_SL4; switch ( d-> m_model ) { default: d-> m_rotation = Rot0; d-> m_direction = CCW; d-> m_holdtime = 1000; // 1000ms break; } f. setName ( "/etc/familiar-version" ); if ( f. open ( IO_ReadOnly )) { d-> m_systemstr = "Familiar"; d-> m_system = System_Familiar; QTextStream ts ( &f ); d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); f. close ( ); } else { f. setName ( "/etc/oz_version" ); if ( f. open ( IO_ReadOnly )) { d-> m_systemstr = "OpenEmbedded/SIMpad"; d-> m_system = System_OpenZaurus; QTextStream ts ( &f ); ts.setDevice ( &f ); d-> m_sysverstr = ts. readLine ( ); f. close ( ); } } m_leds [0] = m_leds [1] = Led_Off; m_power_timer = 0; } void SIMpad::initButtons ( ) { if ( d-> m_buttons ) return; if ( isQWS( ) ) QWSServer::setKeyboardFilter ( this ); d-> m_buttons = new QValueList <ODeviceButton>; for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { s_button *sb = simpad_buttons + i; ODeviceButton b; if (( sb-> model & d-> m_model ) == d-> m_model ) { b. setKeycode ( sb-> code ); b. setUserText ( QObject::tr ( "Button", sb-> utext )); b. setPixmap ( Resource::loadPixmap ( sb-> pix )); b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction )); b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction )); d-> m_buttons-> append ( b ); } } reloadButtonMapping ( ); QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); } // SIMpad boardcontrol register CS3 #define SIMPAD_BOARDCONTROL "/proc/cs3" #define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA #define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA #define SIMPAD_EN1 0x0004 // This is only for EPROM's #define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V #define SIMPAD_DISPLAY_ON 0x0010 #define SIMPAD_PCMCIA_BUFF_DIS 0x0020 #define SIMPAD_MQ_RESET 0x0040 #define SIMPAD_PCMCIA_RESET 0x0080 #define SIMPAD_DECT_POWER_ON 0x0100 #define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave #define SIMPAD_RS232_ON 0x0400 #define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave #define SIMPAD_LED2_ON 0x1000 #define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode #define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit #define SIMPAD_RESET_SIMCARD 0x8000 |