*BSD News Article 89525


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!newsfeed.internetmci.com!uuneo.neosoft.com!dolphin.neosoft.com!nobody
From: conrads@neosoft.com (Conrad Sabatier)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: REPOST: Patch for 2.15/2.16 ATAPI driver
Date: Tue, 18 Feb 1997 07:30:26 -0600
Organization: NeoSoft, Inc.
Lines: 165
Message-ID: <itace5.ir1.ln@dolphin.neosoft.com>
Reply-To: conrads@neosoft.com
NNTP-Posting-Host: 206.27.167.0
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Newsreader: knews 0.9.8
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:35695

Here's the article posted here recently:

From jr@cs.mun.ca Tue Feb 18 07:27:34 1997
Date: Thu, 6 Feb 1997 17:58:53 GMT
From: John Rochester <jr@cs.mun.ca>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: patch for 2.1.5/2.1.6 ATAPI wcd driver

This patch is essentially some of the changes that went into the
2.2 driver (I had originally done my own patches, but edited them
to make them look more like 2.2).

Instructions for the neophyte:

1) put the contents below (between the "cut here" lines) into a file like
	/tmp/cdpatch

2) do the following commands:

	cd /usr/src/sys
	patch -p0 < /tmp/cdpatch

		(patch will put the old file in i386/isa/wcd.c.orig)

3) If you haven't configured a kernel, do so.  Read the handbook entry on
	"Configuring the FreeBSD Kernel".  (The handbook is in
	    /usr/share/doc/handbook/handbook.ascii  or handbook_toc.html).

	cd /usr/src/sys/i386/conf
	cp GENERIC YOURKERNELNAMEHERE
	vi YOURKERNELNAMEHERE
	config YOURKERNELNAMEHERE

4) Recompile and install the new kernel:

	cd /usr/src/sys/compile/YOURKERNELNAMEHERE
	make depend
	make
	(and, if there are no errors:)
	make install

5) Reboot.


For xmcd to work, make sure that /usr/X11R6/lib/X11/xmcd/config/common.cfg
has the following device line:

device:		/dev/rwcd0c

And that /usr/X11R6/lib/X11/xmcd/config/rwcd0c (copied from device.cfg if
you don't already have one) has the following line in it:

deviceInterfaceMethod:	2

john
-----
John Rochester			jr@cs.mun.ca
Dept. of Computer Science
Memorial University of Newfoundland, St. John's, Newfoundland, Canada

-----cut here-----
*** i386/isa/wcd.c.orig	Thu Feb  6 13:43:45 1997
--- i386/isa/wcd.c	Thu Feb  6 13:58:53 1997
***************
*** 41,46 ****
--- 41,48 ----
  #define F_DEBUG         0x0004          /* The media have changed since open */
  #define F_NOPLAYCD      0x0008          /* The PLAY_CD op not supported */
  
+ #define WCD_LASTPLUS1	170		/* Don't ask, xcdplayer uses this */
+ 
  /*
   * Disc table of contents.
   */
***************
*** 732,749 ****
  		struct toc *toc = &t->toc;
  		struct toc buf;
  		u_long len;
  
  		if (! t->toc.hdr.ending_track)
  			return (EIO);
! 		if (te->starting_track < toc->hdr.starting_track ||
! 		    te->starting_track > toc->hdr.ending_track)
  			return (EINVAL);
  
! 		len = (toc->hdr.ending_track - te->starting_track + 2) *
  			sizeof(toc->tab[0]);
  		if (te->data_len < len)
  			len = te->data_len;
! 		if (len <= 0)
  			return (EINVAL);
  
  		/* Convert to MSF format, if needed. */
--- 734,764 ----
  		struct toc *toc = &t->toc;
  		struct toc buf;
  		u_long len;
+ 		u_char starting_track = te->starting_track;
  
  		if (! t->toc.hdr.ending_track)
  			return (EIO);
! 
! 		if (   te->data_len < sizeof(toc->tab[0])
! 		    || (te->data_len % sizeof(toc->tab[0])) != 0
! 		    || te->address_format != CD_MSF_FORMAT
! 		    && te->address_format != CD_LBA_FORMAT
! 		   )
  			return (EINVAL);
  
! 		if (starting_track == 0)
! 			starting_track = toc->hdr.starting_track;
! 		else if (starting_track == WCD_LASTPLUS1)
! 			starting_track = toc->hdr.ending_track + 1;
! 		else if (starting_track < toc->hdr.starting_track ||
! 			 starting_track > toc->hdr.ending_track + 1)
! 			return (EINVAL);
! 
! 		len = (toc->hdr.ending_track + 2 - starting_track) *
  			sizeof(toc->tab[0]);
  		if (te->data_len < len)
  			len = te->data_len;
! 		if (len > sizeof(toc->tab))
  			return (EINVAL);
  
  		/* Convert to MSF format, if needed. */
***************
*** 752,767 ****
  
  			buf = t->toc;
  			toc = &buf;
! 			e = toc->tab + toc->hdr.ending_track -
! 				te->starting_track + 2;
  			while (--e >= toc->tab)
  				lba2msf (e->addr.lba, &e->addr.msf.minute,
  				    &e->addr.msf.second, &e->addr.msf.frame);
  		}
! 		if (copyout (toc->tab + te->starting_track -
! 		    toc->hdr.starting_track, te->data, len) != 0)
! 			error = EFAULT;
! 		break;
  	}
  	case CDIOCREADSUBCHANNEL: {
  		struct ioc_read_subchannel *args =
--- 767,780 ----
  
  			buf = t->toc;
  			toc = &buf;
! 			e = toc->tab + toc->hdr.ending_track + 2 -
! 				    toc->hdr.starting_track;
  			while (--e >= toc->tab)
  				lba2msf (e->addr.lba, &e->addr.msf.minute,
  				    &e->addr.msf.second, &e->addr.msf.frame);
  		}
! 		return copyout (toc->tab + starting_track -
! 				toc->hdr.starting_track, te->data, len);
  	}
  	case CDIOCREADSUBCHANNEL: {
  		struct ioc_read_subchannel *args =
-----cut here-----

-- 
Conrad Sabatier		http://www.neosoft.com/~conrads