Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Apr 2013 23:15:22 +0200
From:      Polytropon <freebsd@edvax.de>
To:        "Ronald F. Guilmette" <rfg@tristatelogic.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Recipie for CPU souffle'
Message-ID:  <20130402231522.71cb7352.freebsd@edvax.de>
In-Reply-To: <15043.1364932520@server1.tristatelogic.com>
References:  <515AAE16.9030707@qeng-ho.org> <15043.1364932520@server1.tristatelogic.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 02 Apr 2013 12:55:20 -0700, Ronald F. Guilmette wrote:
> Is there any specific advantage to using that, relative to using mbmon?

As far as I understand, it's utilizing a different infrastructure
to obtain data. You can see "man amdtemp" in comparison to the
reporting mechanisms mbmon uses.



> >..."man speaker"...
> 
> Humm... I'm looking at that now and it raises more questions that it answers.

It's just an interface to the PC speaker, what question? :-)



> First order question:  Why is it that in FreeBSD there are so many man
> pages like this one, _purporting_ to describe some low level interface
> to some sort of hardware, and the man page _doesn't_ include a clear
> and explicit description of the relevant ioctls ?

Discovering those usually involved using the driver sources.
The driver description provided in the manpage doesn't cover
everything, but it says: "definitions for the ioctl(2)
interface are in <dev/speaker/speaker.h>".



> Second order question:  Why can't I just pipe a .wav file to the
> /dev/speaker device file and have it play?  Wouldn't that make quite
> a lot of sense?

No, that does not work. Read the manpage to recognize clearly
_what_ kind of input the /dev/speaker device accepts. It does
not understand WAV files.

However, try this example (cw.sh):

#!/bin/sh

read -p "CW ===> " TEXT
echo ${TEXT} | morse | awk '{
	if(length($0) == 0)
		printf("P4\n");
	else {
		gsub(" dit", "P32L32E", $0);
		gsub(" di",  "P32L32E", $0);
		gsub(" dah", "P32L8E",  $0);
		printf("%sP16\n", $0);
	}
}' | dd bs=256 of=/dev/speaker > /dev/null 2>&1

This script doesn't require any non-OS components. You can use
it as a basis to build a program that will send you system messages
in an audible way in morse code... :-)



> >/usr/sbin/spkrtest might be useful
> 
> Humm... well... it is at least mildly entertaining.

But probably not required, because the simplest test you could
construct is something like

	% echo "c" > /dev/speaker

Can you hear a sound? Yes? Good. Speaker works. Don't hear
anything? Either your system doesn't have a speaker, or the
driver isn't loaded. :-)

Hint: Make sure permissions are set properly.

	own     speaker root:operator
	perm    speaker 0660

You can add those to /etc/devfs.conf if you're a member of
the "operator" group.



> I wonder if whoever write and distributed this realized that he/she could
> be sued for copyright infringement for about 5 of the simple tunes that are
> embedded in that thing.  Sad but true.
> :-(

Is it really that bad already? "Patent of swinging on a swing
or exercising a cat" time? ;-)





-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130402231522.71cb7352.freebsd>