<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//en">

<!–Converted with LaTeX2HTML 2022 (Released January 1, 2022) –> <HTML lang="en"> <HEAD> <TITLE>Contents of How to update your driver</TITLE>

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME="viewport" CONTENT="width=device-width, initial-scale=1.0"> <META NAME="Generator" CONTENT="LaTeX2HTML v2022">

<LINK REL="STYLESHEET" HREF="cdrom-st.css">

<LINK REL="previous" HREF="node29_mn.html"> <LINK REL="up" HREF="node23_mn.html"> <LINK REL="next" HREF="node35_mn.html"> </HEAD>

<BODY bgcolor="#ffffff" text="#000000" link="#9944EE" vlink="#0000ff" alink="#00ff00">

<H2><A ID="SECTION00047000000000000000"> How to update your driver</A> </H2> <P> <OL> <LI>Make a backup of your current driver. </LI> <LI>Get hold of the files <TT>cdrom.c</TT> and <TT>ucdrom.h</TT>, they should be in the directory tree that came with this documentation. </LI> <LI>Include <TT>&#60;linux/ucdrom.h&gt;</TT> just after <TT>cdrom.h</TT>. </LI> <LI>change the 3rd argument of <!– MATH registerblkdev –> <I>register</I><SUB>b</SUB><I>lkdev</I> from <!– MATH  SPMamp; < your - drive > fops –> &nbsp;<I>&</I>; &lt; <I>your</I> - <I>drive</I> &gt; <SUB>f</SUB><I>ops</I> to <!– MATH &cdromfops –> &amp;<I>cdrom</I><SUB>f</SUB><I>ops</I>. </LI> <LI>Just after that line, add a line to register to the CD<SMALL>ROM</SMALL> routines: <P><!– MATH

registercdrom(major, < name > , < your - drive > dops);

–> </P> <DIV ALIGN="CENTER"> <I>register</I><SUB>c</SUB><I>drom</I>(<I>major</I>, &lt; <I>name</I> &gt; , &lt; <I>your</I> - <I>drive</I> &gt; <SUB>d</SUB><I>ops</I>); </DIV><P></P> Similarly, add a call to <!– MATH unregistercdrom() –> <I>unregister</I><SUB>c</SUB><I>drom</I>(). </LI> <LI>Copy an example of the device-operations <I>struct</I> to your source, e.g., from <TT>cm206.c</TT> <!– MATH cm206dops –> <I>cm</I>206<SUB>d</SUB><I>ops</I>, and change all entries to names corresponding to your driver, or names you just happen to like. If your driver doesn't support a certain function, make the entry <I>NULL</I>. At the entry <!– MATH capability –> <I>capability</I> you should list all capabilities your drive could support, in principle. If your drive has a capability that is not listed, please send me a message. </LI> <LI>Implement all functions in your <!– MATH < device > dops –> &lt; <I>device</I> &gt; <SUB>d</SUB><I>ops</I> structure, according to prototypes listed in <TT>ucdrom.h</TT>, and specifications given in section&nbsp;<A HREF="node2_ct.html#cdrom.c"><IMG ALT="[*]" SRC="crossref.png"></A>. Most likely you have already implemented the code in a large part, and you may just have to adapt the prototype and return values. </LI> <LI>Rename your <!– MATH < device > ioctl () –> &lt; <I>device</I> &gt; <SUB>i</SUB><I>octl</I> () function to <!– MATH audioioctl –> <I>audio</I><SUB>i</SUB><I>octl</I> and change the prototype a little. Remove entries listed in the first part in section&nbsp;<A HREF="node29_ct.html#cdrom-ioctl"><IMG ALT="[*]" SRC="crossref.png"></A>, if your code was OK, these are just calls to the routines you adapted in the previous step. </LI> <LI>You may remove all remaining memory checking code in the <!– MATH audioioctl () –> <I>audio</I><SUB>i</SUB><I>octl</I> () function that deals with audio commands (these are listed in the second part of section&nbsp;<A HREF="node29_ct.html#cdrom-ioctl"><IMG ALT="[*]" SRC="crossref.png"></A>). There is no need for memory allocation either, so most <I>case</I>s in the <I>switch</I> statement look similar to: <P><!– MATH

case CDROMREADTOCENTRY : gettocentry$\displaystyle \bigl($(struct cdromtocentry*) arg$\displaystyle \bigr)$;

–> </P> <DIV ALIGN="CENTER"> <I>case</I>&nbsp;<I>CDROMREADTOCENTRY</I> : <I>get</I><SUB>t</SUB><I>oc</I><SUB>e</SUB><I>ntry</I><IMG STYLE="" SRC="img9.png" ALT=" $\displaystyle \bigl($">(<I>struct</I>&nbsp;<I>cdrom</I><SUB>t</SUB><I>ocentry</I>*)&nbsp;<I>arg</I><IMG STYLE="" SRC="img10.png" ALT=" $\displaystyle \bigr)$">; </DIV><P></P> </LI> <LI>All remaining <I>ioctl</I> cases must be moved to a separate function, <!– MATH < device > ioctl –> &lt; <I>device</I> &gt; <SUB>i</SUB><I>octl</I>, the device-dependent <I>ioctl</I>s. Note that memory checking and allocation must be kept in this code! </LI> <LI>Change the prototypes of <!– MATH < device > open() –> &lt; <I>device</I> &gt; <SUB>o</SUB><I>pen</I>() and <!– MATH < device > release() –> &lt; <I>device</I> &gt; <SUB>r</SUB><I>elease</I>(), and remove any strategic code (i.e., tray movement, door locking, etc.). </LI> <LI>Try to recompile the drivers. We advice you to use modules, both for <TT>cdrom.o</TT> and your driver, as debugging is much easier this way. </LI> </OL> <P> <HR>

</BODY> </HTML>