How to update your driver

  1. Make a backup of your current driver.
  2. Get hold of the files cdrom.c and ucdrom.h, they should be in the directory tree that came with this documentation.
  3. Include <linux/ucdrom.h> just after cdrom.h.
  4. Change the 3rd argument of registerblkdev from  SPMamp; < your - drive > fops to &cdromfops.
  5. Just after that line, add a line to register to the CDROM routines:

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

    Similarly, add a call to unregistercdrom().
  6. Copy an example of the device-operations struct to your source, e.g., from cm206.c cm206dops, 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 NULL. At the entry capability 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.
  7. Implement all functions in your < device > dops structure, according to prototypes listed in ucdrom.h, and specifications given in section [*]. Most likely you have already implemented the code in a large part, and you may just have to adapt the prototype and return values.
  8. Rename your < device > ioctl () function to audioioctl and change the prototype a little. Remove entries listed in the first part in section [*], if your code was OK, these are just calls to the routines you adapted in the previous step.
  9. You may remove all remaining memory checking code in the audioioctl () function that deals with audio commands (these are listed in the second part of section [*]). There is no need for memory allocation either, so most cases in the switch statement look similar to:

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

  10. All remaining ioctl cases must be moved to a separate function, < device > ioctl, the device-dependent ioctls. Note that memory checking and allocation must be kept in this code!
  11. Change the prototypes of < device > open() and < device > release(), and remove any strategic code (i.e., tray movement, door locking, etc.).
  12. Try to recompile the drivers. We advice you to use modules, both for cdrom.o and your driver, as debugging is much easier this way.