File: inquiry

package info (click to toggle)
scsitools 0.12-2.3
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,200 kB
  • ctags: 820
  • sloc: ansic: 6,043; tcl: 2,144; sh: 923; makefile: 132
file content (197 lines) | stat: -rwxr-xr-x 6,093 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/usr/bin/wish -f
# Copyright 1993 Yggdrasil Computing, Incorporated
# You may copy this file according to the terms and conditions of version 2
# of the GNU General Public License as published by the Free Software
# Foundation.

frame .h
label .h.info -bitmap info -bg pink
message .h.message -width 400 -bg pink -text \
	{Scsi Device Information.}

pack .h.info .h.message -padx 10 -side left
pack .h -pady 10

frame .buttons
button .buttons.quit -text Quit \
	-activeforeground white -activebackground red -command exit

pack  .buttons.quit  -side left -padx 10 -pady 3
pack .buttons

frame .space1
pack .space1 -pady 10

frame .info1
frame .manufacturer
label .manufacturer.label -text "Manufacturer "
text .manufacturer.text -width 16 -height 1 \
	  -relief sunken -borderwidth 2
pack .manufacturer.label .manufacturer.text -side left

frame .model
label .model.label -text "Model "
text .model.text -width 16 -height 1 \
	  -relief sunken -borderwidth 2
pack .model.label .model.text -side left

frame .revision
label .revision.label -text "Firmware rev. "
text .revision.text -width 16 -height 1 \
	  -relief sunken -borderwidth 2
pack .revision.label .revision.text -side left

pack .manufacturer .model .revision -side left -in .info1 -padx 3m
pack .info1 -pady 10

frame .err_buttons
frame .col1
frame .col2
frame .col3
frame .col4
frame .f1
frame .f2
frame .f3

checkbutton .remove -text "Removable"

checkbutton .ra -text "Relative address" 
checkbutton .wb32 -text "Wide-bus 32" 
checkbutton .wb16 -text "Wide-bus 16" 
checkbutton .sn -text "Sync neg." 

checkbutton .link -text "Linked Commands" 
checkbutton .tag -text "Tagged Queueing" 
checkbutton .sftre -text "SftRe" 
label .dummy -text " "

pack .ra .link -in .col1 -anchor w
pack .wb32 .tag -in .col2 -anchor w
pack .wb16 .sftre -in .col3 -anchor w
pack .sn .dummy -in .col4 -anchor w

pack .col1 .col2 .col3 .col4 -in .err_buttons -side left -padx 3m

pack .err_buttons

frame .devicetype
label .devicetype.label -text "Device Type " -width 21 -anchor w
text .devicetype.text -width 10 -height 1 \
	 -relief sunken -borderwidth 2
pack .devicetype.label .devicetype.text -side left

frame .periphqual
label .periphqual.label -text "Peripheral Qualifier "  -width 21 -anchor w
text .periphqual.text -width 10 -height 1 \
	 -relief sunken -borderwidth 2
pack .periphqual.label .periphqual.text -side left

frame .removable
label .removable.label -text "Removable "  -width 21 -anchor w
text .removable.text -width 10 -height 1 \
	 -relief sunken -borderwidth 2
pack .removable.label .removable.text -side left

frame .devtypemod
label .devtypemod.label -text "Device Type Modifier "  -width 21 -anchor w
text .devtypemod.text -width 10 -height 1 \
	 -relief sunken -borderwidth 2
pack .devtypemod.label .devtypemod.text -side left

frame .isovers
label .isovers.label -text "ISO Version "  -width 21 -anchor w
text .isovers.text -width 10 -height 1 \
	 -relief sunken -borderwidth 2
pack .isovers.label .isovers.text -side left

frame .ecmaversion
label .ecmaversion.label -text "ECMA Version "  -width 21 -anchor w
text .ecmaversion.text -width 10 -height 1 \
	 -relief sunken -borderwidth 2
pack .ecmaversion.label .ecmaversion.text -side left

frame .ansiversion
label .ansiversion.label -text "ANSI Version "  -width 21 -anchor w
text .ansiversion.text -width 10 -height 1 \
	 -relief sunken -borderwidth 2
pack .ansiversion.label .ansiversion.text -side left

frame .aenc
label .aenc.label -text "AENC "  -width 21 -anchor w
text .aenc.text -width 10 -height 1 \
	 -relief sunken -borderwidth 2
pack .aenc.label .aenc.text -side left

frame .trmiop
label .trmiop.label -text "TrmIOP "  -width 21 -anchor w
text .trmiop.text -width 10 -height 1 \
	 -relief sunken -borderwidth 2
pack .trmiop.label .trmiop.text -side left

frame .response
label .response.label -anchor w -text "Response Data Format "  -width 21
text .response.text -width 10 -height 1 \
	 -relief sunken -borderwidth 2
pack .response.label .response.text -side left

pack .devicetype .periphqual .removable .devtypemod .isovers  -in .f1 -pady 5 -anchor w

pack .ecmaversion .ansiversion .aenc .trmiop .response  -in .f2 -pady 5 -anchor w

pack .f1 .f2 -in .f3 -side left -padx 3m -pady 3m
pack .f3  -padx 3m -pady 3m


# Here we set the bits that depend upon the menu we are in
set button_list { ra wb32 wb16 sn link tag sftre }
set text_list {devicetype periphqual removable devtypemod isovers ecmaversion ansiversion aenc trmiop response }
set switch {-i}


# the rest from here on should be pretty independent.
proc read_page { device option } {
    global button_list
    global text_list
    global switch
    set line {}
    exec /sbin/scsiinfo -X $switch $option $device > /var/run/cachepage
    if {[catch {set file [open /var/run/cachepage r]}] == 1} return;
    gets $file line
    set first [lindex $line 0]
    set second [lindex $line 1]
    set lineno 0
    foreach x $button_list { 
	.$x deselect
        if { [ string compare [lindex $line $lineno] "0" ] != 0} then { .$x select }
	.$x configure -state disabled -disabledforeground Black
	set lineno [expr $lineno+1]
    }
    foreach x $text_list { 
      .$x.text delete 1.0 end
      .$x.text insert end [lindex $line $lineno]
      .$x.text configure -state disabled
      set lineno [expr $lineno+1]
    }
    gets $file line
    .manufacturer.text delete 1.0 end
    .manufacturer.text insert end [lindex $line 0]
    .manufacturer.text configure -state disabled
    gets $file line
    .model.text delete 1.0 end
    .model.text insert end $line
    .model.text configure -state disabled
    gets $file line
    .revision.text delete 1.0 end
    .revision.text insert end $line
    .revision.text configure -state disabled
    close $file
    exec rm /var/run/cachepage
}

read_page $argv "-X"
set device_type {Disk Tape Unknown Unknown WORM ROM Unknown Magneto-Optical}
.devicetype.text configure -state normal
set r1 [.devicetype.text get 1.0 end]
.devicetype.text delete 1.0 end
.devicetype.text insert end [lindex $device_type $r1]
.devicetype.text configure -state disabled