1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun======================================== 4*4882a593SmuzhiyunREADME for the SCSI media changer driver 5*4882a593Smuzhiyun======================================== 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunThis is a driver for SCSI Medium Changer devices, which are listed 8*4882a593Smuzhiyunwith "Type: Medium Changer" in /proc/scsi/scsi. 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunThis is for *real* Jukeboxes. It is *not* supported to work with 11*4882a593Smuzhiyuncommon small CD-ROM changers, neither one-lun-per-slot SCSI changers 12*4882a593Smuzhiyunnor IDE drives. 13*4882a593Smuzhiyun 14*4882a593SmuzhiyunUserland tools available from here: 15*4882a593Smuzhiyun http://linux.bytesex.org/misc/changer.html 16*4882a593Smuzhiyun 17*4882a593Smuzhiyun 18*4882a593SmuzhiyunGeneral Information 19*4882a593Smuzhiyun------------------- 20*4882a593Smuzhiyun 21*4882a593SmuzhiyunFirst some words about how changers work: A changer has 2 (possibly 22*4882a593Smuzhiyunmore) SCSI ID's. One for the changer device which controls the robot, 23*4882a593Smuzhiyunand one for the device which actually reads and writes the data. The 24*4882a593Smuzhiyunlater may be anything, a MOD, a CD-ROM, a tape or whatever. For the 25*4882a593Smuzhiyunchanger device this is a "don't care", he *only* shuffles around the 26*4882a593Smuzhiyunmedia, nothing else. 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun 29*4882a593SmuzhiyunThe SCSI changer model is complex, compared to - for example - IDE-CD 30*4882a593Smuzhiyunchangers. But it allows to handle nearly all possible cases. It knows 31*4882a593Smuzhiyun4 different types of changer elements: 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun =============== ================================================== 34*4882a593Smuzhiyun media transport this one shuffles around the media, i.e. the 35*4882a593Smuzhiyun transport arm. Also known as "picker". 36*4882a593Smuzhiyun storage a slot which can hold a media. 37*4882a593Smuzhiyun import/export the same as above, but is accessible from outside, 38*4882a593Smuzhiyun i.e. there the operator (you !) can use this to 39*4882a593Smuzhiyun fill in and remove media from the changer. 40*4882a593Smuzhiyun Sometimes named "mailslot". 41*4882a593Smuzhiyun data transfer this is the device which reads/writes, i.e. the 42*4882a593Smuzhiyun CD-ROM / Tape / whatever drive. 43*4882a593Smuzhiyun =============== ================================================== 44*4882a593Smuzhiyun 45*4882a593SmuzhiyunNone of these is limited to one: A huge Jukebox could have slots for 46*4882a593Smuzhiyun123 CD-ROM's, 5 CD-ROM readers (and therefore 6 SCSI ID's: the changer 47*4882a593Smuzhiyunand each CD-ROM) and 2 transport arms. No problem to handle. 48*4882a593Smuzhiyun 49*4882a593Smuzhiyun 50*4882a593SmuzhiyunHow it is implemented 51*4882a593Smuzhiyun--------------------- 52*4882a593Smuzhiyun 53*4882a593SmuzhiyunI implemented the driver as character device driver with a NetBSD-like 54*4882a593Smuzhiyunioctl interface. Just grabbed NetBSD's header file and one of the 55*4882a593Smuzhiyunother linux SCSI device drivers as starting point. The interface 56*4882a593Smuzhiyunshould be source code compatible with NetBSD. So if there is any 57*4882a593Smuzhiyunsoftware (anybody knows ???) which supports a BSDish changer driver, 58*4882a593Smuzhiyunit should work with this driver too. 59*4882a593Smuzhiyun 60*4882a593SmuzhiyunOver time a few more ioctls where added, volume tag support for example 61*4882a593Smuzhiyunwasn't covered by the NetBSD ioctl API. 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun 64*4882a593SmuzhiyunCurrent State 65*4882a593Smuzhiyun------------- 66*4882a593Smuzhiyun 67*4882a593SmuzhiyunSupport for more than one transport arm is not implemented yet (and 68*4882a593Smuzhiyunnobody asked for it so far...). 69*4882a593Smuzhiyun 70*4882a593SmuzhiyunI test and use the driver myself with a 35 slot cdrom jukebox from 71*4882a593SmuzhiyunGrundig. I got some reports telling it works ok with tape autoloaders 72*4882a593Smuzhiyun(Exabyte, HP and DEC). Some People use this driver with amanda. It 73*4882a593Smuzhiyunworks fine with small (11 slots) and a huge (4 MOs, 88 slots) 74*4882a593Smuzhiyunmagneto-optical Jukebox. Probably with lots of other changers too, most 75*4882a593Smuzhiyun(but not all :-) people mail me only if it does *not* work... 76*4882a593Smuzhiyun 77*4882a593SmuzhiyunI don't have any device lists, neither black-list nor white-list. Thus 78*4882a593Smuzhiyunit is quite useless to ask me whenever a specific device is supported or 79*4882a593Smuzhiyunnot. In theory every changer device which supports the SCSI-2 media 80*4882a593Smuzhiyunchanger command set should work out-of-the-box with this driver. If it 81*4882a593Smuzhiyundoesn't, it is a bug. Either within the driver or within the firmware 82*4882a593Smuzhiyunof the changer device. 83*4882a593Smuzhiyun 84*4882a593Smuzhiyun 85*4882a593SmuzhiyunUsing it 86*4882a593Smuzhiyun-------- 87*4882a593Smuzhiyun 88*4882a593SmuzhiyunThis is a character device with major number is 86, so use 89*4882a593Smuzhiyun"mknod /dev/sch0 c 86 0" to create the special file for the driver. 90*4882a593Smuzhiyun 91*4882a593SmuzhiyunIf the module finds the changer, it prints some messages about the 92*4882a593Smuzhiyundevice [ try "dmesg" if you don't see anything ] and should show up in 93*4882a593Smuzhiyun/proc/devices. If not.... some changers use ID ? / LUN 0 for the 94*4882a593Smuzhiyundevice and ID ? / LUN 1 for the robot mechanism. But Linux does *not* 95*4882a593Smuzhiyunlook for LUNs other than 0 as default, because there are too many 96*4882a593Smuzhiyunbroken devices. So you can try: 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun 1) echo "scsi add-single-device 0 0 ID 1" > /proc/scsi/scsi 99*4882a593Smuzhiyun (replace ID with the SCSI-ID of the device) 100*4882a593Smuzhiyun 2) boot the kernel with "max_scsi_luns=1" on the command line 101*4882a593Smuzhiyun (append="max_scsi_luns=1" in lilo.conf should do the trick) 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun 104*4882a593SmuzhiyunTrouble? 105*4882a593Smuzhiyun-------- 106*4882a593Smuzhiyun 107*4882a593SmuzhiyunIf you insmod the driver with "insmod debug=1", it will be verbose and 108*4882a593Smuzhiyunprints a lot of stuff to the syslog. Compiling the kernel with 109*4882a593SmuzhiyunCONFIG_SCSI_CONSTANTS=y improves the quality of the error messages a lot 110*4882a593Smuzhiyunbecause the kernel will translate the error codes into human-readable 111*4882a593Smuzhiyunstrings then. 112*4882a593Smuzhiyun 113*4882a593SmuzhiyunYou can display these messages with the dmesg command (or check the 114*4882a593Smuzhiyunlogfiles). If you email me some question because of a problem with the 115*4882a593Smuzhiyundriver, please include these messages. 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun 118*4882a593SmuzhiyunInsmod options 119*4882a593Smuzhiyun-------------- 120*4882a593Smuzhiyun 121*4882a593Smuzhiyundebug=0/1 122*4882a593Smuzhiyun Enable debug messages (see above, default: 0). 123*4882a593Smuzhiyun 124*4882a593Smuzhiyunverbose=0/1 125*4882a593Smuzhiyun Be verbose (default: 1). 126*4882a593Smuzhiyun 127*4882a593Smuzhiyuninit=0/1 128*4882a593Smuzhiyun Send INITIALIZE ELEMENT STATUS command to the changer 129*4882a593Smuzhiyun at insmod time (default: 1). 130*4882a593Smuzhiyun 131*4882a593Smuzhiyuntimeout_init=<seconds> 132*4882a593Smuzhiyun timeout for the INITIALIZE ELEMENT STATUS command 133*4882a593Smuzhiyun (default: 3600). 134*4882a593Smuzhiyun 135*4882a593Smuzhiyuntimeout_move=<seconds> 136*4882a593Smuzhiyun timeout for all other commands (default: 120). 137*4882a593Smuzhiyun 138*4882a593Smuzhiyundt_id=<id1>,<id2>,... / dt_lun=<lun1>,<lun2>,... 139*4882a593Smuzhiyun These two allow to specify the SCSI ID and LUN for the data 140*4882a593Smuzhiyun transfer elements. You likely don't need this as the jukebox 141*4882a593Smuzhiyun should provide this information. But some devices don't ... 142*4882a593Smuzhiyun 143*4882a593Smuzhiyunvendor_firsts=, vendor_counts=, vendor_labels= 144*4882a593Smuzhiyun These insmod options can be used to tell the driver that there 145*4882a593Smuzhiyun are some vendor-specific element types. Grundig for example 146*4882a593Smuzhiyun does this. Some jukeboxes have a printer to label fresh burned 147*4882a593Smuzhiyun CDs, which is addressed as element 0xc000 (type 5). To tell the 148*4882a593Smuzhiyun driver about this vendor-specific element, use this:: 149*4882a593Smuzhiyun 150*4882a593Smuzhiyun $ insmod ch \ 151*4882a593Smuzhiyun vendor_firsts=0xc000 \ 152*4882a593Smuzhiyun vendor_counts=1 \ 153*4882a593Smuzhiyun vendor_labels=printer 154*4882a593Smuzhiyun 155*4882a593Smuzhiyun All three insmod options accept up to four comma-separated 156*4882a593Smuzhiyun values, this way you can configure the element types 5-8. 157*4882a593Smuzhiyun You likely need the SCSI specs for the device in question to 158*4882a593Smuzhiyun find the correct values as they are not covered by the SCSI-2 159*4882a593Smuzhiyun standard. 160*4882a593Smuzhiyun 161*4882a593Smuzhiyun 162*4882a593SmuzhiyunCredits 163*4882a593Smuzhiyun------- 164*4882a593Smuzhiyun 165*4882a593SmuzhiyunI wrote this driver using the famous mailing-patches-around-the-world 166*4882a593Smuzhiyunmethod. With (more or less) help from: 167*4882a593Smuzhiyun 168*4882a593Smuzhiyun - Daniel Moehwald <moehwald@hdg.de> 169*4882a593Smuzhiyun - Dane Jasper <dane@sonic.net> 170*4882a593Smuzhiyun - R. Scott Bailey <sbailey@dsddi.eds.com> 171*4882a593Smuzhiyun - Jonathan Corbet <corbet@lwn.net> 172*4882a593Smuzhiyun 173*4882a593SmuzhiyunSpecial thanks go to 174*4882a593Smuzhiyun 175*4882a593Smuzhiyun - Martin Kuehne <martin.kuehne@bnbt.de> 176*4882a593Smuzhiyun 177*4882a593Smuzhiyunfor a old, second-hand (but full functional) cdrom jukebox which I use 178*4882a593Smuzhiyunto develop/test driver and tools now. 179*4882a593Smuzhiyun 180*4882a593SmuzhiyunHave fun, 181*4882a593Smuzhiyun 182*4882a593Smuzhiyun Gerd 183*4882a593Smuzhiyun 184*4882a593SmuzhiyunGerd Knorr <kraxel@bytesex.org> 185