libusb 0.1.0-x86-mingw32 → 0.1.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,8 @@
1
- === 0.1.0 / 2011-04-xx
1
+ === 0.1.1 / 2011-12-09
2
+
3
+ * avoid ffi calls with :blocking=>true, als long as it isn't stable on win32
4
+
5
+ === 0.1.0 / 2011-10-01
2
6
 
3
7
  * add test suite based on mass storage devices
4
8
  * usable async transfers
@@ -3,7 +3,7 @@
3
3
  = Access USB devices from Ruby via libusb-1.0.
4
4
 
5
5
  * http://github.com/larskanis/libusb
6
- * API documentation: http://libusb.rubyforge.org/libusb
6
+ * API documentation: http://rubydoc.info/gems/libusb/frames
7
7
 
8
8
  == DESCRIPTION:
9
9
 
@@ -84,7 +84,7 @@ with it's INI-file and use it for driver installation on other 32 or 64 bit Wind
84
84
  systems.
85
85
 
86
86
 
87
- == Cross compiling for mswin32
87
+ == Cross compiling for Windows
88
88
 
89
89
  Libusb-gem can be build on a linux or darwin host for the win32 platform,
90
90
  using the mingw cross compiler collection. Libusb is downloaded from source
@@ -102,7 +102,7 @@ Download and cross compile libusb for win32:
102
102
 
103
103
  rake cross gem
104
104
 
105
- If everything works, there should be libusb-VERSION-x86-mswin32.gem in the pkg
105
+ If everything works, there should be libusb-VERSION-x86-mingw32.gem in the pkg
106
106
  directory.
107
107
 
108
108
  == Todo
data/Rakefile CHANGED
@@ -25,7 +25,7 @@ STATIC_BUILDDIR = COMPILE_HOME + 'builds'
25
25
  # LIBUSB_TARBALL = STATIC_SOURCESDIR + "libusb-#{LIBUSB_VERSION}.tar.bz2"
26
26
 
27
27
  # Fetch tarball from Pete Batard's git repo
28
- LIBUSB_VERSION = ENV['LIBUSB_VERSION'] || '52a0e18'
28
+ LIBUSB_VERSION = ENV['LIBUSB_VERSION'] || '4cc72d0'
29
29
  LIBUSB_SOURCE_URI = URI( "http://git.libusb.org/?p=libusb-pbatard.git;a=snapshot;h=#{LIBUSB_VERSION};sf=tbz2" )
30
30
  LIBUSB_TARBALL = STATIC_SOURCESDIR + "libusb-pbatard-#{LIBUSB_VERSION}.tar.bz2"
31
31
 
Binary file
@@ -18,7 +18,7 @@ require 'ffi'
18
18
 
19
19
 
20
20
  module LIBUSB
21
- VERSION = "0.1.0"
21
+ VERSION = "0.1.1"
22
22
 
23
23
  module Call
24
24
  extend FFI::Library
@@ -186,7 +186,7 @@ module LIBUSB
186
186
  attach_function 'libusb_cancel_transfer', [:pointer], :int
187
187
  attach_function 'libusb_free_transfer', [:pointer], :void
188
188
 
189
- attach_function 'libusb_handle_events', [:libusb_context], :int, :blocking=>true
189
+ attach_function 'libusb_handle_events', [:libusb_context], :int
190
190
 
191
191
 
192
192
  callback :libusb_transfer_cb_fn, [:pointer], :void
@@ -959,10 +959,8 @@ module LIBUSB
959
959
 
960
960
  def initialize context, pDev
961
961
  @context = context
962
- class << pDev
963
- def unref_device(id)
964
- Call.libusb_unref_device(self)
965
- end
962
+ def pDev.unref_device(id)
963
+ Call.libusb_unref_device(self)
966
964
  end
967
965
  ObjectSpace.define_finalizer(self, pDev.method(:unref_device))
968
966
  Call.libusb_ref_device(pDev)
@@ -0,0 +1,50 @@
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
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.0
4
+ version: 0.1.1
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: 2011-10-01 00:00:00.000000000Z
12
+ date: 2011-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
16
- requirement: &17168580 !ruby/object:Gem::Requirement
16
+ requirement: &20041800 !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: *17168580
24
+ version_requirements: *20041800
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake-compiler
27
- requirement: &17166840 !ruby/object:Gem::Requirement
27
+ requirement: &20040960 !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: *17166840
35
+ version_requirements: *20040960
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hoe
38
- requirement: &17165380 !ruby/object:Gem::Requirement
38
+ requirement: &20040440 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '2.12'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *17165380
46
+ version_requirements: *20040440
47
47
  description: LIBUSB is a Ruby binding that gives Ruby programmers access to all functionality
48
48
  of libusb, version 1.0
49
49
  email:
@@ -70,6 +70,7 @@ files:
70
70
  - test/test_libusb_gc.rb
71
71
  - test/test_libusb_iso_transfer.rb
72
72
  - test/test_libusb_mass_storage.rb
73
+ - test/test_libusb_keyboard.rb
73
74
  - lib/libusb-1.0.dll
74
75
  homepage: http://github.com/larskanis/libusb
75
76
  licenses: []
@@ -94,14 +95,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
95
  version: '0'
95
96
  requirements: []
96
97
  rubyforge_project: libusb
97
- rubygems_version: 1.8.6
98
+ rubygems_version: 1.8.10
98
99
  signing_key:
99
100
  specification_version: 3
100
101
  summary: Access USB devices from Ruby via libusb-1.0
101
102
  test_files:
102
- - test/test_libusb_compat.rb
103
+ - test/test_libusb_compat_mass_storage.rb
104
+ - test/test_libusb_gc.rb
103
105
  - test/test_libusb_iso_transfer.rb
104
106
  - test/test_libusb_descriptors.rb
107
+ - test/test_libusb_compat.rb
108
+ - test/test_libusb_keyboard.rb
105
109
  - test/test_libusb_mass_storage.rb
106
- - test/test_libusb_compat_mass_storage.rb
107
- - test/test_libusb_gc.rb