README for the SCSI media changer driver

This is a driver for SCSI Medium Changer devices, which are listedwith “Type: Medium Changer” in /proc/scsi/scsi.

This is forreal Jukeboxes. It isnot supported to work withcommon small CD-ROM changers, neither one-lun-per-slot SCSI changersnor IDE drives.

Userland tools available from here:
http://linux.bytesex.org/misc/changer.html

General Information

First some words about how changers work: A changer has 2 (possiblymore) SCSI ID’s. One for the changer device which controls the robot,and one for the device which actually reads and writes the data. Thelater may be anything, a MOD, a CD-ROM, a tape or whatever. For thechanger device this is a “don’t care”, heonly shuffles around themedia, nothing else.

The SCSI changer model is complex, compared to - for example - IDE-CDchangers. But it allows to handle nearly all possible cases. It knows4 different types of changer elements:

media transportthis one shuffles around the media, i.e. thetransport arm. Also known as “picker”.
storagea slot which can hold a media.
import/exportthe same as above, but is accessible from outside,i.e. there the operator (you !) can use this tofill in and remove media from the changer.Sometimes named “mailslot”.
data transferthis is the device which reads/writes, i.e. theCD-ROM / Tape / whatever drive.

None of these is limited to one: A huge Jukebox could have slots for123 CD-ROM’s, 5 CD-ROM readers (and therefore 6 SCSI ID’s: the changerand each CD-ROM) and 2 transport arms. No problem to handle.

How it is implemented

I implemented the driver as character device driver with a NetBSD-likeioctl interface. Just grabbed NetBSD’s header file and one of theother linux SCSI device drivers as starting point. The interfaceshould be source code compatible with NetBSD. So if there is anysoftware (anybody knows ???) which supports a BSDish changer driver,it should work with this driver too.

Over time a few more ioctls where added, volume tag support for examplewasn’t covered by the NetBSD ioctl API.

Current State

Support for more than one transport arm is not implemented yet (andnobody asked for it so far…).

I test and use the driver myself with a 35 slot cdrom jukebox fromGrundig. I got some reports telling it works ok with tape autoloaders(Exabyte, HP and DEC). Some People use this driver with amanda. Itworks fine with small (11 slots) and a huge (4 MOs, 88 slots)magneto-optical Jukebox. Probably with lots of other changers too, most(but not all :-) people mail me only if it doesnot work…

I don’t have any device lists, neither black-list nor white-list. Thusit is quite useless to ask me whenever a specific device is supported ornot. In theory every changer device which supports the SCSI-2 mediachanger command set should work out-of-the-box with this driver. If itdoesn’t, it is a bug. Either within the driver or within the firmwareof the changer device.

Using it

This is a character device with major number is 86, so use“mknod /dev/sch0 c 86 0” to create the special file for the driver.

If the module finds the changer, it prints some messages about thedevice [ try “dmesg” if you don’t see anything ] and should show up in/proc/devices. If not…. some changers use ID ? / LUN 0 for thedevice and ID ? / LUN 1 for the robot mechanism. But Linux doesnotlook for LUNs other than 0 as default, because there are too manybroken devices. So you can try:

  1. echo “scsi add-single-device 0 0 ID 1” > /proc/scsi/scsi(replace ID with the SCSI-ID of the device)
  2. boot the kernel with “max_scsi_luns=1” on the command line(append=”max_scsi_luns=1” in lilo.conf should do the trick)

Trouble?

If you insmod the driver with “insmod debug=1”, it will be verbose andprints a lot of stuff to the syslog. Compiling the kernel withCONFIG_SCSI_CONSTANTS=y improves the quality of the error messages a lotbecause the kernel will translate the error codes into human-readablestrings then.

You can display these messages with the dmesg command (or check thelogfiles). If you email me some question because of a problem with thedriver, please include these messages.

Insmod options

debug=0/1
Enable debug messages (see above, default: 0).
verbose=0/1
Be verbose (default: 1).
init=0/1
Send INITIALIZE ELEMENT STATUS command to the changerat insmod time (default: 1).
timeout_init=<seconds>
timeout for the INITIALIZE ELEMENT STATUS command(default: 3600).
timeout_move=<seconds>
timeout for all other commands (default: 120).
dt_id=<id1>,<id2>,… / dt_lun=<lun1>,<lun2>,…
These two allow to specify the SCSI ID and LUN for the datatransfer elements. You likely don’t need this as the jukeboxshould provide this information. But some devices don’t …
vendor_firsts=, vendor_counts=, vendor_labels=

These insmod options can be used to tell the driver that thereare some vendor-specific element types. Grundig for exampledoes this. Some jukeboxes have a printer to label fresh burnedCDs, which is addressed as element 0xc000 (type 5). To tell thedriver about this vendor-specific element, use this:

$ insmod ch                     \        vendor_firsts=0xc000    \        vendor_counts=1         \        vendor_labels=printer

All three insmod options accept up to four comma-separatedvalues, this way you can configure the element types 5-8.You likely need the SCSI specs for the device in question tofind the correct values as they are not covered by the SCSI-2standard.

Credits

I wrote this driver using the famous mailing-patches-around-the-worldmethod. With (more or less) help from:

Special thanks go to

for a old, second-hand (but full functional) cdrom jukebox which I useto develop/test driver and tools now.

Have fun,

Gerd

Gerd Knorr <kraxel@bytesex.org>