libusb 0.6.3-x64-mingw32 → 0.7.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,4 +34,19 @@ class TestLibusbGc < Minitest::Test
34
34
  GC.start
35
35
  assert_equal ps, ep.wMaxPacketSize, "GC should not free EndpointDescriptor"
36
36
  end
37
+
38
+ def test_log_cb
39
+ LIBUSB.set_options OPTION_LOG_CB: proc{}, OPTION_LOG_LEVEL: LIBUSB::LOG_LEVEL_DEBUG
40
+
41
+ c = LIBUSB::Context.new OPTION_LOG_CB: proc{}, OPTION_NO_DEVICE_DISCOVERY: nil
42
+ GC.start
43
+ c.devices
44
+ c.set_log_cb(LIBUSB::LOG_CB_CONTEXT){}
45
+ c.devices
46
+ GC.start
47
+ c.devices
48
+
49
+ ensure
50
+ LIBUSB.set_options OPTION_LOG_CB: [nil], OPTION_LOG_LEVEL: LIBUSB::LOG_LEVEL_NONE
51
+ end
37
52
  end
@@ -26,7 +26,9 @@ class TestLibusbHotplug < Minitest::Test
26
26
  end
27
27
 
28
28
  def teardown
29
- @ctx.exit
29
+ # No need to release the LIBUSB::Context any longer.
30
+ # It is cleaned up by the GC.
31
+ # @ctx.exit
30
32
  end
31
33
 
32
34
  def test_enumerate
@@ -47,4 +47,10 @@ class TestLibusbIsoTransfer < Minitest::Test
47
47
  tr.submit!
48
48
  end
49
49
  end
50
+
51
+ def test_max_alt_packet_size
52
+ d = Context.new.devices[0]
53
+ size = d.max_alt_packet_size d.interfaces[0], d.settings[0], d.endpoints[0]
54
+ assert_operator 0, :<=, size
55
+ end
50
56
  end
@@ -61,7 +61,7 @@ class TestLibusbMassStorage < Minitest::Test
61
61
  dev.close if dev
62
62
  end
63
63
 
64
- def do_transfer(method, args)
64
+ def do_transfer(method, **args)
65
65
  if @asynchron
66
66
  stop = false
67
67
  transfer = dev.send(method, args) do |tr|
@@ -78,14 +78,14 @@ class TestLibusbMassStorage < Minitest::Test
78
78
  end
79
79
  transfer.result
80
80
  else
81
- dev.send(method, args)
81
+ dev.send(method, **args)
82
82
  end
83
83
  end
84
- def control_transfer(args)
85
- do_transfer(:control_transfer, args)
84
+ def control_transfer(**args)
85
+ do_transfer(:control_transfer, **args)
86
86
  end
87
- def bulk_transfer(args)
88
- do_transfer(:bulk_transfer, args)
87
+ def bulk_transfer(**args)
88
+ do_transfer(:bulk_transfer, **args)
89
89
  end
90
90
 
91
91
  def send_mass_storage_command(cdb, data_length, direction=ENDPOINT_IN)
@@ -43,16 +43,45 @@ class TestLibusbStructs < Minitest::Test
43
43
  assert_equal 0, s[:completed]
44
44
  end
45
45
 
46
- def test_Transfer
46
+ def test_Transfer_buffer
47
47
  t = LIBUSB::InterruptTransfer.new allow_device_memory: true
48
48
  assert_equal :TRANSFER_COMPLETED, t.status
49
49
  assert_equal true, t.allow_device_memory
50
- assert_equal nil, t.memory_type
50
+ assert_nil t.memory_type
51
51
 
52
52
  t.alloc_buffer(10)
53
53
  assert_equal :user_space, t.memory_type, "no device assigned -> should use memory from user space"
54
54
 
55
55
  t.free_buffer
56
- assert_equal nil, t.memory_type
56
+ assert_nil t.memory_type
57
+ end
58
+
59
+ def test_Transfer_new
60
+ assert_raises(NoMethodError){ LIBUSB::Transfer.new }
61
+ LIBUSB::BulkStreamTransfer.new
62
+ LIBUSB::BulkTransfer.new
63
+ LIBUSB::ControlTransfer.new
64
+ LIBUSB::InterruptTransfer.new
65
+ LIBUSB::IsochronousTransfer.new(0)
66
+ end
67
+
68
+ def test_ControlTransfer_attributes
69
+ t = LIBUSB::ControlTransfer.new
70
+ t.timeout = 123
71
+ assert_equal 123, t.timeout
72
+ t.allow_device_memory = true
73
+ assert_equal true, t.allow_device_memory
74
+ assert_nil t.dev_handle
75
+ end
76
+
77
+ def test_ControlTransfer_new_args
78
+ t = LIBUSB::ControlTransfer.new allow_device_memory: false, timeout: 444
79
+ assert_equal false, t.allow_device_memory
80
+ assert_equal 444, t.timeout
81
+ end
82
+
83
+ def test_Transfer_no_dev_handle
84
+ t = LIBUSB::ControlTransfer.new
85
+ assert_raises(ArgumentError){ t.submit_and_wait }
57
86
  end
58
87
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libusb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.7.0
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Lars Kanis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-20 00:00:00.000000000 Z
11
+ date: 2024-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -24,48 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake-compiler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake-compiler-dock
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '0.2'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '0.2'
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.0'
69
27
  description: LIBUSB is a Ruby binding that gives Ruby programmers access to arbitrary
70
28
  USB devices
71
29
  email:
@@ -74,6 +32,8 @@ executables: []
74
32
  extensions: []
75
33
  extra_rdoc_files: []
76
34
  files:
35
+ - ".appveyor.yml"
36
+ - ".github/workflows/ci.yml"
77
37
  - ".gitignore"
78
38
  - ".travis.yml"
79
39
  - ".yardopts"
@@ -82,7 +42,6 @@ files:
82
42
  - History.md
83
43
  - README.md
84
44
  - Rakefile
85
- - appveyor.yml
86
45
  - lib/libusb-1.0.dll
87
46
  - lib/libusb.rb
88
47
  - lib/libusb/bos.rb
@@ -91,6 +50,7 @@ files:
91
50
  - lib/libusb/configuration.rb
92
51
  - lib/libusb/constants.rb
93
52
  - lib/libusb/context.rb
53
+ - lib/libusb/context_reference.rb
94
54
  - lib/libusb/dependencies.rb
95
55
  - lib/libusb/dev_handle.rb
96
56
  - lib/libusb/device.rb
@@ -106,11 +66,12 @@ files:
106
66
  - lib/libusb/version_gem.rb
107
67
  - lib/libusb/version_struct.rb
108
68
  - libusb.gemspec
69
+ - test/test_libusb.rb
109
70
  - test/test_libusb_bos.rb
110
71
  - test/test_libusb_bulk_stream_transfer.rb
111
- - test/test_libusb_capability.rb
112
72
  - test/test_libusb_compat.rb
113
73
  - test/test_libusb_compat_mass_storage.rb
74
+ - test/test_libusb_context.rb
114
75
  - test/test_libusb_descriptors.rb
115
76
  - test/test_libusb_event_machine.rb
116
77
  - test/test_libusb_gc.rb
@@ -120,12 +81,12 @@ files:
120
81
  - test/test_libusb_mass_storage2.rb
121
82
  - test/test_libusb_structs.rb
122
83
  - test/test_libusb_threads.rb
123
- - test/test_libusb_version.rb
124
84
  - wireshark-usb-sniffer.png
125
85
  homepage: http://github.com/larskanis/libusb
126
86
  licenses:
127
87
  - LGPL-3.0
128
- metadata: {}
88
+ metadata:
89
+ yard.run: yri
129
90
  post_install_message:
130
91
  rdoc_options:
131
92
  - "--main"
@@ -137,15 +98,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
98
  requirements:
138
99
  - - ">="
139
100
  - !ruby/object:Gem::Version
140
- version: 1.9.3
101
+ version: 2.5.0
141
102
  required_rubygems_version: !ruby/object:Gem::Requirement
142
103
  requirements:
143
104
  - - ">="
144
105
  - !ruby/object:Gem::Version
145
106
  version: '0'
146
107
  requirements: []
147
- rubyforge_project:
148
- rubygems_version: 2.6.12
108
+ rubygems_version: 3.3.26
149
109
  signing_key:
150
110
  specification_version: 4
151
111
  summary: Access USB devices from Ruby via libusb-1.0
data/appveyor.yml DELETED
@@ -1,37 +0,0 @@
1
- init:
2
- - SET PATH=C:/Ruby%ruby_version%/bin;%PATH%
3
- - SET RAKEOPT=-rdevkit
4
- install:
5
- - ruby --version
6
- - gem --version
7
- - ps: |
8
- if ($env:BROKEN_SSL -eq "true") {
9
- $(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt', "$env:TMP/ca-bundle.crt")
10
- $env:SSL_CERT_FILE = "$env:TMP/ca-bundle.crt"
11
- Write-Host "Using SSL CA list $env:SSL_CERT_FILE" -foreground Green
12
- }
13
- - bundle install
14
- build_script:
15
- - bundle exec rake compile
16
- test_script:
17
- - bundle exec rake travis
18
- environment:
19
- matrix:
20
- - ruby_version: "24-x64"
21
- - ruby_version: "200"
22
- BROKEN_SSL: true
23
- - ruby_version: "200-x64"
24
- BROKEN_SSL: true
25
- - ruby_version: "21"
26
- BROKEN_SSL: true
27
- - ruby_version: "21-x64"
28
- BROKEN_SSL: true
29
- - ruby_version: "22"
30
- BROKEN_SSL: true
31
- - ruby_version: "22-x64"
32
- BROKEN_SSL: true
33
- - ruby_version: "23"
34
- BROKEN_SSL: true
35
- - ruby_version: "23-x64"
36
- BROKEN_SSL: true
37
- - ruby_version: "24"