home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cdrom.com/pub/cdrom/
/
cdrom.tar
/
cdrom
/
sun_toshiba
/
set_raw.c
< prev
Wrap
C/C++ Source or Header
|
1993-07-05
|
1KB
|
75 lines
/* set_raw.c -- Set density to 0x82 to allow reading raw CD-DA frames.
*
* Send a Mode Select command via the USCSICMD facility of the CDROM driver
* in SunOS 4.1.3. Set the Density to 0x82 and the Block Length to 2352.
*
* Author: Adrie Koolen (adrie@ica.philips.nl)
*/
#include <stdio.h>
#include <sys/types.h>
#include <scsi/scsi_types.h>
#include <scsi/impl/uscsi.h>
u_char scsibuf[] = {
0x15, /* MODE SELECT */
0x10, /* LUN */
0x00,
0x00,
0x0c,
0x00
};
u_char databuf[] = {
0x00, 0x00, 0x00, 0x08, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x30
};
struct uscsi_cmd usc = {
(caddr_t) scsibuf,
sizeof(scsibuf),
(caddr_t) databuf,
sizeof(databuf),
0,
(USCSI_DIAGNOSE | USCSI_ISOLATE)
};
char *program;
main(argc, argv)
int argc;
char *argv[];
{
int fd;
int len;
int i;
program = argv[0];
if ((fd = open("/dev/rsr0", 0)) < 0)
pfatal("open");
if (ioctl(fd, USCSICMD, usc) < 0)
pfatal("ioctl");
/****
printf("ret len:%d\n", usc.uscsi_buflen);
for (i = 0; i < usc.uscsi_buflen; i++) {
if (!(i & 0xf))
printf("\n%04x: ", i); printf("%02x ", databuf[i]);
}
printf("\n");
****/
}
pfatal(s)
char *s;
{
fprintf(stderr, "%s: ", program);
perror(s);
fprintf(stderr, "\n");
exit(1);
}