libusb 0.1.3-x86-mingw32 → 0.2.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,63 @@
1
+ # This file is part of Libusb for Ruby.
2
+ #
3
+ # Libusb for Ruby is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # Libusb for Ruby is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with Libusb for Ruby. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require 'libusb/call'
17
+
18
+ module LIBUSB
19
+ class Version < FFI::Struct
20
+ layout :major, :uint16,
21
+ :minor, :uint16,
22
+ :micro, :uint16,
23
+ :nano, :uint16,
24
+ :rc, :pointer,
25
+ :describe, :pointer
26
+
27
+ # Library major version.
28
+ def major
29
+ self[:major]
30
+ end
31
+ # Library minor version.
32
+ def minor
33
+ self[:minor]
34
+ end
35
+ # Library micro version.
36
+ def micro
37
+ self[:micro]
38
+ end
39
+ # Library nano version.
40
+ def nano
41
+ self[:nano]
42
+ end
43
+
44
+ # Library release candidate suffix string, e.g. "-rc4".
45
+ def rc
46
+ self[:rc].read_string
47
+ end
48
+
49
+ # For ABI compatibility only.
50
+ def describe
51
+ self[:describe].read_string
52
+ end
53
+
54
+ # Version string, e.g. "1.2.3-rc4"
55
+ def to_s
56
+ "#{major}.#{minor}.#{micro}#{rc}"
57
+ end
58
+
59
+ def inspect
60
+ "\#<#{self.class} #{to_s}>"
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,23 @@
1
+ # This file is part of Libusb for Ruby.
2
+ #
3
+ # Libusb for Ruby is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # Libusb for Ruby is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with Libusb for Ruby. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require "test/unit"
17
+ require "libusb"
18
+
19
+ class TestLibusbCapability < Test::Unit::TestCase
20
+ def test_version_parts
21
+ assert LIBUSB.has_capability?(:CAP_HAS_CAPABILITY)
22
+ end
23
+ end
@@ -161,6 +161,19 @@ class TestLibusbDescriptors < Test::Unit::TestCase
161
161
  assert_operator dev.max_packet_size(ep.bEndpointAddress), :>, 0, "#{dev.inspect} should have a usable packet size"
162
162
  assert_operator dev.max_iso_packet_size(ep), :>, 0, "#{dev.inspect} should have a usable iso packet size"
163
163
  assert_operator dev.max_iso_packet_size(ep.bEndpointAddress), :>, 0, "#{dev.inspect} should have a usable iso packet size"
164
+ assert_operator dev.bus_number, :>=, 0, "#{dev.inspect} should have a bus_number"
165
+ assert_operator dev.device_address, :>=, 0, "#{dev.inspect} should have a device_address"
166
+ assert_operator([:SPEED_UNKNOWN, :SPEED_LOW, :SPEED_FULL, :SPEED_HIGH, :SPEED_SUPER], :include?, dev.device_speed, "#{dev.inspect} should have a device_speed")
167
+ path = dev.port_path
168
+ assert_kind_of Array, path, "#{dev.inspect} should have a port_path"
169
+ path.each do |port|
170
+ assert_operator port, :>, 0, "#{dev.inspect} should have proper port_path entries"
171
+ end
172
+ assert_equal path[-1], dev.port_number, "#{dev.inspect} should have a port number out of the port_path"
173
+ if parent=dev.parent
174
+ assert_kind_of Device, parent, "#{dev.inspect} should have a parent"
175
+ assert_equal path[-2], parent.port_number, "#{dev.inspect} should have a parent port number out of the port_path"
176
+ end
164
177
  end
165
178
  end
166
179
  end
@@ -0,0 +1,36 @@
1
+ # This file is part of Libusb for Ruby.
2
+ #
3
+ # Libusb for Ruby is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # Libusb for Ruby is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with Libusb for Ruby. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require "test/unit"
17
+ require "libusb"
18
+
19
+ class TestLibusbVersion < Test::Unit::TestCase
20
+ def setup
21
+ @v = LIBUSB.version
22
+ end
23
+
24
+ def test_version_parts
25
+ assert_operator @v.major, :>=, 0
26
+ assert_operator @v.minor, :>=, 0
27
+ assert_operator @v.micro, :>=, 0
28
+ assert_operator @v.nano, :>=, 0
29
+ assert_kind_of String, @v.rc
30
+ end
31
+
32
+ def test_version_string
33
+ assert_match(/^\d+\.\d+\.\d+/, @v.to_s)
34
+ assert_match(/^#<LIBUSB::Version \d+\.\d+\.\d+/, @v.inspect)
35
+ end
36
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libusb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: x86-mingw32
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-15 00:00:00.000000000 Z
12
+ date: 2012-06-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
16
- requirement: &11949220 !ruby/object:Gem::Requirement
16
+ requirement: &21755140 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *11949220
24
+ version_requirements: *21755140
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake-compiler
27
- requirement: &11947620 !ruby/object:Gem::Requirement
27
+ requirement: &21777860 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0.6'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *11947620
35
+ version_requirements: *21777860
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hoe
38
- requirement: &11945960 !ruby/object:Gem::Requirement
38
+ requirement: &21777240 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,27 +43,38 @@ dependencies:
43
43
  version: '2.12'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *11945960
47
- description: LIBUSB is a Ruby binding that gives Ruby programmers access to all functionality
48
- of libusb, version 1.0
46
+ version_requirements: *21777240
47
+ description: LIBUSB is a Ruby binding that gives Ruby programmers access to arbitrary
48
+ USB devices
49
49
  email:
50
50
  - kanis@comcard.de
51
51
  executables: []
52
52
  extensions: []
53
53
  extra_rdoc_files:
54
- - History.txt
55
- - Manifest.txt
56
54
  - README.rdoc
57
55
  files:
58
56
  - .autotest
59
57
  - .gemtest
58
+ - .yardopts
60
59
  - COPYING
61
60
  - History.txt
62
61
  - Manifest.txt
63
62
  - README.rdoc
64
63
  - Rakefile
65
64
  - lib/libusb.rb
65
+ - lib/libusb/call.rb
66
66
  - lib/libusb/compat.rb
67
+ - lib/libusb/configuration.rb
68
+ - lib/libusb/constants.rb
69
+ - lib/libusb/context.rb
70
+ - lib/libusb/dev_handle.rb
71
+ - lib/libusb/device.rb
72
+ - lib/libusb/endpoint.rb
73
+ - lib/libusb/interface.rb
74
+ - lib/libusb/setting.rb
75
+ - lib/libusb/transfer.rb
76
+ - lib/libusb/version.rb
77
+ - test/test_libusb_capability.rb
67
78
  - test/test_libusb_compat.rb
68
79
  - test/test_libusb_compat_mass_storage.rb
69
80
  - test/test_libusb_descriptors.rb
@@ -71,7 +82,7 @@ files:
71
82
  - test/test_libusb_iso_transfer.rb
72
83
  - test/test_libusb_mass_storage.rb
73
84
  - test/test_libusb_mass_storage2.rb
74
- - test/test_libusb_keyboard.rb
85
+ - test/test_libusb_version.rb
75
86
  - lib/libusb-1.0.dll
76
87
  homepage: http://github.com/larskanis/libusb
77
88
  licenses: []
@@ -101,11 +112,12 @@ signing_key:
101
112
  specification_version: 3
102
113
  summary: Access USB devices from Ruby via libusb-1.0
103
114
  test_files:
104
- - test/test_libusb_compat_mass_storage.rb
105
- - test/test_libusb_gc.rb
106
- - test/test_libusb_iso_transfer.rb
107
- - test/test_libusb_descriptors.rb
108
115
  - test/test_libusb_compat.rb
109
- - test/test_libusb_keyboard.rb
116
+ - test/test_libusb_iso_transfer.rb
110
117
  - test/test_libusb_mass_storage2.rb
118
+ - test/test_libusb_descriptors.rb
111
119
  - test/test_libusb_mass_storage.rb
120
+ - test/test_libusb_capability.rb
121
+ - test/test_libusb_compat_mass_storage.rb
122
+ - test/test_libusb_version.rb
123
+ - test/test_libusb_gc.rb
@@ -1,50 +0,0 @@
1
- # This test requires a connected, but not mounted mass storage device with
2
- # read/write access allowed. Based on the following specifications:
3
- # http://www.usb.org/developers/devclass_docs/usbmassbulk_10.pdf
4
- # http://en.wikipedia.org/wiki/SCSI_command
5
- #
6
-
7
- require "test/unit"
8
- require "libusb"
9
-
10
- class TestLibusbKeyboard < Test::Unit::TestCase
11
- include LIBUSB
12
-
13
- attr_accessor :usb
14
- attr_accessor :device
15
- attr_accessor :dev
16
- attr_accessor :endpoint_in
17
- attr_accessor :endpoint_out
18
-
19
- def setup
20
- @usb = Context.new
21
- @usb.debug = 3
22
-
23
- @device = usb.devices( :bDeviceClass=>CLASS_HID, :bDeviceProtocol=>1 ).first
24
- abort "no keyboard device found" unless @device
25
-
26
- @endpoint_in = @device.endpoints.find{|ep| ep.bEndpointAddress&ENDPOINT_IN != 0 }.bEndpointAddress
27
- @endpoint_out = @device.endpoints.find{|ep| ep.bEndpointAddress&ENDPOINT_IN == 0 }.bEndpointAddress
28
-
29
- @dev = @device.open
30
-
31
- if RUBY_PLATFORM=~/linux/i && dev.kernel_driver_active?(0)
32
- dev.detach_kernel_driver(0)
33
- end
34
- dev.claim_interface(0)
35
-
36
- # clear any pending data
37
- dev.clear_halt(endpoint_in)
38
- end
39
-
40
- def teardown
41
- dev.release_interface(0) if dev
42
- dev.close if dev
43
- end
44
-
45
- def test_read
46
- data_length = 8
47
- recv = dev.interrupt_transfer(:endpoint=>endpoint_in, :dataIn=>data_length)
48
- p recv
49
- end
50
- end