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
@@ -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
|