Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Feb 2000 14:55:18 +0000
From:      Mark Ovens <mark@ukug.uk.freebsd.org>
To:        stable@freebsd.org
Subject:   Help needed with ioctl() calls
Message-ID:  <20000219145518.C328@marder-1>

next in thread | raw e-mail | index | archive | help
# uname -a
FreeBSD marder-1 3.4-STABLE FreeBSD 3.4-STABLE #0:
Fri Feb 18 18:14:43 GMT 2000
root@marder-1:/usr/src/sys/compile/MARDER-1  i386


I'm trying to debug a problem in the xmms port whereby the volume
doesn't get set correctly.

It goes wrong after the ioctl() call to set the volume in /dev/mixer.

From /usr/include/machine/soundcard.h:

#define SOUND_MIXER_PCM         4
#define MIXER_WRITE(dev)                _IOWR('M', dev, int)
#define SOUND_MIXER_WRITE_PCM           MIXER_WRITE(SOUND_MIXER_PCM)  

and the code in question is

	int fd, v, l, r;

	fd = open(devname, O_RDONLY);

	l = 90; r = 90;

	v = (r << 8) | l;   /* v == 23130 */

	ioctl(fd, SOUND_MIXER_WRITE_PCM, &v);

	/* now v == 23387, which is (91 << 8) | 91 */

Before the ioctl() call the output from mixer(8) was:

	Mixer pcm      is currently set to  88:88

and after:
	
	Mixer pcm      is currently set to  91:91

when it should be 90:90

The appears to be a bug in ioctl(), but is it?

/dev/mixer is being opened read-only but we appear to be writing to it
OK, albeit the wrong values.

I'm getting a bit out of my depth here so a bit of help would be
appreciated. Is this a bug in ioctl()? If not, any suggestions as to
what I should do now to find the cause of the problem?

Thanks.

-- 
	Microsoft: Where do you want to go today?
	Linux:     Where do you want to go tomorrow?
	BSD:       Are you guys coming, or what?
			              -Poster at LinuxWorld 2000
________________________________________________________________
      FreeBSD - The Power To Serve http://www.freebsd.org
      My Webpage http://ukug.uk.freebsd.org/~mark/
mailto:mark@ukug.uk.freebsd.org             http://www.radan.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




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