libusb 0.2.2-x86-mingw32 → 0.3.0-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +8 -0
- data/.travis.yml +10 -0
- data/.yardopts +6 -1
- data/Gemfile +16 -0
- data/{History.txt → History.md} +28 -16
- data/README.md +144 -0
- data/Rakefile +28 -24
- data/ext/extconf.rb +33 -0
- data/lib/libusb.rb +2 -3
- data/lib/libusb/call.rb +49 -7
- data/lib/libusb/compat.rb +15 -9
- data/lib/libusb/configuration.rb +15 -3
- data/lib/libusb/constants.rb +19 -6
- data/lib/libusb/context.rb +181 -3
- data/lib/libusb/dev_handle.rb +91 -40
- data/lib/libusb/endpoint.rb +41 -14
- data/lib/libusb/eventmachine.rb +183 -0
- data/lib/libusb/transfer.rb +21 -8
- data/lib/libusb/version_gem.rb +19 -0
- data/lib/libusb/{version.rb → version_struct.rb} +0 -0
- data/libusb.gemspec +31 -0
- data/test/test_libusb_compat.rb +1 -1
- data/test/test_libusb_compat_mass_storage.rb +2 -2
- data/test/test_libusb_descriptors.rb +1 -1
- data/test/test_libusb_event_machine.rb +118 -0
- data/test/test_libusb_iso_transfer.rb +6 -1
- data/test/test_libusb_mass_storage.rb +9 -3
- data/test/test_libusb_mass_storage2.rb +1 -1
- data/test/test_libusb_structs.rb +45 -0
- data/test/test_libusb_threads.rb +89 -0
- data/test/test_libusb_version.rb +4 -0
- metadata +44 -44
- data/.autotest +0 -23
- data/.gemtest +0 -0
- data/Manifest.txt +0 -3
- data/README.rdoc +0 -115
- data/test/test_libusb_keyboard.rb +0 -50
@@ -21,7 +21,12 @@ class TestLibusbIsoTransfer < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
def setup
|
23
23
|
c = Context.new
|
24
|
-
|
24
|
+
begin
|
25
|
+
@dev = c.devices.first.open
|
26
|
+
rescue LIBUSB::ERROR_ACCESS
|
27
|
+
@dev = nil
|
28
|
+
skip "error opening device"
|
29
|
+
end
|
25
30
|
end
|
26
31
|
|
27
32
|
def teardown
|
@@ -41,7 +41,7 @@ class TestLibusbMassStorage < Test::Unit::TestCase
|
|
41
41
|
@asynchron = false
|
42
42
|
|
43
43
|
@device = usb.devices( :bClass=>CLASS_MASS_STORAGE, :bSubClass=>[0x06,0x01], :bProtocol=>0x50 ).last
|
44
|
-
|
44
|
+
skip "no mass storage device found" unless @device
|
45
45
|
|
46
46
|
@endpoint_in = @device.endpoints.find{|ep| ep.bEndpointAddress&ENDPOINT_IN != 0 }
|
47
47
|
@endpoint_out = @device.endpoints.find{|ep| ep.bEndpointAddress&ENDPOINT_IN == 0 }
|
@@ -215,9 +215,15 @@ class TestLibusbMassStorage < Test::Unit::TestCase
|
|
215
215
|
sleep 0.01
|
216
216
|
end
|
217
217
|
end
|
218
|
-
assert_raise(
|
219
|
-
|
218
|
+
assert_raise(LIBUSB::ERROR_TIMEOUT) do
|
219
|
+
begin
|
220
|
+
bulk_transfer(:endpoint=>endpoint_in, :dataIn=>123)
|
221
|
+
rescue LIBUSB::ERROR_TIMEOUT => err
|
222
|
+
assert_kind_of String, err.transferred
|
223
|
+
raise
|
224
|
+
end
|
220
225
|
end
|
226
|
+
|
221
227
|
th.kill
|
222
228
|
dev.clear_halt(endpoint_in)
|
223
229
|
dev.clear_halt(endpoint_out)
|
@@ -28,7 +28,7 @@ class TestLibusbMassStorage2 < Test::Unit::TestCase
|
|
28
28
|
@usb = Context.new
|
29
29
|
@usb.debug = 3
|
30
30
|
@device = usb.devices( :bClass=>CLASS_MASS_STORAGE, :bSubClass=>[0x06,0x01], :bProtocol=>0x50 ).last
|
31
|
-
|
31
|
+
skip "no mass storage device found" unless @device
|
32
32
|
|
33
33
|
@interface = device.interfaces.first
|
34
34
|
|
@@ -0,0 +1,45 @@
|
|
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 TestLibusbStructs < Test::Unit::TestCase
|
20
|
+
def test_struct_Timeval
|
21
|
+
s = LIBUSB::Call::Timeval.new
|
22
|
+
assert_equal 0, s.in_ms
|
23
|
+
s.in_ms = 12345678
|
24
|
+
assert_equal 12345, s[:tv_sec]
|
25
|
+
assert_equal 678000, s[:tv_usec]
|
26
|
+
assert_equal 12345678, s.in_ms
|
27
|
+
|
28
|
+
s.in_s = 1234.5678
|
29
|
+
assert_equal 1234, s[:tv_sec]
|
30
|
+
assert_equal 567800, s[:tv_usec]
|
31
|
+
assert_equal 1234.5678, s.in_s
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_struct_CompletionFlag
|
35
|
+
s = LIBUSB::Context::CompletionFlag.new
|
36
|
+
assert_equal 0, s[:completed]
|
37
|
+
assert_equal false, s.completed?
|
38
|
+
s.completed = true
|
39
|
+
assert_equal 1, s[:completed]
|
40
|
+
assert_equal true, s.completed?
|
41
|
+
s.completed = false
|
42
|
+
assert_equal false, s.completed?
|
43
|
+
assert_equal 0, s[:completed]
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,89 @@
|
|
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
|
+
# This test requires two connected, but not mounted mass storage device with
|
17
|
+
# read/write access allowed.
|
18
|
+
|
19
|
+
require "test/unit"
|
20
|
+
require "libusb"
|
21
|
+
|
22
|
+
class TestLibusbThreads < Test::Unit::TestCase
|
23
|
+
include LIBUSB
|
24
|
+
|
25
|
+
BOMS_GET_MAX_LUN = 0xFE
|
26
|
+
|
27
|
+
attr_accessor :usb
|
28
|
+
attr_accessor :devices
|
29
|
+
attr_accessor :devs
|
30
|
+
attr_accessor :endpoints_in
|
31
|
+
attr_accessor :endpoints_out
|
32
|
+
|
33
|
+
def setup
|
34
|
+
@usb = Context.new
|
35
|
+
@usb.debug = 3
|
36
|
+
|
37
|
+
@devices = usb.devices( :bClass=>CLASS_MASS_STORAGE, :bSubClass=>[0x06,0x01], :bProtocol=>0x50 )
|
38
|
+
skip "less than two mass storage devices found" unless @devices.length >= 2
|
39
|
+
|
40
|
+
@devs = @devices.map do |device|
|
41
|
+
dev = device.open
|
42
|
+
if RUBY_PLATFORM=~/linux/i && dev.kernel_driver_active?(0)
|
43
|
+
dev.detach_kernel_driver(0)
|
44
|
+
end
|
45
|
+
dev.claim_interface(0)
|
46
|
+
dev
|
47
|
+
end
|
48
|
+
|
49
|
+
@endpoints_in = {}
|
50
|
+
@endpoints_out = {}
|
51
|
+
|
52
|
+
@devs.each do |dev|
|
53
|
+
@endpoints_in[dev] = dev.device.endpoints.find{|ep| ep.bEndpointAddress&ENDPOINT_IN != 0 }
|
54
|
+
@endpoints_out[dev] = dev.device.endpoints.find{|ep| ep.bEndpointAddress&ENDPOINT_IN == 0 }
|
55
|
+
end
|
56
|
+
|
57
|
+
Thread.abort_on_exception = true
|
58
|
+
end
|
59
|
+
|
60
|
+
def teardown
|
61
|
+
if devs
|
62
|
+
devs.each do |dev|
|
63
|
+
dev.release_interface(0)
|
64
|
+
dev.close
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def thread_worker(dev)
|
70
|
+
endpoint = endpoints_in[dev]
|
71
|
+
1.times do
|
72
|
+
st = Time.now
|
73
|
+
assert_raise LIBUSB::ERROR_TIMEOUT do
|
74
|
+
dev.bulk_transfer(:endpoint=>endpoint, :dataIn=>123, :timeout=>100)
|
75
|
+
end
|
76
|
+
assert_operator Time.now-st, :<, 5
|
77
|
+
dev.clear_halt(endpoint)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_sync_api
|
82
|
+
threads = devs.map do |dev|
|
83
|
+
Thread.new do
|
84
|
+
thread_worker(dev)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
threads.map(&:join)
|
88
|
+
end
|
89
|
+
end
|
data/test/test_libusb_version.rb
CHANGED
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.
|
4
|
+
version: 0.3.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:
|
12
|
+
date: 2013-01-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,21 +21,15 @@ dependencies:
|
|
21
21
|
version: '1.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: rdoc
|
27
|
-
requirement: &20359940 !ruby/object:Gem::Requirement
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
25
|
none: false
|
29
26
|
requirements:
|
30
|
-
- -
|
27
|
+
- - ! '>='
|
31
28
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
33
|
-
type: :development
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: *20359940
|
29
|
+
version: '1.0'
|
36
30
|
- !ruby/object:Gem::Dependency
|
37
31
|
name: rake-compiler
|
38
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
39
33
|
none: false
|
40
34
|
requirements:
|
41
35
|
- - ! '>='
|
@@ -43,35 +37,46 @@ dependencies:
|
|
43
37
|
version: '0.6'
|
44
38
|
type: :development
|
45
39
|
prerelease: false
|
46
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0.6'
|
47
46
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement:
|
47
|
+
name: bundler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
50
49
|
none: false
|
51
50
|
requirements:
|
52
|
-
- -
|
51
|
+
- - ! '>='
|
53
52
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
53
|
+
version: '0'
|
55
54
|
type: :development
|
56
55
|
prerelease: false
|
57
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
58
62
|
description: LIBUSB is a Ruby binding that gives Ruby programmers access to arbitrary
|
59
63
|
USB devices
|
60
64
|
email:
|
61
|
-
-
|
65
|
+
- lars@greiz-reinsdorf.de
|
62
66
|
executables: []
|
63
|
-
extensions:
|
64
|
-
|
65
|
-
|
67
|
+
extensions:
|
68
|
+
- ext/extconf.rb
|
69
|
+
extra_rdoc_files: []
|
66
70
|
files:
|
67
|
-
- .
|
68
|
-
- .
|
71
|
+
- .gitignore
|
72
|
+
- .travis.yml
|
69
73
|
- .yardopts
|
70
74
|
- COPYING
|
71
|
-
-
|
72
|
-
-
|
73
|
-
- README.
|
75
|
+
- Gemfile
|
76
|
+
- History.md
|
77
|
+
- README.md
|
74
78
|
- Rakefile
|
79
|
+
- ext/extconf.rb
|
75
80
|
- lib/libusb.rb
|
76
81
|
- lib/libusb/call.rb
|
77
82
|
- lib/libusb/compat.rb
|
@@ -81,27 +86,32 @@ files:
|
|
81
86
|
- lib/libusb/dev_handle.rb
|
82
87
|
- lib/libusb/device.rb
|
83
88
|
- lib/libusb/endpoint.rb
|
89
|
+
- lib/libusb/eventmachine.rb
|
84
90
|
- lib/libusb/interface.rb
|
85
91
|
- lib/libusb/setting.rb
|
86
92
|
- lib/libusb/transfer.rb
|
87
|
-
- lib/libusb/
|
93
|
+
- lib/libusb/version_gem.rb
|
94
|
+
- lib/libusb/version_struct.rb
|
95
|
+
- libusb.gemspec
|
88
96
|
- test/test_libusb_capability.rb
|
89
97
|
- test/test_libusb_compat.rb
|
90
98
|
- test/test_libusb_compat_mass_storage.rb
|
91
99
|
- test/test_libusb_descriptors.rb
|
100
|
+
- test/test_libusb_event_machine.rb
|
92
101
|
- test/test_libusb_gc.rb
|
93
102
|
- test/test_libusb_iso_transfer.rb
|
94
103
|
- test/test_libusb_mass_storage.rb
|
95
104
|
- test/test_libusb_mass_storage2.rb
|
105
|
+
- test/test_libusb_structs.rb
|
106
|
+
- test/test_libusb_threads.rb
|
96
107
|
- test/test_libusb_version.rb
|
97
|
-
- test/test_libusb_keyboard.rb
|
98
108
|
- lib/libusb-1.0.dll
|
99
|
-
homepage:
|
109
|
+
homepage: http://github.com/larskanis/libusb
|
100
110
|
licenses: []
|
101
111
|
post_install_message:
|
102
112
|
rdoc_options:
|
103
113
|
- --main
|
104
|
-
- README.
|
114
|
+
- README.md
|
105
115
|
- --charset=UTF-8
|
106
116
|
require_paths:
|
107
117
|
- lib
|
@@ -119,18 +129,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
129
|
version: '0'
|
120
130
|
requirements: []
|
121
131
|
rubyforge_project: libusb
|
122
|
-
rubygems_version: 1.8.
|
132
|
+
rubygems_version: 1.8.24
|
123
133
|
signing_key:
|
124
134
|
specification_version: 3
|
125
135
|
summary: Access USB devices from Ruby via libusb-1.0
|
126
|
-
test_files:
|
127
|
-
- test/test_libusb_keyboard.rb
|
128
|
-
- test/test_libusb_gc.rb
|
129
|
-
- test/test_libusb_mass_storage2.rb
|
130
|
-
- test/test_libusb_capability.rb
|
131
|
-
- test/test_libusb_iso_transfer.rb
|
132
|
-
- test/test_libusb_mass_storage.rb
|
133
|
-
- test/test_libusb_compat.rb
|
134
|
-
- test/test_libusb_compat_mass_storage.rb
|
135
|
-
- test/test_libusb_version.rb
|
136
|
-
- test/test_libusb_descriptors.rb
|
136
|
+
test_files: []
|
data/.autotest
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
|
-
require 'autotest/restart'
|
4
|
-
|
5
|
-
# Autotest.add_hook :initialize do |at|
|
6
|
-
# at.extra_files << "../some/external/dependency.rb"
|
7
|
-
#
|
8
|
-
# at.libs << ":../some/external"
|
9
|
-
#
|
10
|
-
# at.add_exception 'vendor'
|
11
|
-
#
|
12
|
-
# at.add_mapping(/dependency.rb/) do |f, _|
|
13
|
-
# at.files_matching(/test_.*rb$/)
|
14
|
-
# end
|
15
|
-
#
|
16
|
-
# %w(TestA TestB).each do |klass|
|
17
|
-
# at.extra_class_map[klass] = "test/test_misc.rb"
|
18
|
-
# end
|
19
|
-
# end
|
20
|
-
|
21
|
-
# Autotest.add_hook :run_command do |at|
|
22
|
-
# system "rake build"
|
23
|
-
# end
|
data/.gemtest
DELETED
File without changes
|
data/Manifest.txt
DELETED
data/README.rdoc
DELETED
@@ -1,115 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
= Access USB devices from Ruby via libusb-1.0.
|
4
|
-
|
5
|
-
* http://github.com/larskanis/libusb
|
6
|
-
|
7
|
-
== DESCRIPTION:
|
8
|
-
|
9
|
-
LIBUSB is a Ruby binding that gives Ruby programmers access to arbitrary USB devices.
|
10
|
-
|
11
|
-
* libusb[http://libusbx.org] is a library that gives full access to devices connected via the USB bus. No special kernel driver is thus necessary for accessing USB devices.
|
12
|
-
* This Ruby binding supports the API version 1.0 of libusb[http://libusbx.org]. Note that the old "legacy" version 0.1.x of libusb uses a completely different API that is covered by the ruby extension ruby-usb[http://www.a-k-r.org/ruby-usb/] .
|
13
|
-
|
14
|
-
|
15
|
-
LIBUSB for Ruby is covered by the GNU Lesser General Public License version 3.
|
16
|
-
|
17
|
-
== FEATURES:
|
18
|
-
* Access to descriptors of devices, configurations, interfaces, settings and endpoints
|
19
|
-
* Synchronous and asynchronous communication for bulk, control, interrupt and isochronous transfers
|
20
|
-
* Compatibility layer for ruby-usb[http://www.a-k-r.org/ruby-usb/] (API based on libusb-0.1). See {::USB} for description.
|
21
|
-
|
22
|
-
== SYNOPSIS:
|
23
|
-
|
24
|
-
require "libusb"
|
25
|
-
|
26
|
-
usb = LIBUSB::Context.new
|
27
|
-
device = usb.devices(:idVendor => 0x04b4, :idProduct => 0x8613).first
|
28
|
-
device.open_interface(0) do |handle|
|
29
|
-
handle.control_transfer(:bmRequestType => 0x40, :bRequest => 0xa0, :wValue => 0xe600, :wIndex => 0x0000, :dataOut => 1.chr)
|
30
|
-
end
|
31
|
-
{LIBUSB::Context#devices} is used to get all or only particular devices.
|
32
|
-
After {LIBUSB::Device#open_interface opening and claiming} the {LIBUSB::Device} the resulting {LIBUSB::DevHandle} can be
|
33
|
-
used to communicate with the connected USB device
|
34
|
-
by {LIBUSB::DevHandle#control_transfer}, {LIBUSB::DevHandle#bulk_transfer},
|
35
|
-
{LIBUSB::DevHandle#interrupt_transfer} or by using the {LIBUSB::Transfer} classes.
|
36
|
-
|
37
|
-
A {LIBUSB::Device} can also be used to retrieve information about it,
|
38
|
-
by using the device descriptor attributes.
|
39
|
-
A {LIBUSB::Device} could have several configurations. You can then decide of which
|
40
|
-
configuration to enable. You can only enable one configuration at a time.
|
41
|
-
|
42
|
-
Each {LIBUSB::Configuration} has one or more interfaces. These can be seen as functional group
|
43
|
-
performing a single feature of the device.
|
44
|
-
|
45
|
-
Each {LIBUSB::Interface} has at least one {LIBUSB::Setting}. The first setting is always default.
|
46
|
-
An alternate setting can be used independent on each interface.
|
47
|
-
|
48
|
-
Each {LIBUSB::Setting} specifies it's own set of communication endpoints.
|
49
|
-
Each {LIBUSB::Endpoint} specifies the type of transfer, direction, polling interval and
|
50
|
-
maximum packet size.
|
51
|
-
|
52
|
-
|
53
|
-
== REQUIREMENTS:
|
54
|
-
|
55
|
-
* Linux, MacOSX or Windows system with Ruby MRI 1.8.7/1.9.x or JRuby
|
56
|
-
|
57
|
-
== INSTALL:
|
58
|
-
|
59
|
-
gem install libusb
|
60
|
-
|
61
|
-
In order to use LIBUSB, you also need the libusb-1.0[http://libusbx.org] library (but not necessarily its header files).
|
62
|
-
* Debian or Ubuntu:
|
63
|
-
sudo apt-get install libusb-1.0-0-dev
|
64
|
-
* OS-X: install with homebrew:
|
65
|
-
brew install libusb
|
66
|
-
or macports:
|
67
|
-
port install libusb
|
68
|
-
* Windows: libusb.gem comes with a precompiled +libusb.dll+, but you need to install a device driver (see below)
|
69
|
-
|
70
|
-
Latest code can be used in this way:
|
71
|
-
|
72
|
-
git clone git://github.com/larskanis/libusb.git
|
73
|
-
rake install_gem
|
74
|
-
|
75
|
-
|
76
|
-
== Usage on Windows
|
77
|
-
|
78
|
-
In contrast to Linux, any access to an USB device by LIBUSB on Windows requires a proper driver
|
79
|
-
installed in the system. Fortunately creating such a driver is quite easy with
|
80
|
-
Zadig[http://sourceforge.net/projects/libwdi/files/zadig/]. Select the interesting USB device,
|
81
|
-
choose WinUSB driver and press "Install Driver". That's it. You may take the generated output directory
|
82
|
-
with it's INI-file and use it for driver installation on other 32 or 64 bit Windows
|
83
|
-
systems.
|
84
|
-
|
85
|
-
|
86
|
-
== Cross compiling for Windows
|
87
|
-
|
88
|
-
Libusb-gem can be build on a linux or darwin host for the win32 platform,
|
89
|
-
using the mingw cross compiler collection. Libusb is downloaded from source
|
90
|
-
git repo, cross compiled and included in the generated libusb.gem.
|
91
|
-
|
92
|
-
Install mingw32. On a debian based system this should work:
|
93
|
-
|
94
|
-
apt-get install mingw32
|
95
|
-
|
96
|
-
On MacOS X, if you have MacPorts installed:
|
97
|
-
|
98
|
-
port install i386-mingw32-gcc
|
99
|
-
|
100
|
-
Download and cross compile libusb for win32:
|
101
|
-
|
102
|
-
rake cross gem
|
103
|
-
|
104
|
-
If everything works, there should be libusb-VERSION-x86-mingw32.gem in the pkg
|
105
|
-
directory.
|
106
|
-
|
107
|
-
== Resources
|
108
|
-
|
109
|
-
* API documentation of Libusb for Ruby: http://rubydoc.info/gems/libusb/frames
|
110
|
-
* Mailinglist: http://rubyforge.org/mailman/listinfo/libusb-hackers
|
111
|
-
* Overall introduction to USB: http://www.usbmadesimple.co.uk
|
112
|
-
|
113
|
-
== Todo
|
114
|
-
|
115
|
-
* add proper handling for polling and timing: http://libusb.sourceforge.net/api-1.0/group__poll.html
|