SUMMARY: CD-ROMS- not SUN/SONY

From: Bob Hayes (bob@henson.cc.wwu.edu)
Date: Wed Feb 05 1992 - 16:19:25 CST


My original query- can you use a CD-ROM drive other than
a Sony for Suns...Specifically a Toshiba 3301B from a
NeXT... generated several replies, from YES to NO-WAY...

The answer is YES for data, probably yes for audio.
For other drives than Toshiba??? Lets hear your results
when you try it!!

begin SOAPBOX
Let me say *THANKS* to EVERYONE who wrote to express
ANY thoughts !! We need all the discusion that we can handle,
we need all the ideas that we can think of, and then we can
sift for what ideas we need most, and save some for later.

This network stuff is the most far reaching, inclusive,
responsive, and open communications forum to have existed
on the planet! (add more adjectives as required)
May we continue the free, open interchange of ideas and
information!
end SOAPBOX

So what about the CD-ROM stuff??
The problem seems to be in the sector size read from the
scsi interface--- Sun expects 512 bytes, the default format
of the CD1 spec is (mode 1, with ECC) 2048 bytes per 'block'.

Is there an ftp site for the (red/blue/green?? rainbow) books
which have the CD specs and mode descriptions???

This is on a Sun LPC, SunOS 4.1.1b--
Patches which I tried in the kernel were not effective.
I posted. I read the mail. I tried it. IT WORKED!!

And the GOOD STUFF, Thanks and a tip 'o the hat to Ralph,
who wrote:

From: rkling@austin.intel.com (Ralph Kling)
        YES, it is possible! I have managed to connect one to a SS-2.
        However, there are a few differences between the SUN (=SONY) drive
        and the Toshiba drive. In particular, the SUN drive seems to use
        a default transfer block size of 512 bytes versus 2048 for the
        Toshiba. I wrote a little program that uses SUNs user-scsi-driver
        to correct this. You have to run that before trying to mount the
        drive! The "unrecognized vendor" message can be neglected.
        If you want to use the CD-audio capabilities you'll have to write
        your own driver (also via SUNs user-scsi-driver) since those commands
        are totally different from the SUN drive. Call Toshiba of America
        (sorry, I lost the number) and order the CD rom drive spec from them
        (will cost you $15).
        One more thing: The scsi-id for the CD rom needs to be 6.
        Good luck!!!

        Ralph

        Here is the program to set the transfer length to 512 bytes:

        -----------
        # include <sys/types.h>
        # include <sys/buf.h>
        # include <sun/dkio.h>
        # include <scsi/targets/srdef.h>
        # include <scsi/impl/uscsi.h>
        # include <strings.h>

        # include <stdio.h>

        char cdrom[] = "/dev/rsr0";

        extern char * cdrom_status();

        /* group 0 commands */

        #define TEST 0x00
        #define REZERO 0x01
        #define SENSEREQ 0x03
        #define READ 0x08
        #define SEEK 0x0b
        #define NOP 0x0d
        #define INQ 0x12
        #define MODESEL 0x15
        #define RESERVE 0x16
        #define RELEASE 0x17
        #define MODESENSE 0x1a
        #define STARTSTOP 0x1b
        #define DIAGRCV 0x1c
        #define DIAGSND 0x1d
        #define MEDIUMLOCK 0x1e

        /* group 1 commands */

        #define READCAP 0x25
        #define READEXT 0x28
        #define SEEKEXT 0x2b

        /* group 6 commands */

        #define AUDIOTRACK 0xc0
        #define AUDIOPLAY 0xc1
        #define AUDIOSTILL 0xc2
        #define AUDIOSTOP 0xc3
        #define EJECT 0xc4
        #define CLOSE 0xc5
        #define AUDIOSUB 0xc6
        #define AUDIODISK 0xc7
        #define ROMMODE 0xc8

        /***/

        #define CMDLEN(cmd) ((cmd >= 0x20) ? 10 : 6)

        /***/

        main() {
                int fd;
                int i;
                struct uscsi_cmd ucmd;
                char * s_command;
                char * s_buffer;

                if ((fd = open(cdrom, 0)) == -1) {
                        fprintf(stderr, "open: ");
                        perror(cdrom);
                        exit(1);
                }
                s_command = (char *) malloc(10);
                if (s_command == NULL) {
                        printf("malloc error (command)\n");
                        exit(-1);
                }
                bzero(s_command, 10);
                s_buffer = (char *) malloc(256);
                if (s_buffer == NULL) {
                        printf("malloc error (buffer)\n");
                        exit(-1);
                }
                bzero(s_buffer, 256);
                s_command[0] = MODESEL;
                s_command[1] = 0x10;
                s_command[4] = 12;
                s_buffer[3] = 0x08;
                s_buffer[10] = 0x02;
                ucmd.uscsi_cdb = s_command;
                ucmd.uscsi_cdblen = 6;
                ucmd.uscsi_bufaddr = s_buffer;
                ucmd.uscsi_buflen = 4096;
                ucmd.uscsi_flags = USCSI_WRITE;
                i = ioctl(fd, USCSICMD, ucmd);
                close(fd);
                exit(i);
        }
**************** end of Ralph's goodie ****************
I can hear those odd-ball Cd-rom drives being hooked onto
scsi busses already!
Bob Hayes <bob@cs.wwu.edu>



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:35 CDT