Article 8282 (28 more) in alt.cd-rom: From: kkaempf@didymus.rmi.de (Klaus Kaempf) Subject: Re: Sun/Solaris & Standard CD ROM Drives Message-ID: Organization: Klaus Kaempf Softwareentwicklung References: <1m196oINNls2@usenet.INS.CWRU.Edu> <1me3h4INNj73@meaddata.meaddata.com> Date: Fri, 26 Feb 1993 10:33:11 GMT Lines: 147 Hi folks ! This debate about CDROM drives and Suns is as old as this newsgroup. There is a cheap solution (at least for SunOS 4.x, don't know about Solaris 2 yet) and source is included below. You still can't boot with the drive since the *stupid* OpenProm Boot code doesn't set the record lenght to 512bytes. But what you can do is compile the following program (it expects /dev/rsr0 as the drive, change line 22 if it's something else) and put it in your 'rc.local'. Ttttttthats all folks ! Klaus ------------->--cut here--<---------------- /* * setreclen.c * * set record length of CDROM to 512bytes * * This came along the net a while ago * I cleaned it up and added some debug code * Have fun ! * Klaus Kaempf, kkaempf@didymus.rmi.de * */ # include # include # include # include # include # include # include 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) /***/ #define UBUFLEN 4096 static void showhex(why, what, len) char *why; unsigned char *what; int len; { fprintf(stderr,"Showhex %s\n", why); while (len > 0) { fprintf(stderr,"%02x ", *what++); len--; } fprintf(stderr,"\n"); return; } 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(UBUFLEN); if (s_buffer == NULL) { printf("malloc error (buffer)\n"); exit(-1); } bzero(s_buffer, UBUFLEN); 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 = UBUFLEN; ucmd.uscsi_flags = USCSI_WRITE; i = ioctl(fd, USCSICMD, ucmd); #if 1 showhex("ucmd", &ucmd, sizeof ucmd); showhex("s_buffer", s_buffer, 256); #endif close(fd); exit(i); } -------->--and here --<--------------- -- Klaus Kaempf E-Mail: kkaempf@didymus.rmi.de Jakobstr. 181 Fax: 0241-403407 D-5100 Aachen Voice: 0241-403446