Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 04 Apr 1995 00:42:37 -0700
From:      Steven Wallace <swallace@ece.uci.edu>
To:        Sujal Patel <smpatel@wam.umd.edu>
Cc:        hackers@FreeBSD.org
Subject:   Re: Whee - I've got my MBONE feed.. 
Message-ID:  <199504040742.AA15813@balboa.eng.uci.edu>
In-Reply-To: Your message of "Tue, 04 Apr 1995 01:52:34 EDT." <Pine.BSD.3.91.950404014302.136G-100000@xi.dorm.umd.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
> On Mon, 3 Apr 1995, Steven Wallace wrote:
> 
>> What software uses SNDCTL_DSP_SETFRAGMENT?  What sound card are you using?
>> Have you tried recompiling the software?  Have you tried using
>> an old one compiled for 1.1 or 2.0?
> 
> The software I'm using is Paradise-netrek.  I've tried both 2.0 
> compiled and -current compiled binaries.
> 
> Here is a code fragment:
> 
> *fragsize = 0;
> frag = 0x00080007;
> 
> ioctl(dsp, SNDCTL_DSP_SETFRAGMENT, &frag);
> ioctl(dsp, SNDCTL_DSP_GETBLKSIZE, fragsize);
> 
> if (!(*fragsize)) {
>     printf ("Error:  Couldn't Get Block Size\n");
> }
> 
> 
> On Linux (same VoxWare drivers), this code fragment runs through ok.  On 
> FreeBSD, the GETBLKSIZE returns 0 causing the Error.
> 
Take a look:
*** /usr/src-2.0/sys/i386/include/soundcard.h   Mon Nov 14 06:13:13 1994
--- /sys/i386/include/soundcard.h       Wed Mar  8 13:19:01 1995
--- 63,68 ----
***************
*** 536,548 ****
  #define SNDCTL_DSP_SYNC                       _IO  ('P', 1)
  #define SNDCTL_DSP_SPEED              _IOWR('P', 2, int)
  #define SNDCTL_DSP_STEREO             _IOWR('P', 3, int)
! #define SNDCTL_DSP_GETBLKSIZE         _IOWR('P', 4, int)
  #define SNDCTL_DSP_SAMPLESIZE         SNDCTL_DSP_SETFMT
  #define SOUND_PCM_WRITE_CHANNELS      _IOWR('P', 6, int)
  #define SOUND_PCM_WRITE_FILTER                _IOWR('P', 7, int)
  #define SNDCTL_DSP_POST                       _IO  ('P', 8)
  #define SNDCTL_DSP_SUBDIVIDE          _IOWR('P', 9, int)
  #define SNDCTL_DSP_SETFRAGMENT                _IOWR('P',10, int)
  
  /*    Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */
  #define SNDCTL_DSP_GETFMTS            _IOR ('P',11, int) /* Returns a mask */
--- 514,527 ----
  #define SNDCTL_DSP_SYNC                       _IO  ('P', 1)
  #define SNDCTL_DSP_SPEED              _IOWR('P', 2, int)
  #define SNDCTL_DSP_STEREO             _IOWR('P', 3, int)
! #define SNDCTL_DSP_GETBLKSIZE         _IOR('P', 4, int)
  #define SNDCTL_DSP_SAMPLESIZE         SNDCTL_DSP_SETFMT
  #define SOUND_PCM_WRITE_CHANNELS      _IOWR('P', 6, int)
  #define SOUND_PCM_WRITE_FILTER                _IOWR('P', 7, int)
  #define SNDCTL_DSP_POST                       _IO  ('P', 8)
  #define SNDCTL_DSP_SUBDIVIDE          _IOWR('P', 9, int)
  #define SNDCTL_DSP_SETFRAGMENT                _IOWR('P',10, int)
+ #define       SNDCTL_DSP_SETBLKSIZE           _IOW('P', 4, int)
  
  /*    Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */
  #define SNDCTL_DSP_GETFMTS            _IOR ('P',11, int) /* Returns a mask */

As you can see, SNDCTL_DSP_GETBLKSIZE has been changed from _IOWR to
_IOR, so old binaries compiled with _IOWR will not be able to find
the ioctl, causing the error to be displayed.  You can change it 
back and then recompile your kernel and the old binaries should work.
So it is SNDCTL_DSP_GETBLKSIZE that is causing you probs, not
SNDCTL_DSP_SETFRAGMENT.  If you compile using a -current kernel
but still have old <machine/soundcard.h> to compile the program,
they won't match and it will still not work.

Perhaps in the kernel sound code, we should have SNDCTL_DSP_GETBLKSIZE
accept both _IOWR and _IOR types for backwards broken compatability.
What do you guys think?

Steven



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199504040742.AA15813>