summaryrefslogtreecommitdiff
authorschurig <schurig>2004-09-10 12:18:17 (UTC)
committer schurig <schurig>2004-09-10 12:18:17 (UTC)
commit9d0ccc1c5ca687bc017b2b515a9d3a47e98ce521 (patch) (unidiff)
tree53927c6a19c69d54bb3d0e092ac57180bcb60222
parented70ec4945c7816ec6e899207ec8b99e20e10da5 (diff)
downloadopie-9d0ccc1c5ca687bc017b2b515a9d3a47e98ce521.zip
opie-9d0ccc1c5ca687bc017b2b515a9d3a47e98ce521.tar.gz
opie-9d0ccc1c5ca687bc017b2b515a9d3a47e98ce521.tar.bz2
added support for DEVFS
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp10
-rw-r--r--core/applets/vtapplet/vt.cpp8
-rw-r--r--libopie/odevice.cpp4
-rw-r--r--libopie2/opiemm/osoundsystem.cpp5
-rw-r--r--library/qpeapplication.cpp16
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
@@ -411,18 +411,22 @@ int VMemo::openDSP() {
411 dsp = open("/dev/dsp1", O_RDONLY); //Zaurus needs /dev/dsp1 411 dsp = open("/dev/dsp1", O_RDONLY); //Zaurus needs /dev/dsp1
412 channels=1; //zaurus has one input channel 412 channels=1; //zaurus has one input channel
413 } else { 413 } else {
414#ifdef QT_QWS_DEVFS
415 dsp = open("/dev/sound/dsp", O_RDONLY);
416#else
414 dsp = open("/dev/dsp", O_RDONLY); 417 dsp = open("/dev/dsp", O_RDONLY);
418#endif
415 } 419 }
416 420
417 if(dsp == -1) { 421 if (dsp == -1) {
418 msgLabel->close(); 422 msgLabel->close();
419 msgLabel=0; 423 msgLabel=0;
420 delete msgLabel; 424 delete msgLabel;
421 425
422 perror("open(\"/dev/dsp\")"); 426 perror("open(\"/dev/dsp\")");
423 errorMsg="open(\"/dev/dsp\")\n "+(QString)strerror(errno); 427 errorMsg="open(\"/dev/dsp\")\n "+(QString)strerror(errno);
424 QMessageBox::critical(0, "vmemo", errorMsg, "Abort"); 428 QMessageBox::critical(0, "vmemo", errorMsg, "Abort");
425 return -1; 429 return -1;
426 } 430 }
427 431
428 if(ioctl(dsp, SNDCTL_DSP_SETFMT , &format)==-1) { 432 if(ioctl(dsp, SNDCTL_DSP_SETFMT , &format)==-1) {
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
@@ -80,7 +80,11 @@ QPopupMenu *VTApplet::popup ( QWidget* parent ) const
80 odebug << "VTApplet::popup" << oendl; 80 odebug << "VTApplet::popup" << oendl;
81 81
82 struct vt_stat vtstat; 82 struct vt_stat vtstat;
83#ifdef QT_QWS_DEVFS
84 int fd = ::open( "/dev/vc/0", O_RDWR );
85#else
83 int fd = ::open( "/dev/tty0", O_RDWR ); 86 int fd = ::open( "/dev/tty0", O_RDWR );
87#endif
84 if ( fd == -1 ) return 0; 88 if ( fd == -1 ) return 0;
85 if ( ioctl( fd, VT_GETSTATE, &vtstat ) == -1 ) return 0; 89 if ( ioctl( fd, VT_GETSTATE, &vtstat ) == -1 ) return 0;
86 90
@@ -104,7 +108,11 @@ void VTApplet::changeVT( int index )
104{ 108{
105 //odebug << "VTApplet::changeVT( " << index-500 << " )" << oendl; 109 //odebug << "VTApplet::changeVT( " << index-500 << " )" << oendl;
106 110
111#ifdef QT_QWS_DEVFS
112 int fd = ::open("/dev/vc/0", O_RDWR);
113#else
107 int fd = ::open("/dev/tty0", O_RDWR); 114 int fd = ::open("/dev/tty0", O_RDWR);
115#endif
108 if ( fd == -1 ) return; 116 if ( fd == -1 ) return;
109 ioctl( fd, VT_ACTIVATE, index-500 ); 117 ioctl( fd, VT_ACTIVATE, index-500 );
110} 118}
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 21070bf..9d0bbbf 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -595,7 +595,11 @@ bool ODevice::setDisplayStatus ( bool on )
595 bool res = false; 595 bool res = false;
596 int fd; 596 int fd;
597 597
598#ifdef QT_QWS_DEVFS
599 if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) {
600#else
598 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { 601 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) {
602#endif
599 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); 603 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 );
600 ::close ( fd ); 604 ::close ( fd );
601 } 605 }
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
@@ -137,8 +137,13 @@ OSoundCard::~OSoundCard()
137 137
138void OSoundCard::init() 138void OSoundCard::init()
139{ 139{
140#ifdef QT_QWS_DEVFS
141 _audio = new OAudioInterface( this, "/dev/sound/dsp" );
142 _mixer = new OMixerInterface( this, "/dev/sound/mixer" );
143#else
140 _audio = new OAudioInterface( this, "/dev/dsp" ); 144 _audio = new OAudioInterface( this, "/dev/dsp" );
141 _mixer = new OMixerInterface( this, "/dev/mixer" ); 145 _mixer = new OMixerInterface( this, "/dev/mixer" );
146#endif
142} 147}
143 148
144 149
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index c6d9cfd..ca90427 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -565,7 +565,11 @@ static void setVolume( int t = 0, int percent = -1 )
565 percent = cfg.readNumEntry( "VolumePercent", 50 ); 565 percent = cfg.readNumEntry( "VolumePercent", 50 );
566#ifndef QT_NO_SOUND 566#ifndef QT_NO_SOUND
567 int fd = 0; 567 int fd = 0;
568#ifdef QT_QWS_DEVFS
569 if ( ( fd = open( "/dev/sound/mixer", O_RDWR ) ) >= 0 ) {
570#else
568 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 571 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
572#endif
569 int vol = muted ? 0 : percent; 573 int vol = muted ? 0 : percent;
570 // set both channels to same volume 574 // set both channels to same volume
571 vol |= vol << 8; 575 vol |= vol << 8;
@@ -590,7 +594,11 @@ static void setMic( int t = 0, int percent = -1 )
590#ifndef QT_NO_SOUND 594#ifndef QT_NO_SOUND
591 int fd = 0; 595 int fd = 0;
592 int mic = micMuted ? 0 : percent; 596 int mic = micMuted ? 0 : percent;
597#ifdef QT_QWS_DEVFS
598 if ( ( fd = open( "/dev/sound/mixer", O_RDWR ) ) >= 0 ) {
599#else
593 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 600 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
601#endif
594 ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); 602 ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic );
595 ::close( fd ); 603 ::close( fd );
596 } 604 }
@@ -613,7 +621,11 @@ static void setBass( int t = 0, int percent = -1 )
613#ifndef QT_NO_SOUND 621#ifndef QT_NO_SOUND
614 int fd = 0; 622 int fd = 0;
615 int bass = percent; 623 int bass = percent;
624#ifdef QT_QWS_DEVFS
625 if ( ( fd = open( "/dev/sound/mixer", O_RDWR ) ) >= 0 ) {
626#else
616 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 627 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
628#endif
617 ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); 629 ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass );
618 ::close( fd ); 630 ::close( fd );
619 } 631 }
@@ -636,7 +648,11 @@ static void setTreble( int t = 0, int percent = -1 )
636#ifndef QT_NO_SOUND 648#ifndef QT_NO_SOUND
637 int fd = 0; 649 int fd = 0;
638 int treble = percent; 650 int treble = percent;
651#ifdef QT_QWS_DEVFS
652 if ( ( fd = open( "/dev/sound/mixer", O_RDWR ) ) >= 0 ) {
653#else
639 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 654 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
655#endif
640 ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); 656 ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble );
641 ::close( fd ); 657 ::close( fd );
642 } 658 }