[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: sound server fatal error in 2.2release
From:       Stefan Westerfeld <stefan () space ! twc ! de>
Date:       2001-08-01 18:32:28
[Download RAW message or body]

Hi!

On Wed, Aug 01, 2001 at 03:48:37PM +0200, F@lk Brettschneider wrote:
> "F@lk Brettschneider" wrote:
> > Stefan Westerfeld wrote:
> > > On Tue, Jul 31, 2001 at 07:17:11AM -0700, Falk Brettschneider wrote:
> > > > I haven't got a sound card on one of my machines.
> > > > After a total CVS rebuild + reinstallation + deletion
> > > > of all temp. files I got this message on KDE login:
> > > >
> > > > "Sound Server fatal error"
> > > > "Error while initializing sound driver. /dev/dsp can't
> > > > be opened (no such device)"
> > > >
> > > > Maybe a showstopper.
> > >
> > > Well, I consider it pretty harmless. If you have no soundcard, then the
> > > default settings, which are
> > >
> > >  - start artsd on KDE startup
> > >  - show artsd errors with message boxes
> > >
> > > are simply wrong for you, and I think the user can be expected to use
> > > kcontrol to turn off artsd (which is not very useful without soundcard
> > > anyway).
> > >
> > > That it didn't occur with previous versions of KDE is due to the fact that
> > > we had no end-user-visible error reporting at all, but I think it is good
> > > that this changed. The error message you mention should be able to help
> > > somebody who has a soundcard and who wants system notifications to get an
> > > idea why it doesn't work (artsd can't know whether you have misconfigured
> > > your kernel, or whether you really have no soundcard).
> > >
> > > So, if anything, I could imagine that to make this easier to the user, I
> > > could imagine that the dialog which displays the error message could also
> > > offer to go to the artsd configuration in further releases of KDE. That way,
> > > if you don't have a soundcard turning off artsd would only be three clicks
> > > away.
> > >
> > > But as this requires translations, it's a post-2.2-issue.
> > No it's very annoying to get error messages about sound stuff when I
> > have not got such a card at all. Please fix it for the 2.2 release.
> > Or do you want to get driver error messages about missing TV cards,
> > VideoCards at KDE login although you haven't got them? :)
> Or at least provide a "Never ask me again" checkbox in the messagebox! A
> common user don't want to search the whole KControl for the proper sound
> server switch off which isn't very user-friendly.

I know it is not very user friendly. One could easily modify it to never show
any error messages if the sound server start fails, which would be even less
user friendly.

And whatever you think about "this gotta be soo easy to fix", believe me,
I've not found a way to fix it easily and nicely - error reporting in artsd is
centralized, and if you put a "Never ask me this again" in one message box,
it will disable all messages forever if checked. And there is no sane way
to know what the error message actually says in the place where it is thrown
with arts_fatal, so we can't only filter out this one error message.

If you have an easy and clean patch though, I would be looking forward to it.
I have attached the best I have been able to come up with, and to be honest, I
dislike it that much that I don't want to apply it. Better take the time to
fix it cleanly after 2.2 than to do some last minute hack now and be sorry
about it later.

   Cu... Stefan
-- 
  -* Stefan Westerfeld, stefan@space.twc.de (PGP!), Hamburg/Germany
     KDE Developer, project infos at http://space.twc.de/~stefan/kde *-         

["20010801-ugly-nodev-warning-patch.diff" (text/plain)]

? doc/TODO.X
Index: flow/audioio.h
===================================================================
RCS file: /home/kde/kdelibs/arts/flow/audioio.h,v
retrieving revision 1.4
diff -u -r1.4 audioio.h
--- flow/audioio.h	2001/03/02 22:51:13	1.4
+++ flow/audioio.h	2001/08/01 16:56:25
@@ -68,6 +68,7 @@
 							 * available AudioIO classes for the autoDetect
 							 * value and chooses the one which returned the
 							 * highest number */
+		lastErrorCode = 102,/* the last error message as error code */
 
 /* string parameters that have to be supported */
 		lastError = 201,	/* the last error message as human readable text */
@@ -84,6 +85,11 @@
 		directionRead = 1,
 		directionWrite = 2,
 		directionReadWrite = 3
+	};
+
+	enum ErrorCode {
+		errorCodeUnknown = 0,		/* no idea what happened */
+		errorCodeNoDevice = 1		/* no device */
 	};
 
 	AudioIO();
Index: flow/audioiooss.cc
===================================================================
RCS file: /home/kde/kdelibs/arts/flow/audioiooss.cc,v
retrieving revision 1.11
diff -u -r1.11 audioiooss.cc
--- flow/audioiooss.cc	2001/07/27 10:49:54	1.11
+++ flow/audioiooss.cc	2001/08/01 16:56:26
@@ -128,6 +128,7 @@
 	int& _fragmentCount = param(fragmentCount);
 	int& _samplingRate = param(samplingRate);
 	int& _format = param(format);
+	int& _errorCode = param(lastErrorCode);
 
 	int mode;
 
@@ -142,6 +143,9 @@
 	}
 
 	audio_fd = ::open(_deviceName.c_str(), mode, 0);
+
+	if(audio_fd == -1 && errno == ENODEV)
+		_errorCode = errorCodeNoDevice;
 
 	if(audio_fd == -1)
 	{
Index: flow/audiosubsys.cc
===================================================================
RCS file: /home/kde/kdelibs/arts/flow/audiosubsys.cc,v
retrieving revision 1.38
diff -u -r1.38 audiosubsys.cc
--- flow/audiosubsys.cc	2001/03/04 11:02:09	1.38
+++ flow/audiosubsys.cc	2001/08/01 16:56:27
@@ -212,6 +212,14 @@
 	return d->audioIO->getParamStr(AudioIO::deviceName);
 }
 
+int AudioSubSystem::errorCode()
+{
+	initAudioIO();
+	if(!d->audioIO) return AudioIO::errorCodeUnknown;
+
+	return d->audioIO->getParam(AudioIO::lastErrorCode);
+}
+
 void AudioSubSystem::fragmentCount(int fragmentCount)
 {
 	initAudioIO();
Index: flow/audiosubsys.h
===================================================================
RCS file: /home/kde/kdelibs/arts/flow/audiosubsys.h,v
retrieving revision 1.19
diff -u -r1.19 audiosubsys.h
--- flow/audiosubsys.h	2001/03/04 11:02:09	1.19
+++ flow/audiosubsys.h	2001/08/01 16:56:28
@@ -160,6 +160,7 @@
 
 	int open();								/* obsolete: see bool open(); */
 	const char *error();
+	int errorCode();
 
 	/*
 	 * returncode of open: -1 indicates an error; otherwise, the returned
Index: soundserver/artsd.cc
===================================================================
RCS file: /home/kde/kdelibs/arts/soundserver/artsd.cc,v
retrieving revision 1.36
diff -u -r1.36 artsd.cc
--- soundserver/artsd.cc	2001/03/26 16:01:30	1.36
+++ soundserver/artsd.cc	2001/08/01 16:56:31
@@ -255,6 +255,16 @@
 	{
 		string msg = "Error while initializing the sound driver:\n";
 		msg += AudioSubSystem::the()->error();
+
+		/* KDE2.2 HACK: we need this to be a warning only, to ignore this
+		 * message in the default setup */
+		if(AudioSubSystem::the()->errorCode() == AudioIO::errorCodeNoDevice)
+		{
+			msg += "\n\n(this could be caused by the fact that you have no sound card)";
+			arts_warning(msg.c_str());
+			exit(0);
+		}
+
 		arts_fatal(msg.c_str());
 		exit(1);
 	}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic