summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp4
-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, 37 insertions, 0 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
@@ -402,25 +402,29 @@ int VMemo::openDSP() {
402 resolution = 16; 402 resolution = 16;
403 } else { 403 } else {
404 format = AFMT_U8; 404 format = AFMT_U8;
405 resolution = 8; 405 resolution = 8;
406 } 406 }
407 407
408 odebug << "samplerate: " << speed << ", channels " << channels << ", resolution " << resolution << "" << oendl; 408 odebug << "samplerate: " << speed << ", channels " << channels << ", resolution " << resolution << "" << oendl;
409 409
410 if(systemZaurus) { 410 if(systemZaurus) {
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 }
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
@@ -71,49 +71,57 @@ QIconSet VTApplet::icon ( ) const
71 QImage img = Resource::loadImage ( "terminal" ); 71 QImage img = Resource::loadImage ( "terminal" );
72 72
73 if ( !img. isNull ( )) 73 if ( !img. isNull ( ))
74 pix. convertFromImage ( img. smoothScale ( 14, 14 )); 74 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
75 return pix; 75 return pix;
76} 76}
77 77
78QPopupMenu *VTApplet::popup ( QWidget* parent ) const 78QPopupMenu *VTApplet::popup ( QWidget* parent ) const
79{ 79{
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
87 m_subMenu = new QPopupMenu( parent ); 91 m_subMenu = new QPopupMenu( parent );
88 m_subMenu->setCheckable( true ); 92 m_subMenu->setCheckable( true );
89 for ( int i = 1; i < 10; ++i ) 93 for ( int i = 1; i < 10; ++i )
90 { 94 {
91 int id = m_subMenu->insertItem( QString::number( i ), 500+i ); 95 int id = m_subMenu->insertItem( QString::number( i ), 500+i );
92 m_subMenu->setItemChecked( id, id-500 == vtstat.v_active ); 96 m_subMenu->setItemChecked( id, id-500 == vtstat.v_active );
93 } 97 }
94 ::close( fd ); 98 ::close( fd );
95 99
96 connect( m_subMenu, SIGNAL( activated(int) ), this, SLOT( changeVT(int) ) ); 100 connect( m_subMenu, SIGNAL( activated(int) ), this, SLOT( changeVT(int) ) );
97 connect( m_subMenu, SIGNAL( aboutToShow() ), this, SLOT( updateMenu() ) ); 101 connect( m_subMenu, SIGNAL( aboutToShow() ), this, SLOT( updateMenu() ) );
98 102
99 return m_subMenu; 103 return m_subMenu;
100} 104}
101 105
102 106
103void VTApplet::changeVT( int index ) 107void 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}
111 119
112 120
113void VTApplet::updateMenu() 121void VTApplet::updateMenu()
114{ 122{
115 //odebug << "VTApplet::updateMenu()" << oendl; 123 //odebug << "VTApplet::updateMenu()" << oendl;
116 124
117 int fd = ::open( "/dev/console", O_RDONLY ); 125 int fd = ::open( "/dev/console", O_RDONLY );
118 if ( fd == -1 ) return; 126 if ( fd == -1 ) return;
119 127
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 21070bf..9d0bbbf 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -586,25 +586,29 @@ bool ODevice::suspend ( )
586 * This sets the display on or off 586 * This sets the display on or off
587 */ 587 */
588bool ODevice::setDisplayStatus ( bool on ) 588bool ODevice::setDisplayStatus ( bool on )
589{ 589{
590 qDebug("ODevice::setDisplayStatus(%d)", on); 590 qDebug("ODevice::setDisplayStatus(%d)", on);
591 591
592 if ( d-> m_model == Model_Unknown ) 592 if ( d-> m_model == Model_Unknown )
593 return false; 593 return false;
594 594
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 }
602 return res; 606 return res;
603} 607}
604 608
605/** 609/**
606 * This sets the display brightness 610 * This sets the display brightness
607 * 611 *
608 * @param p The brightness to be set on a scale from 0 to 255 612 * @param p The brightness to be set on a scale from 0 to 255
609 * @return success or failure 613 * @return success or failure
610 */ 614 */
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
@@ -128,26 +128,31 @@ OSoundCard::OSoundCard( QObject* parent, const char* name )
128 odebug << "OSoundCard::OSoundCard()" << oendl; 128 odebug << "OSoundCard::OSoundCard()" << oendl;
129 init(); 129 init();
130} 130}
131 131
132 132
133OSoundCard::~OSoundCard() 133OSoundCard::~OSoundCard()
134{ 134{
135} 135}
136 136
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
145/*====================================================================================== 150/*======================================================================================
146 * OAudioInterface 151 * OAudioInterface
147 *======================================================================================*/ 152 *======================================================================================*/
148 153
149OAudioInterface::OAudioInterface( QObject* parent, const char* name ) 154OAudioInterface::OAudioInterface( QObject* parent, const char* name )
150 :QObject( parent, name ), _sfd(0) 155 :QObject( parent, name ), _sfd(0)
151{ 156{
152 odebug << "OAudioInterface::OAudioInterface()" << oendl; 157 odebug << "OAudioInterface::OAudioInterface()" << oendl;
153 init(); 158 init();
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index c6d9cfd..ca90427 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -556,96 +556,112 @@ static int muted = 0;
556static int micMuted = 0; 556static int micMuted = 0;
557 557
558static void setVolume( int t = 0, int percent = -1 ) 558static void setVolume( int t = 0, int percent = -1 )
559{ 559{
560 switch ( t ) { 560 switch ( t ) {
561 case 0: { 561 case 0: {
562 Config cfg( "qpe" ); 562 Config cfg( "qpe" );
563 cfg.setGroup( "Volume" ); 563 cfg.setGroup( "Volume" );
564 if ( percent < 0 ) 564 if ( percent < 0 )
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;
572 ioctl( fd, MIXER_WRITE( SOUND_MIXER_VOLUME ), &vol ); 576 ioctl( fd, MIXER_WRITE( SOUND_MIXER_VOLUME ), &vol );
573 ::close( fd ); 577 ::close( fd );
574 } 578 }
575#endif 579#endif
576 } 580 }
577 break; 581 break;
578 } 582 }
579} 583}
580 584
581static void setMic( int t = 0, int percent = -1 ) 585static void setMic( int t = 0, int percent = -1 )
582{ 586{
583 switch ( t ) { 587 switch ( t ) {
584 case 0: { 588 case 0: {
585 Config cfg( "qpe" ); 589 Config cfg( "qpe" );
586 cfg.setGroup( "Volume" ); 590 cfg.setGroup( "Volume" );
587 if ( percent < 0 ) 591 if ( percent < 0 )
588 percent = cfg.readNumEntry( "Mic", 50 ); 592 percent = cfg.readNumEntry( "Mic", 50 );
589 593
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 }
597#endif 605#endif
598 } 606 }
599 break; 607 break;
600 } 608 }
601} 609}
602 610
603 611
604static void setBass( int t = 0, int percent = -1 ) 612static void setBass( int t = 0, int percent = -1 )
605{ 613{
606 switch ( t ) { 614 switch ( t ) {
607 case 0: { 615 case 0: {
608 Config cfg( "qpe" ); 616 Config cfg( "qpe" );
609 cfg.setGroup( "Volume" ); 617 cfg.setGroup( "Volume" );
610 if ( percent < 0 ) 618 if ( percent < 0 )
611 percent = cfg.readNumEntry( "BassPercent", 50 ); 619 percent = cfg.readNumEntry( "BassPercent", 50 );
612 620
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 }
620#endif 632#endif
621 } 633 }
622 break; 634 break;
623 } 635 }
624} 636}
625 637
626 638
627static void setTreble( int t = 0, int percent = -1 ) 639static void setTreble( int t = 0, int percent = -1 )
628{ 640{
629 switch ( t ) { 641 switch ( t ) {
630 case 0: { 642 case 0: {
631 Config cfg( "qpe" ); 643 Config cfg( "qpe" );
632 cfg.setGroup( "Volume" ); 644 cfg.setGroup( "Volume" );
633 if ( percent < 0 ) 645 if ( percent < 0 )
634 percent = cfg.readNumEntry( "TreblePercent", 50 ); 646 percent = cfg.readNumEntry( "TreblePercent", 50 );
635 647
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 }
643#endif 659#endif
644 } 660 }
645 break; 661 break;
646 } 662 }
647} 663}
648 664
649 665
650/** 666/**
651 \class QPEApplication 667 \class QPEApplication