|
|
1.1 root 1: #include <stdio.h>
2: #include "../scsi.h"
3: #include "../scsish.h"
4: #include "fns.h"
5:
6: char *gen_rmb[2] = { "nonremovable", "removable" };
7: char *gen_devtype[256] = {
8: "direct access",
9: "sequential access",
10: "printer",
11: "processor",
12: "worm",
13: "cd-rom"
14: };
15:
16: int
17: gen_inq(int niargs, int *iargs, int ncargs, char **cargs, char *err)
18: {
19: struct scsi_cmd cmd;
20: struct scsi_return ret;
21: int n, i;
22:
23: #pragma ref ncargs
24: #pragma ref cargs
25:
26: if(niargs == 0)
27: for(niargs = 0; niargs < 8; niargs++)
28: iargs[niargs] = niargs;
29: for(i = 0; i < niargs; i++){
30: set6(cmd, 0x12, iargs[i]<<5, 0, 0, 36, 0);
31: if(n = s_io(0, &cmd, 0, &ret, -36, err))
32: return(n);
33: printf("inq(%d,%d): %s %s;", s_id, iargs[i],
34: gen_rmb[ret.data[1]>>7], gen_devtype[ret.data[0]]);
35: if(ret.data[4] >= 16){
36: char buf[256];
37:
38: fixedstr(&ret.data[8], 8, buf);
39: printf(" %s", buf);
40: if(ret.data[4] >= 32){
41: fixedstr(&ret.data[16], 16, buf);
42: printf("/%s", buf);
43: if(ret.data[4] >= 36){
44: fixedstr(&ret.data[32], 4, buf);
45: printf(" rev=%s", buf);
46: }
47: }
48: }
49: printf(" [%d bytes]\n", ret.data[4]);
50: }
51: return(0);
52: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.