svi 0.3.14 → 0.3.15

Sign up to get free protection for your applications and to get access to all the features.
data/bin/lun_save_table DELETED
@@ -1,149 +0,0 @@
1
- #!/usr/bin/ruby19
2
-
3
- require 'svi/svi'
4
-
5
- require 'optparse'
6
- require 'optparse/time'
7
- require 'ostruct'
8
-
9
- USAGE = "Usage: lun_save_table [options]"
10
- ARGS_NUM = 0
11
-
12
- def parse_options(args)
13
- options = OpenStruct.new
14
-
15
- opt_parser = OptionParser.new do |opts|
16
- opts.banner = USAGE
17
- options.vid = 0x3241
18
- options.pid = 0x9372
19
- options.svi_if = 2
20
- options.sbi_if = 3
21
- options.sbi_if_ep_out = 0x3
22
- options.sbi_if_ep_in = 0x3
23
- options.svi_if_ep_out = 0x4
24
- options.svi_if_ep_in = 0x4
25
- options.timeout = 1000
26
- options.devnum = 0
27
- options.devnum_mod = nil
28
- options.verbose = false
29
-
30
- opts.separator ""
31
- opts.separator "Common options:"
32
-
33
- opts.on("-D", "--device vid:pid", String, "Use appropriate VID/PID") do |vidpid|
34
- vidpid = vidpid.split ':'
35
- options.vid = vidpid[0].hex
36
- options.pid = vidpid[1].hex
37
- end
38
-
39
- opts.on("-N", "--device-number N", Integer, "Use device number N (see device list by --list option)") do |devnum|
40
- options.devnum = devnum
41
- options.devnum_mod = true
42
- end
43
-
44
- opts.on("-T", "--timeout milliseconds", Integer, "Timeout for transfers on both interfaces") do |timeout|
45
- options.timeout = timeout
46
- end
47
-
48
- opts.on("--svi-if ifnum:epout:epin", String, "Define interface for SVI") do |args|
49
- args = args.split ':'
50
- options.svi_if = args[0].hex
51
- options.svi_if_ep_out = args[1].hex
52
- options.svi_if_ep_in = args[2].hex
53
- end
54
-
55
- opts.on("--verbose", "Print maximum information") do
56
- options.verbose = true
57
- end
58
-
59
- opts.on("--sbi-if ifnum:epout:epin", String, "Define interface for SBI") do |args|
60
- args = args.split ':'
61
- options.sbi_if = args[0].hex
62
- options.sbi_if_ep_out = args[1].hex
63
- options.sbi_if_ep_in = args[2].hex
64
- end
65
-
66
- opts.on_tail("-l", "--list", "Show devices list only") do
67
- USB.new(options.vid, options.pid).svi_devices.each_with_index { |dev, i|
68
- puts "#%d %s %s" % [i, dev.manufacturer, dev.product]
69
- }
70
- exit
71
- end
72
-
73
- opts.on_tail("-h", "--help", "Show this message") do
74
- puts opts
75
- exit
76
- end
77
-
78
- opts.on_tail("--version", "Show version") do
79
- puts SVI_VERSION
80
- exit
81
- end
82
- end
83
-
84
- opt_parser.parse!(args)
85
- [options, opt_parser]
86
- end
87
-
88
- res = parse_options(ARGV)
89
- options = res[0]
90
- opt_parser = res[1]
91
-
92
- if ARGV.count != ARGS_NUM
93
- p opt_parser
94
- exit 1
95
- end
96
-
97
- devs = USB.new(options.vid, options.pid).svi_devices
98
-
99
- if devs.count == 0
100
- puts 'Device not found'
101
- exit 1
102
- end
103
-
104
- if devs.count > 1 and options.devnum_mod.nil?
105
- puts 'There are more than one devices, using device #%d.' % options.devnum
106
- puts 'Use option -N to define necessary device.'
107
- puts "To view list of devices use -l option.\n\n"
108
- end
109
-
110
- dev = devs[options.devnum]
111
-
112
- dev.svi_if = options.svi_if
113
- dev.svi_if_ep_out = options.svi_if_ep_out
114
- dev.svi_if_ep_in = options.svi_if_ep_in
115
-
116
- dev.sbi_if = options.sbi_if
117
- dev.sbi_if_ep_out = options.sbi_if_ep_out
118
- dev.sbi_if_ep_in = options.sbi_if_ep_in
119
-
120
- dev.svi_timeout = options.timeout
121
- dev.sbi_timeout = options.timeout
122
-
123
- if options.verbose
124
- puts "Configuration:"
125
- puts "Device # = %d" % options.devnum
126
- puts "idVendor = 0x%04x" % options.vid
127
- puts "idProduct = 0x%04x" % options.pid
128
- puts "Interface number SVI = %d" % options.svi_if
129
- puts "OUT endpoint for SVI = 0x%02x" % options.svi_if_ep_out
130
- puts "IN endpoint for SVI = 0x%02x" % (options.svi_if_ep_in | 0x80)
131
- puts "Interface number SBI = %d" % options.sbi_if
132
- puts "OUT endpoint for SBI = 0x%02x" % options.sbi_if_ep_out
133
- puts "IN endpoint for SBI = 0x%02x" % (options.sbi_if_ep_in | 0x80)
134
- puts "Timeout for IN operations = %d msec" % options.timeout
135
- puts "\n\n"
136
- end
137
-
138
- if options.verbose
139
- end
140
-
141
- res = dev.lun_save_table
142
-
143
- if options.verbose
144
- end
145
-
146
- p res[0].to_i
147
-
148
- # vim: sw=2 sts=2 ts=8:
149
-
data/bin/lun_set_count DELETED
@@ -1,150 +0,0 @@
1
- #!/usr/bin/ruby19
2
-
3
- require 'svi/svi'
4
-
5
- require 'optparse'
6
- require 'optparse/time'
7
- require 'ostruct'
8
-
9
- USAGE = "Usage: lun_set_count [options] count"
10
- ARGS_NUM = 1
11
-
12
- def parse_options(args)
13
- options = OpenStruct.new
14
-
15
- opt_parser = OptionParser.new do |opts|
16
- opts.banner = USAGE
17
- options.vid = 0x3241
18
- options.pid = 0x9372
19
- options.svi_if = 2
20
- options.sbi_if = 3
21
- options.sbi_if_ep_out = 0x3
22
- options.sbi_if_ep_in = 0x3
23
- options.svi_if_ep_out = 0x4
24
- options.svi_if_ep_in = 0x4
25
- options.timeout = 1000
26
- options.devnum = 0
27
- options.devnum_mod = nil
28
- options.verbose = false
29
-
30
- opts.separator ""
31
- opts.separator "Common options:"
32
-
33
- opts.on("-D", "--device vid:pid", String, "Use appropriate VID/PID") do |vidpid|
34
- vidpid = vidpid.split ':'
35
- options.vid = vidpid[0].hex
36
- options.pid = vidpid[1].hex
37
- end
38
-
39
- opts.on("-N", "--device-number N", Integer, "Use device number N (see device list by --list option)") do |devnum|
40
- options.devnum = devnum
41
- options.devnum_mod = true
42
- end
43
-
44
- opts.on("-T", "--timeout milliseconds", Integer, "Timeout for transfers on both interfaces") do |timeout|
45
- options.timeout = timeout
46
- end
47
-
48
- opts.on("--svi-if ifnum:epout:epin", String, "Define interface for SVI") do |args|
49
- args = args.split ':'
50
- options.svi_if = args[0].hex
51
- options.svi_if_ep_out = args[1].hex
52
- options.svi_if_ep_in = args[2].hex
53
- end
54
-
55
- opts.on("--verbose", "Print maximum information") do
56
- options.verbose = true
57
- end
58
-
59
- opts.on("--sbi-if ifnum:epout:epin", String, "Define interface for SBI") do |args|
60
- args = args.split ':'
61
- options.sbi_if = args[0].hex
62
- options.sbi_if_ep_out = args[1].hex
63
- options.sbi_if_ep_in = args[2].hex
64
- end
65
-
66
- opts.on_tail("-l", "--list", "Show devices list only") do
67
- USB.new(options.vid, options.pid).svi_devices.each_with_index { |dev, i|
68
- puts "#%d %s %s" % [i, dev.manufacturer, dev.product]
69
- }
70
- exit
71
- end
72
-
73
- opts.on_tail("-h", "--help", "Show this message") do
74
- puts opts
75
- exit
76
- end
77
-
78
- opts.on_tail("--version", "Show version") do
79
- puts SVI_VERSION
80
- exit
81
- end
82
- end
83
-
84
- opt_parser.parse!(args)
85
- [options, opt_parser]
86
- end
87
-
88
- res = parse_options(ARGV)
89
- options = res[0]
90
- opt_parser = res[1]
91
-
92
- if ARGV.count != ARGS_NUM
93
- p opt_parser
94
- exit 1
95
- end
96
-
97
- devs = USB.new(options.vid, options.pid).svi_devices
98
-
99
- if devs.count == 0
100
- puts 'Device not found'
101
- exit 1
102
- end
103
-
104
- if devs.count > 1 and options.devnum_mod.nil?
105
- puts 'There are more than one devices, using device #%d.' % options.devnum
106
- puts 'Use option -N to define necessary device.'
107
- puts "To view list of devices use -l option.\n\n"
108
- end
109
-
110
- dev = devs[options.devnum]
111
-
112
- dev.svi_if = options.svi_if
113
- dev.svi_if_ep_out = options.svi_if_ep_out
114
- dev.svi_if_ep_in = options.svi_if_ep_in
115
-
116
- dev.sbi_if = options.sbi_if
117
- dev.sbi_if_ep_out = options.sbi_if_ep_out
118
- dev.sbi_if_ep_in = options.sbi_if_ep_in
119
-
120
- dev.svi_timeout = options.timeout
121
- dev.sbi_timeout = options.timeout
122
-
123
- if options.verbose
124
- puts "Configuration:"
125
- puts "Device # = %d" % options.devnum
126
- puts "idVendor = 0x%04x" % options.vid
127
- puts "idProduct = 0x%04x" % options.pid
128
- puts "Interface number SVI = %d" % options.svi_if
129
- puts "OUT endpoint for SVI = 0x%02x" % options.svi_if_ep_out
130
- puts "IN endpoint for SVI = 0x%02x" % (options.svi_if_ep_in | 0x80)
131
- puts "Interface number SBI = %d" % options.sbi_if
132
- puts "OUT endpoint for SBI = 0x%02x" % options.sbi_if_ep_out
133
- puts "IN endpoint for SBI = 0x%02x" % (options.sbi_if_ep_in | 0x80)
134
- puts "Timeout for IN operations = %d msec" % options.timeout
135
- puts "\n\n"
136
- end
137
-
138
- if options.verbose
139
- puts "lun_set_count(%d)" % ARGV[0].to_i
140
- end
141
-
142
- res = dev.lun_set_count ARGV[0].to_i
143
-
144
- if options.verbose
145
- end
146
-
147
- p res[0].to_i
148
-
149
- # vim: sw=2 sts=2 ts=8:
150
-
data/bin/lun_set_mode DELETED
@@ -1,161 +0,0 @@
1
- #!/usr/bin/ruby19
2
-
3
- require 'svi/svi'
4
-
5
- require 'optparse'
6
- require 'optparse/time'
7
- require 'ostruct'
8
-
9
- USAGE = "Usage: lun_set_mode [options] lun mode"
10
- ARGS_NUM = 2
11
-
12
- def parse_options(args)
13
- options = OpenStruct.new
14
-
15
- opt_parser = OptionParser.new do |opts|
16
- opts.banner = USAGE
17
- options.vid = 0x3241
18
- options.pid = 0x9372
19
- options.svi_if = 2
20
- options.sbi_if = 3
21
- options.sbi_if_ep_out = 0x3
22
- options.sbi_if_ep_in = 0x3
23
- options.svi_if_ep_out = 0x4
24
- options.svi_if_ep_in = 0x4
25
- options.timeout = 1000
26
- options.devnum = 0
27
- options.devnum_mod = nil
28
- options.verbose = false
29
-
30
- opts.separator ""
31
- opts.separator "Common options:"
32
-
33
- opts.on("-D", "--device vid:pid", String, "Use appropriate VID/PID") do |vidpid|
34
- vidpid = vidpid.split ':'
35
- options.vid = vidpid[0].hex
36
- options.pid = vidpid[1].hex
37
- end
38
-
39
- opts.on("-N", "--device-number N", Integer, "Use device number N (see device list by --list option)") do |devnum|
40
- options.devnum = devnum
41
- options.devnum_mod = true
42
- end
43
-
44
- opts.on("-T", "--timeout milliseconds", Integer, "Timeout for transfers on both interfaces") do |timeout|
45
- options.timeout = timeout
46
- end
47
-
48
- opts.on("--svi-if ifnum:epout:epin", String, "Define interface for SVI") do |args|
49
- args = args.split ':'
50
- options.svi_if = args[0].hex
51
- options.svi_if_ep_out = args[1].hex
52
- options.svi_if_ep_in = args[2].hex
53
- end
54
-
55
- opts.on("--verbose", "Print maximum information") do
56
- options.verbose = true
57
- end
58
-
59
- opts.on("--sbi-if ifnum:epout:epin", String, "Define interface for SBI") do |args|
60
- args = args.split ':'
61
- options.sbi_if = args[0].hex
62
- options.sbi_if_ep_out = args[1].hex
63
- options.sbi_if_ep_in = args[2].hex
64
- end
65
-
66
- opts.on_tail("-l", "--list", "Show devices list only") do
67
- USB.new(options.vid, options.pid).svi_devices.each_with_index { |dev, i|
68
- puts "#%d %s %s" % [i, dev.manufacturer, dev.product]
69
- }
70
- exit
71
- end
72
-
73
- opts.on_tail("-h", "--help", "Show this message") do
74
- puts opts
75
- exit
76
- end
77
-
78
- opts.on_tail("--version", "Show version") do
79
- puts SVI_VERSION
80
- exit
81
- end
82
- end
83
-
84
- opt_parser.parse!(args)
85
- [options, opt_parser]
86
- end
87
-
88
- res = parse_options(ARGV)
89
- options = res[0]
90
- opt_parser = res[1]
91
-
92
- if ARGV.count != ARGS_NUM
93
- p opt_parser
94
- exit 1
95
- end
96
-
97
- devs = USB.new(options.vid, options.pid).svi_devices
98
-
99
- if devs.count == 0
100
- puts 'Device not found'
101
- exit 1
102
- end
103
-
104
- if devs.count > 1 and options.devnum_mod.nil?
105
- puts 'There are more than one devices, using device #%d.' % options.devnum
106
- puts 'Use option -N to define necessary device.'
107
- puts "To view list of devices use -l option.\n\n"
108
- end
109
-
110
- dev = devs[options.devnum]
111
-
112
- dev.svi_if = options.svi_if
113
- dev.svi_if_ep_out = options.svi_if_ep_out
114
- dev.svi_if_ep_in = options.svi_if_ep_in
115
-
116
- dev.sbi_if = options.sbi_if
117
- dev.sbi_if_ep_out = options.sbi_if_ep_out
118
- dev.sbi_if_ep_in = options.sbi_if_ep_in
119
-
120
- dev.svi_timeout = options.timeout
121
- dev.sbi_timeout = options.timeout
122
-
123
- if options.verbose
124
- puts "Configuration:"
125
- puts "Device # = %d" % options.devnum
126
- puts "idVendor = 0x%04x" % options.vid
127
- puts "idProduct = 0x%04x" % options.pid
128
- puts "Interface number SVI = %d" % options.svi_if
129
- puts "OUT endpoint for SVI = 0x%02x" % options.svi_if_ep_out
130
- puts "IN endpoint for SVI = 0x%02x" % (options.svi_if_ep_in | 0x80)
131
- puts "Interface number SBI = %d" % options.sbi_if
132
- puts "OUT endpoint for SBI = 0x%02x" % options.sbi_if_ep_out
133
- puts "IN endpoint for SBI = 0x%02x" % (options.sbi_if_ep_in | 0x80)
134
- puts "Timeout for IN operations = %d msec" % options.timeout
135
- puts "\n\n"
136
- end
137
-
138
- modes = { "0" => 0, "1" => 1, "2" => 2, "3" => 3, "4" => 4, "ro" => 1, "rw" => 0, "ao" => 2, "hidden" => 3, "journal" => 2 }
139
-
140
- if !modes.has_key? ARGV[1]
141
- puts 'Error mode'
142
- puts 'Avaliable modes are: %s' % modes.keys.inspect
143
- exit 1
144
- end
145
-
146
- lun = ARGV[0].to_i
147
- mode = modes[ARGV[1]]
148
-
149
- if options.verbose
150
- puts "lun_set_mode(%d, %d)" % [lun, mode]
151
- end
152
-
153
- res = dev.lun_set_mode(lun, mode)
154
-
155
- if options.verbose
156
- end
157
-
158
- p res[0].to_i
159
-
160
- # vim: sw=2 sts=2 ts=8:
161
-
data/bin/lun_set_table DELETED
@@ -1,154 +0,0 @@
1
- #!/usr/bin/ruby19
2
-
3
- require 'svi/svi'
4
-
5
- require 'optparse'
6
- require 'optparse/time'
7
- require 'ostruct'
8
-
9
- USAGE = "Usage: lun_set_table [options] luns"
10
- ARGS_NUM = 1
11
-
12
- def parse_options(args)
13
- options = OpenStruct.new
14
-
15
- opt_parser = OptionParser.new do |opts|
16
- opts.banner = USAGE
17
- options.vid = 0x3241
18
- options.pid = 0x9372
19
- options.svi_if = 2
20
- options.sbi_if = 3
21
- options.sbi_if_ep_out = 0x3
22
- options.sbi_if_ep_in = 0x3
23
- options.svi_if_ep_out = 0x4
24
- options.svi_if_ep_in = 0x4
25
- options.timeout = 1000
26
- options.devnum = 0
27
- options.devnum_mod = nil
28
- options.verbose = false
29
-
30
- opts.separator ""
31
- opts.separator "Common options:"
32
-
33
- opts.on("-D", "--device vid:pid", String, "Use appropriate VID/PID") do |vidpid|
34
- vidpid = vidpid.split ':'
35
- options.vid = vidpid[0].hex
36
- options.pid = vidpid[1].hex
37
- end
38
-
39
- opts.on("-N", "--device-number N", Integer, "Use device number N (see device list by --list option)") do |devnum|
40
- options.devnum = devnum
41
- options.devnum_mod = true
42
- end
43
-
44
- opts.on("-T", "--timeout milliseconds", Integer, "Timeout for transfers on both interfaces") do |timeout|
45
- options.timeout = timeout
46
- end
47
-
48
- opts.on("--svi-if ifnum:epout:epin", String, "Define interface for SVI") do |args|
49
- args = args.split ':'
50
- options.svi_if = args[0].hex
51
- options.svi_if_ep_out = args[1].hex
52
- options.svi_if_ep_in = args[2].hex
53
- end
54
-
55
- opts.on("--verbose", "Print maximum information") do
56
- options.verbose = true
57
- end
58
-
59
- opts.on("--sbi-if ifnum:epout:epin", String, "Define interface for SBI") do |args|
60
- args = args.split ':'
61
- options.sbi_if = args[0].hex
62
- options.sbi_if_ep_out = args[1].hex
63
- options.sbi_if_ep_in = args[2].hex
64
- end
65
-
66
- opts.on_tail("-l", "--list", "Show devices list only") do
67
- USB.new(options.vid, options.pid).svi_devices.each_with_index { |dev, i|
68
- puts "#%d %s %s" % [i, dev.manufacturer, dev.product]
69
- }
70
- exit
71
- end
72
-
73
- opts.on_tail("-h", "--help", "Show this message") do
74
- puts opts
75
- exit
76
- end
77
-
78
- opts.on_tail("--version", "Show version") do
79
- puts SVI_VERSION
80
- exit
81
- end
82
- end
83
-
84
- opt_parser.parse!(args)
85
- [options, opt_parser]
86
- end
87
-
88
- res = parse_options(ARGV)
89
- options = res[0]
90
- opt_parser = res[1]
91
-
92
- if ARGV.count != ARGS_NUM
93
- p opt_parser
94
- exit 1
95
- end
96
-
97
- devs = USB.new(options.vid, options.pid).svi_devices
98
-
99
- if devs.count == 0
100
- puts 'Device not found'
101
- exit 1
102
- end
103
-
104
- if devs.count > 1 and options.devnum_mod.nil?
105
- puts 'There are more than one devices, using device #%d.' % options.devnum
106
- puts 'Use option -N to define necessary device.'
107
- puts "To view list of devices use -l option.\n\n"
108
- end
109
-
110
- dev = devs[options.devnum]
111
-
112
- dev.svi_if = options.svi_if
113
- dev.svi_if_ep_out = options.svi_if_ep_out
114
- dev.svi_if_ep_in = options.svi_if_ep_in
115
-
116
- dev.sbi_if = options.sbi_if
117
- dev.sbi_if_ep_out = options.sbi_if_ep_out
118
- dev.sbi_if_ep_in = options.sbi_if_ep_in
119
-
120
- dev.svi_timeout = options.timeout
121
- dev.sbi_timeout = options.timeout
122
-
123
- if options.verbose
124
- puts "Configuration:"
125
- puts "Device # = %d" % options.devnum
126
- puts "idVendor = 0x%04x" % options.vid
127
- puts "idProduct = 0x%04x" % options.pid
128
- puts "Interface number SVI = %d" % options.svi_if
129
- puts "OUT endpoint for SVI = 0x%02x" % options.svi_if_ep_out
130
- puts "IN endpoint for SVI = 0x%02x" % (options.svi_if_ep_in | 0x80)
131
- puts "Interface number SBI = %d" % options.sbi_if
132
- puts "OUT endpoint for SBI = 0x%02x" % options.sbi_if_ep_out
133
- puts "IN endpoint for SBI = 0x%02x" % (options.sbi_if_ep_in | 0x80)
134
- puts "Timeout for IN operations = %d msec" % options.timeout
135
- puts "\n\n"
136
- end
137
-
138
- luns = eval ARGV[0]
139
-
140
- #if(luns.kind_of? Array)
141
-
142
- if options.verbose
143
- puts "lun_set_table(%d, %s)" % [ ARGV[0].count/4, luns ]
144
- end
145
-
146
- res = dev.lun_set_count luns
147
-
148
- if options.verbose
149
- end
150
-
151
- p res[0].to_i
152
-
153
- # vim: sw=2 sts=2 ts=8:
154
-