Return to BSD News archive
Newsgroups: comp.unix.bsd.freebsd.misc Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!lucy.swin.edu.au!news.rmit.EDU.AU!goanna.cs.rmit.edu.au!news.apana.org.au!cantor.edge.net.au!news.teragen.com.au!news.access.net.au!news.mel.connect.com.au!news.mel.aone.net.au!grumpy.fl.net.au!news.webspan.net!www.nntp.primenet.com!nntp.primenet.com!su-news-hub1.bbnplanet.com!news.bbnplanet.com!cam-news-hub1.bbnplanet.com!howland.erols.net!spool.mu.edu!torn!news.dal.ca!news.nstn.ca!coranto.ucs.mun.ca!cs.mun.ca!jr From: jr@cs.mun.ca (John Rochester) Subject: patch for 2.1.5/2.1.6 ATAPI wcd driver Message-ID: <1997Feb6.175853.202@cs.mun.ca> Sender: usenet@cs.mun.ca (NNTP server account) Organization: CS Dept., Memorial University of Newfoundland X-Newsreader: NN version 6.4.19 References: <5c0ccn$a3@nntp1.best.com> Date: Thu, 6 Feb 1997 17:58:53 GMT Lines: 154 Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:35087 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-----