* Where's Konstantin? @ 2004-12-22 14:47 Frank Kotler 2004-12-22 17:44 ` OSS ioctls Richard Cooper 2004-12-22 23:58 ` Where's Konstantin? Brian Raiter 0 siblings, 2 replies; 8+ messages in thread From: Frank Kotler @ 2004-12-22 14:47 UTC (permalink / raw) To: linux-assembly Tried to send this to "konst linuxassembly org" but got it bounced back. I saw a reference a while back in this list for another address for him, but wasn't able to see it. Anyone know how to reach Konstantin... or what the story is with asmutils? TIA, Frank ----------------------------------- Hello Konstantin, I just tried to build asmutils-0.17, and it wants me to roll back to Nasm 0.98. No way in hell! Much too buggy! Rolled back to asmutils-0.14 instead. What's the problem with 0.17 that Nasm won't build it? Or, put another way, what's the problem with Nasm that it won't build 0.17 (builds 0.14 fine, so I'm inclined to think it's "not a Nasm problem"... but I always think that :) Sorry to have been so slow attempting to upgrade to asmutils-0.17 - hate to see this situation continue! Best, Frank fbkotler@comcast.net nasm-devel@lists.sf.net ^ permalink raw reply [flat|nested] 8+ messages in thread
* OSS ioctls... 2004-12-22 14:47 Where's Konstantin? Frank Kotler @ 2004-12-22 17:44 ` Richard Cooper 2004-12-22 20:40 ` Maciej Hrebien 2004-12-22 21:45 ` Maciej Hrebien 2004-12-22 23:58 ` Where's Konstantin? Brian Raiter 1 sibling, 2 replies; 8+ messages in thread From: Richard Cooper @ 2004-12-22 17:44 UTC (permalink / raw) To: linux-assembly 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. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: OSS ioctls... 2004-12-22 17:44 ` OSS ioctls Richard Cooper @ 2004-12-22 20:40 ` Maciej Hrebien 2004-12-22 21:20 ` Maciej Hrebien 2004-12-22 21:45 ` Maciej Hrebien 1 sibling, 1 reply; 8+ messages in thread From: Maciej Hrebien @ 2004-12-22 20:40 UTC (permalink / raw) To: linux-assembly Richard Cooper wrote: > > 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 > [cut] Correct me if i'm wrong but as i remember the ioctl gets an int (dd) as an argument - not an address. So [] is needed. -- Maciej Hrebien ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: OSS ioctls... 2004-12-22 20:40 ` Maciej Hrebien @ 2004-12-22 21:20 ` Maciej Hrebien 2004-12-23 0:18 ` Richard Cooper 0 siblings, 1 reply; 8+ messages in thread From: Maciej Hrebien @ 2004-12-22 21:20 UTC (permalink / raw) To: linux-assembly Maciej Hrebien wrote: > > Richard Cooper wrote: > > > > 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 > > > > [cut] > > Correct me if i'm wrong but as i remember the ioctl gets an > int (dd) as an argument - not an address. So [] is needed. What am i talking about? sorry! Did you tried the linuxassembly.org/articles/audio.html? Your code looks very similar and %define's seems to be different. -- Maciej Hrebien ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: OSS ioctls... 2004-12-22 21:20 ` Maciej Hrebien @ 2004-12-23 0:18 ` Richard Cooper 2004-12-23 9:25 ` Maciej Hrebien 0 siblings, 1 reply; 8+ messages in thread From: Richard Cooper @ 2004-12-23 0:18 UTC (permalink / raw) To: linux-assembly > Did you tried the linuxassembly.org/articles/audio.html? Your code looks > very similar and %define's seems to be different. I must have skimmed throught the list too fast, I didn't realize there was an article. Otherwise I would have read that instead of the massive PDF than is the OSS documentation. It's really quite nice documentation. It just naturally doesn't define the IOCTL numbers. It's at http://www.opensound.com/pguide/oss.pdf if anyone's interested. But anyway, looking at the example I see there's a $C0040000 or'ed with most of the ioctl numbers, and adding that to my numbers fixed everything up. Looking back at the header file I see that some of the IOCTL numbers go through a different macro... #define SNDCTL_DSP_SETFRAGMENT _SIOWR('P',10, int) #define _SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) #define SIOC_INOUT (SIOC_IN|SIOC_OUT) #define SIOC_OUT 0x20000000 /* copy out parameters */ #define SIOC_IN 0x40000000 /* copy in parameters */ Now as I see it, that should make those IOCTL numbers begin with $6004, not $C004, but $6004 doesn't work, only $C004 works. So I still don't see where the $C004 is coming from, but at least I know how to make it work now. Thanks for your help. I probably wouldn't have figured that out on my own until next year or the year after when I happen to stumble upon the linuxassembly article, seeing as the header file isn't even correct. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: OSS ioctls... 2004-12-23 0:18 ` Richard Cooper @ 2004-12-23 9:25 ` Maciej Hrebien 0 siblings, 0 replies; 8+ messages in thread From: Maciej Hrebien @ 2004-12-23 9:25 UTC (permalink / raw) To: linux-assembly Richard Cooper wrote: > > > Did you tried the linuxassembly.org/articles/audio.html? Your code looks > > very similar and %define's seems to be different. > > I must have skimmed throught the list too fast, I didn't realize there was > an article. Otherwise I would have read that instead of the massive PDF > than is the OSS documentation. It's really quite nice documentation. It > just naturally doesn't define the IOCTL numbers. It's at > http://www.opensound.com/pguide/oss.pdf if anyone's interested. > > But anyway, looking at the example I see there's a $C0040000 or'ed with > most of the ioctl numbers, and adding that to my numbers fixed everything > up. > > Looking back at the header file I see that some of the IOCTL numbers go > through a different macro... > > #define SNDCTL_DSP_SETFRAGMENT _SIOWR('P',10, int) > #define _SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) > #define SIOC_INOUT (SIOC_IN|SIOC_OUT) > #define SIOC_OUT 0x20000000 /* copy out parameters */ > #define SIOC_IN 0x40000000 /* copy in parameters */ > > Now as I see it, that should make those IOCTL numbers begin with $6004, > not $C004, but $6004 doesn't work, only $C004 works. So I still don't see > where the $C004 is coming from, but at least I know how to make it work > now. > > Thanks for your help. I probably wouldn't have figured that out on my own > until next year or the year after when I happen to stumble upon the > linuxassembly article, seeing as the header file isn't even correct. Read soundcard.h more careful. soundcard.h includes <linux/ioctl.h> which includes <asm/ioctl.h> with defined _IOWR. So the code we are considering is not even preprocesed. "#if defined(_IOWR)..." from soundcard.h does "#define _SIOWR _IOWR". _IOWR from <asm/ioctl.h> takes three arguments with first one named 'type' and 'dir' eq _IOC_READ|_IOC_WRITE when going to _IOC(dir,type,nr,size). As _IOC_READ|_IOC_WRITE is numericaly eq 3 and 'dir' from _IOC is shifted left 30 times (_IOC_DIRSHIFT) so you have 0xc in the MSB. Hope this helps :) -- Maciej Hrebien ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: OSS ioctls... 2004-12-22 17:44 ` OSS ioctls Richard Cooper 2004-12-22 20:40 ` Maciej Hrebien @ 2004-12-22 21:45 ` Maciej Hrebien 1 sibling, 0 replies; 8+ messages in thread From: Maciej Hrebien @ 2004-12-22 21:45 UTC (permalink / raw) To: linux-assembly Richard Cooper wrote: > > 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. OK, i have had time to check it... SNDCTL_DSP_GETFMTS is eq to _SIOR('P',11,int) which evaluates to: ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) where x='P', y=11, t=int Look soundcard.h for more details. Hope this helps and sorry for 3 posts - somethimes it happens ;) -- Maciej Hrebien ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Where's Konstantin? 2004-12-22 14:47 Where's Konstantin? Frank Kotler 2004-12-22 17:44 ` OSS ioctls Richard Cooper @ 2004-12-22 23:58 ` Brian Raiter 1 sibling, 0 replies; 8+ messages in thread From: Brian Raiter @ 2004-12-22 23:58 UTC (permalink / raw) To: linux-assembly > Tried to send this to "konst linuxassembly org" but got it bounced > back. I saw a reference a while back in this list for another > address for him, but wasn't able to see it. The address you're referring to was <konst@ipian.kazan.ru> b ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-12-23 9:25 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2004-12-22 14:47 Where's Konstantin? Frank Kotler 2004-12-22 17:44 ` OSS ioctls Richard Cooper 2004-12-22 20:40 ` 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
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).