author | schurig <schurig> | 2004-09-10 12:18:17 (UTC) |
---|---|---|
committer | schurig <schurig> | 2004-09-10 12:18:17 (UTC) |
commit | 9d0ccc1c5ca687bc017b2b515a9d3a47e98ce521 (patch) (side-by-side diff) | |
tree | 53927c6a19c69d54bb3d0e092ac57180bcb60222 | |
parent | ed70ec4945c7816ec6e899207ec8b99e20e10da5 (diff) | |
download | opie-9d0ccc1c5ca687bc017b2b515a9d3a47e98ce521.zip opie-9d0ccc1c5ca687bc017b2b515a9d3a47e98ce521.tar.gz opie-9d0ccc1c5ca687bc017b2b515a9d3a47e98ce521.tar.bz2 |
added support for DEVFS
-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 10 | ||||
-rw-r--r-- | core/applets/vtapplet/vt.cpp | 8 | ||||
-rw-r--r-- | libopie/odevice.cpp | 4 | ||||
-rw-r--r-- | libopie2/opiemm/osoundsystem.cpp | 5 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 16 |
5 files changed, 40 insertions, 3 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index e747a19..07ef15c 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp @@ -406,28 +406,32 @@ int VMemo::openDSP() { } odebug << "samplerate: " << speed << ", channels " << channels << ", resolution " << resolution << "" << oendl; if(systemZaurus) { dsp = open("/dev/dsp1", O_RDONLY); //Zaurus needs /dev/dsp1 channels=1; //zaurus has one input channel } else { +#ifdef QT_QWS_DEVFS + dsp = open("/dev/sound/dsp", O_RDONLY); +#else dsp = open("/dev/dsp", O_RDONLY); +#endif } - if(dsp == -1) { + if (dsp == -1) { msgLabel->close(); msgLabel=0; delete msgLabel; perror("open(\"/dev/dsp\")"); errorMsg="open(\"/dev/dsp\")\n "+(QString)strerror(errno); - QMessageBox::critical(0, "vmemo", errorMsg, "Abort"); - return -1; + QMessageBox::critical(0, "vmemo", errorMsg, "Abort"); + return -1; } if(ioctl(dsp, SNDCTL_DSP_SETFMT , &format)==-1) { perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); return -1; } if(ioctl(dsp, SNDCTL_DSP_CHANNELS , &channels)==-1) { perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); diff --git a/core/applets/vtapplet/vt.cpp b/core/applets/vtapplet/vt.cpp index aec63c3..7832ee0 100644 --- a/core/applets/vtapplet/vt.cpp +++ b/core/applets/vtapplet/vt.cpp @@ -75,17 +75,21 @@ QIconSet VTApplet::icon ( ) const return pix; } QPopupMenu *VTApplet::popup ( QWidget* parent ) const { odebug << "VTApplet::popup" << oendl; struct vt_stat vtstat; +#ifdef QT_QWS_DEVFS + int fd = ::open( "/dev/vc/0", O_RDWR ); +#else int fd = ::open( "/dev/tty0", O_RDWR ); +#endif if ( fd == -1 ) return 0; if ( ioctl( fd, VT_GETSTATE, &vtstat ) == -1 ) return 0; m_subMenu = new QPopupMenu( parent ); m_subMenu->setCheckable( true ); for ( int i = 1; i < 10; ++i ) { int id = m_subMenu->insertItem( QString::number( i ), 500+i ); @@ -99,17 +103,21 @@ QPopupMenu *VTApplet::popup ( QWidget* parent ) const return m_subMenu; } void VTApplet::changeVT( int index ) { //odebug << "VTApplet::changeVT( " << index-500 << " )" << oendl; +#ifdef QT_QWS_DEVFS + int fd = ::open("/dev/vc/0", O_RDWR); +#else int fd = ::open("/dev/tty0", O_RDWR); +#endif if ( fd == -1 ) return; ioctl( fd, VT_ACTIVATE, index-500 ); } void VTApplet::updateMenu() { //odebug << "VTApplet::updateMenu()" << oendl; diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 21070bf..9d0bbbf 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp @@ -590,17 +590,21 @@ bool ODevice::setDisplayStatus ( bool on ) qDebug("ODevice::setDisplayStatus(%d)", on); if ( d-> m_model == Model_Unknown ) return false; bool res = false; int fd; +#ifdef QT_QWS_DEVFS + if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) { +#else if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { +#endif res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); ::close ( fd ); } return res; } /** * This sets the display brightness diff --git a/libopie2/opiemm/osoundsystem.cpp b/libopie2/opiemm/osoundsystem.cpp index 763ff65..17e5cb0 100644 --- a/libopie2/opiemm/osoundsystem.cpp +++ b/libopie2/opiemm/osoundsystem.cpp @@ -132,18 +132,23 @@ OSoundCard::OSoundCard( QObject* parent, const char* name ) OSoundCard::~OSoundCard() { } void OSoundCard::init() { +#ifdef QT_QWS_DEVFS + _audio = new OAudioInterface( this, "/dev/sound/dsp" ); + _mixer = new OMixerInterface( this, "/dev/sound/mixer" ); +#else _audio = new OAudioInterface( this, "/dev/dsp" ); _mixer = new OMixerInterface( this, "/dev/mixer" ); +#endif } /*====================================================================================== * OAudioInterface *======================================================================================*/ OAudioInterface::OAudioInterface( QObject* parent, const char* name ) diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index c6d9cfd..ca90427 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -560,17 +560,21 @@ static void setVolume( int t = 0, int percent = -1 ) switch ( t ) { case 0: { Config cfg( "qpe" ); cfg.setGroup( "Volume" ); if ( percent < 0 ) percent = cfg.readNumEntry( "VolumePercent", 50 ); #ifndef QT_NO_SOUND int fd = 0; +#ifdef QT_QWS_DEVFS + if ( ( fd = open( "/dev/sound/mixer", O_RDWR ) ) >= 0 ) { +#else if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { +#endif int vol = muted ? 0 : percent; // set both channels to same volume vol |= vol << 8; ioctl( fd, MIXER_WRITE( SOUND_MIXER_VOLUME ), &vol ); ::close( fd ); } #endif } @@ -585,17 +589,21 @@ static void setMic( int t = 0, int percent = -1 ) Config cfg( "qpe" ); cfg.setGroup( "Volume" ); if ( percent < 0 ) percent = cfg.readNumEntry( "Mic", 50 ); #ifndef QT_NO_SOUND int fd = 0; int mic = micMuted ? 0 : percent; +#ifdef QT_QWS_DEVFS + if ( ( fd = open( "/dev/sound/mixer", O_RDWR ) ) >= 0 ) { +#else if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { +#endif ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); ::close( fd ); } #endif } break; } } @@ -608,17 +616,21 @@ static void setBass( int t = 0, int percent = -1 ) Config cfg( "qpe" ); cfg.setGroup( "Volume" ); if ( percent < 0 ) percent = cfg.readNumEntry( "BassPercent", 50 ); #ifndef QT_NO_SOUND int fd = 0; int bass = percent; +#ifdef QT_QWS_DEVFS + if ( ( fd = open( "/dev/sound/mixer", O_RDWR ) ) >= 0 ) { +#else if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { +#endif ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); ::close( fd ); } #endif } break; } } @@ -631,17 +643,21 @@ static void setTreble( int t = 0, int percent = -1 ) Config cfg( "qpe" ); cfg.setGroup( "Volume" ); if ( percent < 0 ) percent = cfg.readNumEntry( "TreblePercent", 50 ); #ifndef QT_NO_SOUND int fd = 0; int treble = percent; +#ifdef QT_QWS_DEVFS + if ( ( fd = open( "/dev/sound/mixer", O_RDWR ) ) >= 0 ) { +#else if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { +#endif ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); ::close( fd ); } #endif } break; } } |