Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Dec 1995 09:47:08 -0700
From:      Nate Williams <nate@trout.sri.MT.net>
To:        current@FreeBSD.org
Subject:   ATAPI patch
Message-ID:  <199512201647.JAA10218@trout.sri.MT.net>

next in thread | raw e-mail | index | archive | help
Path: helena.MT.net!news.sprintlink.net!newsserver.pixel.kodak.com!bloom-beacon.mit.edu!newsfeed.internetmci.com!in2.uu.net!ulowell.uml.edu!swlnews.msd.ray.com!not-for-mail
From: wag@swl.msd.ray.com (William Gianopoulos {84718})
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Patch for ATAPI CD-ROM dirver (wcd.c) to allow playing audio CD's
Date: 19 Dec 1995 21:54:39 -0500
Organization: Raytheon Company
Lines: 87
Message-ID: <4b7ttf$hme@swlpak.msd.ray.com>
NNTP-Posting-Host: swlpak.msd.ray.com

I previously reported a problem whereby I could not get xcdplayer to work
on an ATAPI CD-ROM drive.  I have since determined that there are 2 problems
involved.  One is that there is no mechanism in the wcd.c driver to read
the LEADOUT track data, and the second is that the code to convert the TOC
entries to MSF format incorrectly calulates the number of entries to
convert.  The following patch corrects both problems:

*** wcd.c.orig	Tue Dec 19 20:24:48 1995
--- wcd.c	Tue Dec 19 21:37:58 1995
***************
*** 732,745 ****
  		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;
--- 732,752 ----
  		struct toc *toc = &t->toc;
  		struct toc buf;
  		u_long len;
+ 		u_char trk;
+ 
  
  		if (! t->toc.hdr.ending_track)
  			return (EIO);
! 		if (te->starting_track == 0xAA) {
! 		    trk = toc->hdr.ending_track + 1;
! 		} else {
! 		    trk = te->starting_track;
! 		    if (trk < toc->hdr.starting_track ||
! 		        trk > toc->hdr.ending_track)
! 			    return (EINVAL);
! 		}
  
! 		len = (toc->hdr.ending_track - trk + 2) *
  			sizeof(toc->tab[0]);
  		if (te->data_len < len)
  			len = te->data_len;
***************
*** 752,764 ****
  
  			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;
--- 759,771 ----
  
  			buf = t->toc;
  			toc = &buf;
! 			e = toc->tab - toc->hdr.starting_track +
! 				trk + 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 + trk -
  		    toc->hdr.starting_track, te->data, len) != 0)
  			error = EFAULT;
  		break;

This still leaves a problem for which I have no patch, which is that the code
to set the volume does not work, but my speakers have volume controls which I
find easier to use anyway, so I didn't spend all that much time looking for
that problem!

-- 
William A. Gianopoulos; Raytheon Electronic Systems
wag@swl.msd.ray.com
--------------------------------------------------------
This is my personal opinion and not that of my employer.



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