Date: Wed, 6 Sep 2000 09:18:16 +0200 (CEST) From: Andre Albsmeier <andre.albsmeier@mchp.siemens.de> To: FreeBSD-gnats-submit@freebsd.org Subject: kern/21073: PCM sound driver silently accepts improper parameters of SNDCTL_DSP_SETFMT Message-ID: <200009060718.e867IGj45601@curry.mchp.siemens.de>
next in thread | raw e-mail | index | archive | help
>Number: 21073
>Category: kern
>Synopsis: PCM sound driver silently accepts improper parameters of SNDCTL_DSP_SETFMT
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Sep 06 00:20:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Andre Albsmeier
>Release: FreeBSD 4.1-STABLE i386
>Organization:
>Environment:
4.1-STABLE machine using the pcm driver on an AB AWE64:
andre@bali:~>cat /dev/sndstat
FreeBSD Audio Driver (newpcm) Sep 2 2000 10:33:49
Installed devices:
pcm0: <SB DSP 4.16> at io 0x220 irq 5 drq 1:5 (1p/1r channels duplex)
>Description:
When setting a sound format with SNDCTL_DSP_SETFMT, the system call does not
tell us if an improper format was set.
>How-To-Repeat:
The following program demonstrates the error:
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <machine/soundcard.h>
#include <sys/time.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
int main( ) {
int bits;
int fd;
if( (fd = open("/dev/dsp", O_RDONLY)) < 0 ) {
fprintf( stderr, "Can't open /dev/dsp for read\n" );
exit( 1 );
}
if( ioctl(fd, SNDCTL_DSP_GETFMTS, &bits) < 0 ) {
fprintf( stderr, "SNDCTL_DSP_GETFMTS error\n" );
exit( 1 );
}
printf( "GETFMTS: 0x%X\n", bits );
bits = 0x10;
if( ioctl(fd, SNDCTL_DSP_SETFMT, &bits) < 0 ) {
fprintf( stderr, "SNDCTL_DSP_SETFMT error\n" );
exit( 1 );
}
printf( "After setting 0x10 with SETFMT: 0x%X\n", bits );
return( 0 );
}
andre@bali:~>./sndcheck
GETFMTS: 0x10000008
After setting 0x10 with SETFMT: 0x10
So the AWE64 only supports AFMT_U8 in STEREO. Now we set AFMT_S16_LE
but there is no error returned neither was the bits variable modified
as it was the case in voxware.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009060718.e867IGj45601>
