Subject: kern/19793: implement SNDCTL_DSP_SETDUPLEX ioctl in libossaudio and linux emulation
To: None <gnats-bugs@gnats.netbsd.org>
From: None <andreas@planix.com>
List: netbsd-bugs
Date: 01/11/2003 13:53:47
>Number:         19793
>Category:       kern
>Synopsis:       the SNDCTL_DSP_SETDUPLEX is not implemented.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 11 10:54:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Andreas Wrede <andreas@planix.com>
>Release:        NetBSD 1.6L
>Organization:
Planix, Inc.
>Environment:
	
	
System: NetBSD woffi.planix.com 1.6L NetBSD 1.6L (PLANIX) #3: Sat Jan 11 12:44:03 EST 2003 root@woffi.planix.com:/m5/netbsd-current/src/sys/arch/i386/compile/WOFFI i386
Architecture: i386
Machine: i386
>Description:
	libossaudio does not implement SNDCTL_DSP_SETDUPLEX. The ioctl is also
missing from the Linux emulation.
>How-To-Repeat:
	run a linux ohphone binary (from www.openh323.org). Wonder why sound
output does not work. Investigate.
>Fix:
Apply the follwing two patches, one for lib/libossaudio, the other for 
sys/compat/ossaudio


Index: sys/compat/ossaudio/ossaudio.c
===================================================================
RCS file: /cvsroot/src/sys/compat/ossaudio/ossaudio.c,v
retrieving revision 1.39
diff -c -r1.39 ossaudio.c
*** src/sys/compat/ossaudio/ossaudio.c	2001/12/24 00:10:49	1.39
--- src/sys/compat/ossaudio/ossaudio.c	2003/01/11 18:44:13
***************
*** 507,516 ****
  		if (error)
  			goto out;
  		break;
  	case OSS_SNDCTL_DSP_MAPINBUF:
  	case OSS_SNDCTL_DSP_MAPOUTBUF:
  	case OSS_SNDCTL_DSP_SETSYNCRO:
- 	case OSS_SNDCTL_DSP_SETDUPLEX:
  	case OSS_SNDCTL_DSP_PROFILE:
  		error = EINVAL;
  		goto out;
--- 507,521 ----
  		if (error)
  			goto out;
  		break;
+ 	case OSS_SNDCTL_DSP_SETDUPLEX:
+ 		idat=1;
+ 		error = ioctlf(fp, AUDIO_SETFD, (caddr_t)&idat, p);
+ 		if (error)
+ 			goto out;
+ 		break;
  	case OSS_SNDCTL_DSP_MAPINBUF:
  	case OSS_SNDCTL_DSP_MAPOUTBUF:
  	case OSS_SNDCTL_DSP_SETSYNCRO:
  	case OSS_SNDCTL_DSP_PROFILE:
  		error = EINVAL;
  		goto out;


Index: lib/libossaudio/ossaudio.c
===================================================================
RCS file: /cvsroot/src/lib/libossaudio/ossaudio.c,v
retrieving revision 1.16
diff -c -r1.16 ossaudio.c
*** src/lib/libossaudio/ossaudio.c	2001/12/24 00:10:46	1.16
--- src/lib/libossaudio/ossaudio.c	2003/01/11 18:44:58
***************
*** 423,432 ****
  		cntinfo.ptr = tmpoffs.offset;
  		*(struct count_info *)argp = cntinfo;
  		break;
  	case SNDCTL_DSP_MAPINBUF:
  	case SNDCTL_DSP_MAPOUTBUF:
  	case SNDCTL_DSP_SETSYNCRO:
- 	case SNDCTL_DSP_SETDUPLEX:
  	case SNDCTL_DSP_PROFILE:
  		errno = EINVAL;
  		return -1; /* XXX unimplemented */
--- 423,435 ----
  		cntinfo.ptr = tmpoffs.offset;
  		*(struct count_info *)argp = cntinfo;
  		break;
+ 	case SNDCTL_DSP_SETDUPLEX:
+ 		idat=1;
+ 		return(ioctl(fd, AUDIO_SETFD, &idat));
+ 		break;
  	case SNDCTL_DSP_MAPINBUF:
  	case SNDCTL_DSP_MAPOUTBUF:
  	case SNDCTL_DSP_SETSYNCRO:
  	case SNDCTL_DSP_PROFILE:
  		errno = EINVAL;
  		return -1; /* XXX unimplemented */
>Release-Note:
>Audit-Trail:
>Unformatted: