CDspindown v1.0 beta
--------------------


* DESCRIPTION

This is the first release of CDspindown, a simple utility
designed to adjust the spindown time interval of ATAPI CDROM drives.

To use CDspindown you need to patch the kernel ide-cd driver,
in order to add two new IOCTL calls which the program uses
to get/set the device spindown interval. There are two patches
included in this archive; they have to be applied to the following
kernel files:

[/usr/src/linux]/drivers/block/ide-cd.c
[/usr/src/linux]/include/linux/cdrom.h

These patches should work with any kernel version since 1.2.13,
but I only tested them with some recent kernels (1.3.9x).

Once you have succesfully patched the kernel sources and
recompiled the kernel, you'll have two new IOCTL calls
available when using an ATAPI CDROM device. The first
one is CDROMSETSPINDOWN, which accepts a single char
and stores its lower nibble into the device spindown
register; the second one is CDROMGETSPINDOWN, which
stores the current value of that same register into
a user-provided char variable. Have a look at the
sources of CDspindown to see how to use these calls.



* INSTALLATION:

First of all, you have to patch your kernel sources
to add the IOCTL calls necessary for CDspindown to work.
Copy ide-cd.c.patch to the directory [/usr/src/linux]/drivers/block
and do

  patch -l < ide-cd.c.patch

to patch the ide-cd driver. Then copy cdrom.h.patch to
[/usr/src/linux]/include/linux and do

  patch -l < cdrom.h.patch 

to update the cdrom.h include file. The included patches are
taken against the sources of kernel 1.3.95 ; ide-cd.c.patch
should give no problems with older kernels too (I succesfully
patched kernel 1.2.13) , while cdrom.h.patch may fail to apply,
because cdrom.h has changed a lot since 1.2.13. In such a case
just add the following two lines to cdrom.h :

  #define CDROMGETSPINDOWN      0x5320 /* get current spindown time */
  #define CDROMSETSPINDOWN      0x5321 /* set spindown time */

Put them below the lines which look like these:

  /*
   * CD-ROM IOCTL commands
   * For IOCTL calls, we will commandeer byte 0x53, or 'S'.
   */

After patching and recompiling your kernel,
enter the source directory and compile CDspindown using

  make

Then modify Makefile to suit your needs (installation
directory, executable permission) and do

  make install

to install the compiled executable.



* USAGE

CDspindown accepts command-line parameters according
to the following syntax:

  CDspindown [-q] <device> <code>

<device> is the full pathname of the device file 
of the ATAPI CDROM drive to configure, i.e. /dev/cdrom
or /dev/hdx.

<code> is an integer parameter in the range 0-15
which - according to revision 2.5 of the ATAPI
specifications - determines the duration of the
inactivity interval before spindown.

   0 - vendor specific
   1 - 125 ms
   2 - 250 ms
   3 - 500 ms
   4 - 1 s
   5 - 2 s
   6 - 4 s
   7 - 8 s
   8 - 16 s
   9 - 32 s
  10 - 1 min
  11 - 2 min
  12 - 4 min
  13 - 8 min
  14 - 16 min
  15 - 32 min

[-q] is an optional switch which forces "quiet" processing
of the command line, useful if you want to insert CDspindown
in your rc.local script, or in such a place where its output
is not desired.



* BUGS

At present there are no known bugs
both in the program or the patch.



* DISCLAIMER

This is BETA software. USE IT AT YOUR OWN RISK.
I assume no responsibility about the nasty things
which the program or the patch can do to your system.    ;)



* LICENSE

The source code for CDspindown and the kernel patches
are released under the GNU General Public License.
You are free to distribute and modify the code
as far as you mention my name as the original author.



* BUG REPORTS & COMMENTS

If you think you have found a bug, if you own some incompatible
hardware, if you liked the program, if you hated it, if you have
any suggestion ... PLEASE let me know!     :)

Write to the following e-mail address:

  ciro@stud.unipg.it

I'll respond as soon as possible.

Ciro Cattuto



* THE END


 
