From: "Richard Cooper" <generic@xersedefixion.com>
To: linux-assembly@vger.kernel.org
Subject: OSS ioctls...
Date: Wed, 22 Dec 2004 12:44:50 -0500 [thread overview]
Message-ID: <opsje7k0wruqea3r@sucks.airplane.fire> (raw)
In-Reply-To: <41C988EB.9CC568EF@comcast.net>
I am going to go insane... Please help...
Here's my code:
section .text
%define SNDCTL_DSP_RESET 0x5000
%define SNDCTL_DSP_SPEED 0x5002
%define SNDCTL_DSP_SETFMT 0x5005
%define SNDCTL_DSP_GETFMTS 0x500B
%define SNDCTL_DSP_CHANNELS 0x5006
%define SNDCTL_DSP_POST 0x5008
%define SNDCTL_DSP_SETFRAGMENT 0x500A
%define AFMT_S16_LE 0x0010
sys sys_open, dev_dsp, O_WRONLY; systrap "opening /dev/dsp"
mov [out_desc], eax
sys sys_ioctl, [out_desc], SNDCTL_DSP_RESET, 0; systrap
"resetting dsp"
sys sys_ioctl, [out_desc], SNDCTL_DSP_GETFMTS, formats; systrap
"getting dsp formats"
sys sys_ioctl, [out_desc], SNDCTL_DSP_CHANNELS, channels; systrap
"setting dsp channels"
sys sys_ioctl, [out_desc], SNDCTL_DSP_SPEED, speed; systrap
"setting dsp speed"
sys sys_ioctl, [out_desc], SNDCTL_DSP_SETFMT, format; systrap
"setting dsp format"
sys sys_ioctl, [out_desc], SNDCTL_DSP_SETFRAGMENT, fragment; systrap
"setting dsp fragment size"
section .data
channels dd 1
speed dd 8000
format dd AFMT_S16_LE
formats dd 0
fragment dd $00080006
ass dd 0
section .bss
out_desc resd 1
Every time I run it I get a error message like this:
Error getting dsp formats
EAX Error Code: EINVAL -- Invalid argument
EAX: FFFFFFEA EBX: 00000004 ECX: 0000500B EDX: 0804B3A0
ESI: 00000000 EDI: 00000000 EBP: 00000000 ESP: BFFFF810
EIP: 0804822E EFLAGS: 00000000 00000000 00000010 00000010
I really can't imagine what the invalid argument is. According to the
register dump right there the file descriptor is in ebx, the ioctl number
in ecx, and a memory pointer in edx, yet every ioctl except for
SNDCTL_DSP_RESET gives that same error.
If I forget the ioctls and go on, I can write to the sound device and get
sound, but I need to use them because it's not set to the right format by
default.
I've run strace on sox and I'm using the same ioctls it does, yet they
work for it and not for me. This is nuts.
The OSS documentation says not to use SNDCTL_DSP_RESET after opening.
I've tried it without it and with it (since sox does it) and it's the same
either way.
The only thing I could think might be wrong is that the ioctl numbers are
wrong, but I looked in soundcard.h and it says SNDCTL_DSP_GETFMTS is ('P',
11) which best I can figure has to be $500B.
next prev parent reply other threads:[~2004-12-22 17:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-22 14:47 Where's Konstantin? Frank Kotler
2004-12-22 17:44 ` Richard Cooper [this message]
2004-12-22 20:40 ` OSS ioctls Maciej Hrebien
2004-12-22 21:20 ` Maciej Hrebien
2004-12-23 0:18 ` Richard Cooper
2004-12-23 9:25 ` Maciej Hrebien
2004-12-22 21:45 ` Maciej Hrebien
2004-12-22 23:58 ` Where's Konstantin? Brian Raiter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=opsje7k0wruqea3r@sucks.airplane.fire \
--to=generic@xersedefixion.com \
--cc=linux-assembly@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).