libusb 0.2.1-x86-mingw32 → 0.2.2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ === 0.2.2 / 2012-10-19
2
+
3
+ * Add method Interface#bInterfaceNumber
4
+ * Fix methods (#claim_interface, #detach_kernel_driver) with Interface-type parameter
5
+ * update to libusbx-1.0.14 for windows build
6
+
1
7
  === 0.2.1 / 2012-09-25
2
8
 
3
9
  * Rename Configuration#maxPower to #bMaxPower as done in libusbx-1.0.13 and in ruby-usb.gem
@@ -39,7 +39,7 @@ by using the device descriptor attributes.
39
39
  A {LIBUSB::Device} could have several configurations. You can then decide of which
40
40
  configuration to enable. You can only enable one configuration at a time.
41
41
 
42
- Each {LIBUSB::Configuration} has one or more interfaces. This can be seen as functional group
42
+ Each {LIBUSB::Configuration} has one or more interfaces. These can be seen as functional group
43
43
  performing a single feature of the device.
44
44
 
45
45
  Each {LIBUSB::Interface} has at least one {LIBUSB::Setting}. The first setting is always default.
@@ -60,7 +60,7 @@ maximum packet size.
60
60
 
61
61
  In order to use LIBUSB, you also need the libusb-1.0[http://libusbx.org] library (but not necessarily its header files).
62
62
  * Debian or Ubuntu:
63
- sudo apt-get install libusb-1.0-0
63
+ sudo apt-get install libusb-1.0-0-dev
64
64
  * OS-X: install with homebrew:
65
65
  brew install libusb
66
66
  or macports:
@@ -77,7 +77,7 @@ Latest code can be used in this way:
77
77
 
78
78
  In contrast to Linux, any access to an USB device by LIBUSB on Windows requires a proper driver
79
79
  installed in the system. Fortunately creating such a driver is quite easy with
80
- Zadig[http://sourceforge.net/apps/mediawiki/libwdi/index.php?title=Main_Page]. Select the interesting USB device,
80
+ Zadig[http://sourceforge.net/projects/libwdi/files/zadig/]. Select the interesting USB device,
81
81
  choose WinUSB driver and press "Install Driver". That's it. You may take the generated output directory
82
82
  with it's INI-file and use it for driver installation on other 32 or 64 bit Windows
83
83
  systems.
data/Rakefile CHANGED
@@ -32,7 +32,7 @@ end
32
32
  # LIBUSB_TARBALL = STATIC_SOURCESDIR + "libusb-#{LIBUSB_VERSION}.tar.bz2"
33
33
 
34
34
  # Fetch tarball from libusbx
35
- LIBUSB_VERSION = ENV['LIBUSB_VERSION'] || '1.0.13'
35
+ LIBUSB_VERSION = ENV['LIBUSB_VERSION'] || '1.0.14'
36
36
  LIBUSB_SOURCE_URI = URI( "http://downloads.sourceforge.net/project/libusbx/releases/#{LIBUSB_VERSION[/^\d+\.\d+\.\d+/]}/source/libusbx-#{LIBUSB_VERSION}.tar.bz2" )
37
37
  LIBUSB_TARBALL = STATIC_SOURCESDIR + File.basename( LIBUSB_SOURCE_URI.path )
38
38
 
Binary file
@@ -14,7 +14,7 @@
14
14
  # along with Libusb for Ruby. If not, see <http://www.gnu.org/licenses/>.
15
15
 
16
16
  module LIBUSB
17
- VERSION = "0.2.1"
17
+ VERSION = "0.2.2"
18
18
 
19
19
  require 'libusb/call'
20
20
  require 'libusb/constants'
@@ -22,6 +22,11 @@ module LIBUSB
22
22
  layout :altsetting, :pointer,
23
23
  :num_altsetting, :int
24
24
 
25
+ # Number of this interface.
26
+ def bInterfaceNumber
27
+ settings.first.bInterfaceNumber
28
+ end
29
+
25
30
  def initialize(configuration, *args)
26
31
  @configuration = configuration
27
32
  super(*args)
@@ -39,6 +44,10 @@ module LIBUSB
39
44
  end
40
45
  alias settings alt_settings
41
46
 
47
+ def inspect
48
+ "\#<#{self.class} #{bInterfaceNumber}>"
49
+ end
50
+
42
51
  # The {Device} this Interface belongs to.
43
52
  def device() self.configuration.device end
44
53
  # Return all endpoints of all alternative settings as Array of {Endpoint}s.
@@ -42,7 +42,7 @@ module LIBUSB
42
42
  self[:bDescriptorType]
43
43
  end
44
44
 
45
- # Number of this interface.
45
+ # Number of the interface this setting belongs to.
46
46
  def bInterfaceNumber
47
47
  self[:bInterfaceNumber]
48
48
  end
@@ -22,6 +22,7 @@ class TestLibusbMassStorage2 < Test::Unit::TestCase
22
22
 
23
23
  attr_accessor :usb
24
24
  attr_accessor :device
25
+ attr_accessor :interface
25
26
 
26
27
  def setup
27
28
  @usb = Context.new
@@ -29,10 +30,13 @@ class TestLibusbMassStorage2 < Test::Unit::TestCase
29
30
  @device = usb.devices( :bClass=>CLASS_MASS_STORAGE, :bSubClass=>[0x06,0x01], :bProtocol=>0x50 ).last
30
31
  abort "no mass storage device found" unless @device
31
32
 
33
+ @interface = device.interfaces.first
34
+
32
35
  # Ensure kernel driver is detached
33
36
  device.open do |dev|
34
- if RUBY_PLATFORM=~/linux/i && dev.kernel_driver_active?(0)
35
- dev.detach_kernel_driver(0)
37
+ if RUBY_PLATFORM=~/linux/i && dev.kernel_driver_active?(interface)
38
+ assert dev.kernel_driver_active?(0), "DevHandle#kernel_driver_active? may be called with an Interface instance or a Fixnum"
39
+ dev.detach_kernel_driver(interface)
36
40
  end
37
41
  end
38
42
  end
@@ -49,7 +53,7 @@ class TestLibusbMassStorage2 < Test::Unit::TestCase
49
53
 
50
54
  def test_claim_interface_with_block
51
55
  res = device.open do |dev|
52
- dev.claim_interface(0) do |dev2|
56
+ dev.claim_interface(interface) do |dev2|
53
57
  assert_kind_of DevHandle, dev2
54
58
  assert_kind_of String, dev2.string_descriptor_ascii(1)
55
59
  12345
@@ -59,7 +63,7 @@ class TestLibusbMassStorage2 < Test::Unit::TestCase
59
63
  end
60
64
 
61
65
  def test_open_interface
62
- res = device.open_interface(0) do |dev|
66
+ res = device.open_interface(interface) do |dev|
63
67
  assert_kind_of DevHandle, dev
64
68
  assert_kind_of String, dev.string_descriptor_ascii(1)
65
69
  12345
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.2.1
4
+ version: 0.2.2
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-09-25 00:00:00.000000000 Z
12
+ date: 2012-10-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
16
- requirement: &11618720 !ruby/object:Gem::Requirement
16
+ requirement: &20360580 !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: *11618720
24
+ version_requirements: *20360580
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &11618240 !ruby/object:Gem::Requirement
27
+ requirement: &20359940 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.10'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *11618240
35
+ version_requirements: *20359940
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake-compiler
38
- requirement: &11617760 !ruby/object:Gem::Requirement
38
+ requirement: &20359420 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0.6'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *11617760
46
+ version_requirements: *20359420
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: hoe
49
- requirement: &11617280 !ruby/object:Gem::Requirement
49
+ requirement: &20358840 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '3.0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *11617280
57
+ version_requirements: *20358840
58
58
  description: LIBUSB is a Ruby binding that gives Ruby programmers access to arbitrary
59
59
  USB devices
60
60
  email:
@@ -124,13 +124,13 @@ signing_key:
124
124
  specification_version: 3
125
125
  summary: Access USB devices from Ruby via libusb-1.0
126
126
  test_files:
127
- - test/test_libusb_compat_mass_storage.rb
127
+ - test/test_libusb_keyboard.rb
128
128
  - test/test_libusb_gc.rb
129
- - test/test_libusb_iso_transfer.rb
129
+ - test/test_libusb_mass_storage2.rb
130
130
  - test/test_libusb_capability.rb
131
- - test/test_libusb_descriptors.rb
131
+ - test/test_libusb_iso_transfer.rb
132
+ - test/test_libusb_mass_storage.rb
132
133
  - test/test_libusb_compat.rb
133
- - test/test_libusb_keyboard.rb
134
- - test/test_libusb_mass_storage2.rb
134
+ - test/test_libusb_compat_mass_storage.rb
135
135
  - test/test_libusb_version.rb
136
- - test/test_libusb_mass_storage.rb
136
+ - test/test_libusb_descriptors.rb