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