*BSD News Article 18410


Return to BSD News archive

Newsgroups: comp.os.386bsd.bugs
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!math.ohio-state.edu!uwm.edu!linac!uchinews!raistlin!timbuk.cray.com!hemlock.cray.com!andyw
From: andyw@aspen32.cray.com (Andy Warner)
Subject: Soundblaster bugfix.
Message-ID: <1993Jul14.131153.17775@hemlock.cray.com>
Originator: andyw@aspen32
Lines: 96
Nntp-Posting-Host: aspen32
Organization: Cray Research, Inc.
Date: 14 Jul 93 13:11:53 CDT


Here's the context diffs to fix a problem with realease 1.5 of the
soundblaster driver. Using the mixer ioctls would mysteriously
reset the sampling speed, this was obviously a problem, because
mixer.c checked & reset the speed (unfortunately, it can't
do that when the DSP device is already opened..). Anyway, the
problem was an array bounds error in sbopen().

I also have made the minimum speed a #define rather than
and int, since it's never changed.
<=============================== cut here ========================>
*** /sys/i386/isa/sb.c-orig	Sun Feb 21 12:52:03 1993
--- /sys/i386/isa/sb.c	Tue Jul 13 00:48:16 1993
***************
*** 266,275 ****
    int		wake[NUM_UNITS];/* What to wakeup on interrupt */
  
    /* Select handler stuff, one entry for each "device" */
!   struct proc	*selects[SB_BIGGEST_MINOR];
!   sbFLAG	sel_coll[SB_BIGGEST_MINOR];
!   struct	proc *sig_proc[SB_BIGGEST_MINOR];
!   int		flags[SB_BIGGEST_MINOR];	/* fcntl flags */
  };
  static struct sb_status_type status; /* Global current status */
  
--- 266,275 ----
    int		wake[NUM_UNITS];/* What to wakeup on interrupt */
  
    /* Select handler stuff, one entry for each "device" */
!   struct proc	*selects[SB_BIGGEST_MINOR+1];
!   sbFLAG	sel_coll[SB_BIGGEST_MINOR+1];
!   struct	proc *sig_proc[SB_BIGGEST_MINOR+1];
!   int		flags[SB_BIGGEST_MINOR+1];	/* fcntl flags */
  };
  static struct sb_status_type status; /* Global current status */
  
***************
*** 305,312 ****
   *  you're using.  Defaults to oldest card unless configuration says
   *  otherwise.
   */
! int dsp_min_speed = 3906;
! int dsp_max_speed = 22222;
  
  /*
   * Forward declarations galore!
--- 305,312 ----
   *  you're using.  Defaults to oldest card unless configuration says
   *  otherwise.
   */
! #define DSP_MIN_SPEED 3906
! int dsp_max_speed = 22222 ;
  
  /*
   * Forward declarations galore!
***************
*** 537,543 ****
   */
  int sbopen(dev_t dev, int flags)
  {
!   if (!status.alive) return (ENODEV);
  
    DPRINTF (("open(): dev = 0x%x, flags = 0x%x\n", dev, flags));
  
--- 537,545 ----
   */
  int sbopen(dev_t dev, int flags)
  {
!   if (!status.alive || (minor(dev) > SB_BIGGEST_MINOR)) {
! 	return (ENODEV);
!   }
  
    DPRINTF (("open(): dev = 0x%x, flags = 0x%x\n", dev, flags));
  
***************
*** 1322,1328 ****
        return (ESUCCESS);
    }
  
!   *speed = MAX(*speed, dsp_min_speed);
    *speed = MIN(*speed, dsp_max_speed);
  
    if (*speed > MAX_LOW_SPEED) {
--- 1324,1330 ----
        return (ESUCCESS);
    }
  
!   *speed = MAX(*speed, DSP_MIN_SPEED);
    *speed = MIN(*speed, dsp_max_speed);
  
    if (*speed > MAX_LOW_SPEED) {
<=============================== cut here ========================>
-- 
andyw.	N0REN/G1XRL

andyw@aspen.cray.com	Andy Warner, Cray Research, Inc.	(612) 683-5835