author | sandman <sandman> | 2002-10-19 01:12:25 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-19 01:12:25 (UTC) |
commit | a0ea0e7ff2fad769a92136edc1a7381692e7739f (patch) (side-by-side diff) | |
tree | 8c186385c133ca4ad06de66b93a91131a52cc06e | |
parent | e869be9990c0db11288bd196778cadd0ad6976a9 (diff) | |
download | opie-a0ea0e7ff2fad769a92136edc1a7381692e7739f.zip opie-a0ea0e7ff2fad769a92136edc1a7381692e7739f.tar.gz opie-a0ea0e7ff2fad769a92136edc1a7381692e7739f.tar.bz2 |
don't probe for old device names on iPAQs anymore
-rw-r--r-- | libopie/odevice.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 80e9a91..58bd663 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp @@ -487,265 +487,262 @@ bool iPAQ::setLedState ( OLed l, OLedState st ) case Led_Off : leds. OffOnBlink = 0; break; case Led_On : leds. OffOnBlink = 1; break; case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; } if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { m_leds [0] = st; return true; } } } return false; } //QValueList <int> iPAQ::keyList ( ) const //{ // QValueList <int> vl; // vl << HardKey_Datebook << HardKey_Contacts << ( model ( ) == Model_iPAQ_H38xx ? HardKey_Mail : HardKey_Menu ) << HardKey_Home << HardKey_Record << HardKey_Suspend << HardKey_Backlight; // return vl; //} bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) { int newkeycode = keycode; // simple susbstitutions switch ( d-> m_model ) { case Model_iPAQ_H38xx: // H38xx has no "Q" key anymore - this is now the Mail key if ( keycode == HardKey_Menu ) newkeycode = HardKey_Mail; //nobreak case Model_iPAQ_H31xx: // Rotate cursor keys 180° switch ( keycode ) { case Key_Left : newkeycode = Key_Right; break; case Key_Right: newkeycode = Key_Left; break; case Key_Up : newkeycode = Key_Down; break; case Key_Down : newkeycode = Key_Up; break; } //nobreak; case Model_iPAQ_H36xx: case Model_iPAQ_H37xx: // map Power Button short/long press to F34/F35 if ( keycode == Key_SysReq ) { if ( isPress ) { if ( m_power_timer ) killTimer ( m_power_timer ); m_power_timer = startTimer ( 500 ); } else if ( m_power_timer ) { killTimer ( m_power_timer ); m_power_timer = 0; QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); } newkeycode = Key_unknown; } //nobreak; default: break; } if ( newkeycode != keycode ) { if ( newkeycode != Key_unknown ) QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); return true; } else return false; } void iPAQ::timerEvent ( QTimerEvent * ) { killTimer ( m_power_timer ); m_power_timer = 0; QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); } void iPAQ::alarmSound ( ) { #if defined( QT_QWS_IPAQ ) // IPAQ #ifndef QT_NO_SOUND static Sound snd ( "alarm" ); int fd; int vol; bool vol_reset = false; - if ((( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) || - (( fd = ::open ( "/dev/mixer", O_RDWR )) >= 0 )) { - + if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { Config cfg ( "qpe" ); cfg. setGroup ( "Volume" ); int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); if ( volalarm < 0 ) volalarm = 0; else if ( volalarm > 100 ) volalarm = 100; volalarm |= ( volalarm << 8 ); if (( volalarm & 0xff ) > ( vol & 0xff )) { if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) vol_reset = true; } } } snd. play ( ); while ( !snd. isFinished ( )) qApp-> processEvents ( ); if ( fd >= 0 ) { if ( vol_reset ) ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); ::close ( fd ); } #endif #endif } bool iPAQ::setSoftSuspend ( bool soft ) { bool res = false; int fd; if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) res = true; else ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); ::close ( fd ); } else ::perror ( "/proc/sys/ts/suspend_button_mode" ); return res; } bool iPAQ::setDisplayBrightness ( int bright ) { bool res = false; int fd; if ( bright > 255 ) bright = 255; if ( bright < 0 ) bright = 0; // 128 is the maximum if you want a decent lifetime for the LCD if ( bright > 1 ) bright = (int) ( 0.5 + ( ::pow ( 2, double( bright ) / 255.0 ) - 1 ) * 128.0 ); // logarithmic // bright = ( bright + 1 ) / 2; - if ((( fd = ::open ( "/dev/ts", O_WRONLY )) >= 0 ) || - (( fd = ::open ( "/dev/h3600_ts", O_WRONLY )) >= 0 )) { + if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { FLITE_IN bl; bl. mode = 1; bl. pwr = bright ? 1 : 0; bl. brightness = bright; res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); ::close ( fd ); } return res; } int iPAQ::displayBrightnessResolution ( ) const { return 255; // really 128, but logarithmic control is smoother this way } /************************************************** * * Zaurus * **************************************************/ void Zaurus::init ( ) { d-> m_modelstr = "Zaurus SL5000"; d-> m_model = Model_Zaurus_SL5000; d-> m_vendorstr = "Sharp"; d-> m_vendor = Vendor_Sharp; QFile f ( "/proc/filesystems" ); if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { d-> m_systemstr = "OpenZaurus"; d-> m_system = System_OpenZaurus; f. close ( ); f. setName ( "/etc/oz_version" ); if ( f. open ( IO_ReadOnly )) { QTextStream ts ( &f ); d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); f. close ( ); } } else { d-> m_systemstr = "Zaurus"; d-> m_system = System_Zaurus; } m_leds [0] = Led_Off; } #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) #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ #define SHARP_BUZ_KEYSOUND 2 /* key sound */ #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ /* --- for SHARP_BUZZER device --- */ //#define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ //#define SHARP_PDA_APPSTART 9 /* application start */ //#define SHARP_PDA_APPQUIT 10 /* application ends */ //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ |