* Written By Julian ELischer
* Copyright julian Elischer 1993.
* Permission is granted to use or redistribute this file in any way as long
* as this notice remains. Julian Elischer does not guarantee that this file
* is totally correct for any given task and users of this file must
* accept responsibility for any damage that occurs from the application of this
* (julian@tfs.com julian@dialix.oz.au)
#include <scsi/scsi_all.h>
int bus
= -1; /* all busses */
int targ
= -1; /* all targs */
int lun
= 0; /* just lun 0 */
main(int argc
, char **argv
, char **envp
)
struct scsi_inquiry_data dat
;
procargs(argc
,argv
,envp
);
if (ioctl(fd
,SCIOCREPROBE
,&scaddr
) == -1)
if (ioctl(fd
,SCIOCDEBUG
,&debuglevel
) == -1) {
perror("ioctl [SCIODEBUG]");
show_mem(&dat
,sizeof(dat
));
* Do a scsi operation asking a device what it is
* Use the scsi_cmd routine in the switch table.
struct scsi_inquiry_data
*inqbuf
;
struct scsi_inquiry
*cmd
;
cmd
= (struct scsi_inquiry
*) req
.cmd
;
cmd
->length
= sizeof(struct scsi_inquiry_data
);
req
.flags
= SCCMD_READ
; /* info about the request status and type */
req
.cmdlen
= sizeof(*cmd
);
req
.databuf
= (caddr_t
)inqbuf
; /* address in user space of buffer */
req
.datalen
= sizeof(*inqbuf
); /* size of user buffer */
if (ioctl(fd
,SCIOCCOMMAND
,&req
) == -1)
printf("------------------------------");
for (y
= 0; y
< num
; y
+= 1) {
printf("%02x ", *address
++);
printf("\n------------------------------\n");