broken pas2 ioctl followup

Bob Tracy (rct@gherkin.sa.wlk.com)
Wed, 7 Jan 1998 06:57:19 -0600 (CST)


Something appears to be getting lost in the translation between user
space and the pas2 sound driver ioctl code. Here's a sample strace
session from an attempt to play a '.au' file using Linux sox: the
transcript has been edited for brevity, but hopefully without deleting
essential information. (Driver debugging info follows...)

====--strace--====
$ strace sox *02* -t ossdsp /dev/dsp
(...)
open("BSc02-Ow!.au", O_RDONLY) = 3
open("/dev/dsp", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
(...)
read(3, ".snd\0\0\0&\0\0\23\332\0\0\0\1\0"..., 4096) = 4096
ioctl(4, 0x5000, 0) = 0
ioctl(4, 0xc0045004, 0x806a2c4) = 0
write(2, "sox: ", 5sox: ) = 5
write(2, "abuf_size = 4096", 16abuf_size = 4096) = 16
write(2, "\n", 1
) = 1
brk(0x8077000) = 0x8077000
ioctl(4, 0x5001, 0) = 0
ioctl(4, 0xc0045005, 0xbffffb98) = 0
write(2, "sox: ", 5sox: ) = 5
write(2, "samplesize = 8, tmp = 8", 23samplesize = 8, tmp = 8) = 23
write(2, "\n", 1
) = 1
ioctl(4, 0xc0045003, 0xbffffb98) = 0
write(2, "sox: ", 5sox: ) = 5
write(2, "dsp_stereo = 0, tmp = -1", 24dsp_stereo = 0, tmp = -1) = 24
write(2, "\n", 1
) = 1
write(2, "sox: ", 5sox: ) = 5
write(2, "Couldn\'t set to mono", 20Couldn't set to mono) = 20
write(2, "\n", 1
) = 1
ioctl(4, 0xc0045002, 0xbffffb98) = 0
write(2, "sox: ", 5sox: ) = 5
write(2, "ft->info.rate = 8012, tmp = 0", 29ft->info.rate = 8012, tmp = 0) = 29
write(2, "\n", 1
) = 1
write(2, "sox: ", 5sox: ) = 5
write(2, "Unable to set audio speed to 801"..., 44Unable to set audio speed to 8012 (set to 0)) = 44
write(2, "\n", 1
) = 1
write(2, "sox: ", 5sox: ) = 5
write(2, "Sampling rate for /dev/dsp file "..., 46Sampling rate for /dev/dsp file was not given
) = 46
write(2, "\n", 1
) = 1
close(3) = 0
munmap(0x40008000, 4096) = 0
close(4) = 0
fstat(-1, 0xbffffb3c) = -1 EBADF (Bad file number)
_exit(2) = ?
$
====--strace--====

Now, here's what the corresponding syslog output looks like for
pas2_pcm.c with DEB(WHAT) defined to (WHAT) and a couple of extra
printk() statements thrown in for good measure.

====--syslog--====
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: static int pas_audio_open(int mode = 2)
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: static int pas_audio_ioctl(unsigned int cmd = C0045005, caddr_t arg = C3B07F10)
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: SNDCTL_DSP_SETFMT: ret = 8
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: static int pas_audio_ioctl(unsigned int cmd = C0045006, caddr_t arg = C3B07EFC)
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: SOUND_PCM_WRITE_CHANNELS: ret = 1, val = 1
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: static int pas_audio_ioctl(unsigned int cmd = C0045002, caddr_t arg = C3B07F00)
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: SOUND_PCM_WRITE_RATE: ret = 8008
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: static int pas_audio_ioctl(unsigned int cmd = C0045005, caddr_t arg = C3B07F24)
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: SNDCTL_DSP_SETFMT: ret = 8
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: static int pas_audio_ioctl(unsigned int cmd = C0045002, caddr_t arg = C3B07EE4)
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: SOUND_PCM_WRITE_RATE: ret = 8008
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: static int pas_audio_ioctl(unsigned int cmd = C0045006, caddr_t arg = C3B07ED0)
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: SOUND_PCM_WRITE_CHANNELS: ret = 1, val = 0
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: static int pas_audio_ioctl(unsigned int cmd = C0045005, caddr_t arg = C3B07ED4)
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: SNDCTL_DSP_SETFMT: ret = 8
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: static int pas_audio_ioctl(unsigned int cmd = C0045005, caddr_t arg = C3B07F48)
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: SNDCTL_DSP_SETFMT: ret = 8
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: static int pas_audio_ioctl(unsigned int cmd = C0045006, caddr_t arg = C3B07F50)
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: SOUND_PCM_WRITE_CHANNELS: ret = 1, val = 1
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: static int pas_audio_ioctl(unsigned int cmd = C0045002, caddr_t arg = C3B07F5C)
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: SOUND_PCM_WRITE_RATE: ret = 8008
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: static void pas_audio_close(void)
Jan 7 06:35:14 gherkin kernel: pas2_pcm.c: static void pas_audio_reset(void)
====--syslog--====

I would have expected to see a "cmd = C0045004" and a "cmd = C0045003"
in there somewhere, among other anomalies. Sure hope the above helps
someone figure out what's going on.

-- 
Bob Tracy               |  If you have any trouble sounding condescending,
Firewall Security Corp. |  find a Unix user to show you how it's done.
rct@frus.com            |  	-- Scott Adams: DNRC Newsletter 3.0