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