Module: LIBUSB
- Defined in:
- lib/libusb.rb,
lib/libusb/bos.rb,
lib/libusb/call.rb,
lib/libusb/stdio.rb,
lib/libusb/device.rb,
lib/libusb/context.rb,
lib/libusb/setting.rb,
lib/libusb/endpoint.rb,
lib/libusb/transfer.rb,
lib/libusb/constants.rb,
lib/libusb/interface.rb,
lib/libusb/dev_handle.rb,
lib/libusb/version_gem.rb,
lib/libusb/dependencies.rb,
lib/libusb/eventmachine.rb,
lib/libusb/ss_companion.rb,
lib/libusb/configuration.rb,
lib/libusb/version_struct.rb
Overview
This file is part of Libusb for Ruby.
Libusb for Ruby is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Libusb for Ruby is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with Libusb for Ruby. If not, see <www.gnu.org/licenses/>.
Defined Under Namespace
Modules: Call, Stdio Classes: Bos, BulkStreamTransfer, BulkTransfer, Configuration, Context, ControlTransfer, DevHandle, Device, Endpoint, Error, Interface, InterruptTransfer, IsoPacket, IsochronousTransfer, Setting, SsCompanion, Transfer, Version
Constant Summary collapse
- CONTROL_SETUP_SIZE =
8- DT_DEVICE_SIZE =
18- DT_CONFIG_SIZE =
9- DT_INTERFACE_SIZE =
9- DT_ENDPOINT_SIZE =
7- DT_ENDPOINT_AUDIO_SIZE =
Audio extension
9- DT_HUB_NONVAR_SIZE =
7- ENDPOINT_ADDRESS_MASK =
in bEndpointAddress
0x0f- ENDPOINT_DIR_MASK =
0x80- TRANSFER_TYPE_MASK =
in bmAttributes
0x03- ISO_SYNC_TYPE_MASK =
0x0C
- ISO_USAGE_TYPE_MASK =
0x30- POLLIN =
1- POLLOUT =
4- HOTPLUG_MATCH_ANY =
Wildcard matching for hotplug events.
-1- VERSION =
Library version of libusb for Ruby
"0.6.0"- LIBUSB_VERSION =
ENV['LIBUSB_VERSION'] || '1.0.21'
- LIBUSB_SOURCE_URI =
"https://github.com/libusb/libusb/releases/download/v#{LIBUSB_VERSION}/libusb-#{LIBUSB_VERSION}.tar.bz2"- LIBUSB_SOURCE_SHA1 =
'54d71841542eb1a6f0b0420878a4d5434efe8d28'- MINI_PORTILE_VERSION =
'~> 2.1'
Class Method Summary collapse
- .dev_string(base_class, sub_class, protocol) ⇒ Object
-
.has_capability?(capability) ⇒ Boolean
Check at runtime if the loaded library has a given capability.
- .raise_error(res, text) ⇒ Object
-
.version ⇒ Version
Get version of the underlying libusb library.
Class Method Details
.dev_string(base_class, sub_class, protocol) ⇒ Object
149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/libusb/constants.rb', line 149 def self.dev_string(base_class, sub_class, protocol) if desc = CLASS_CODES_HASH3[[base_class, sub_class, protocol]] desc elsif desc = CLASS_CODES_HASH2[[base_class, sub_class]] desc + " (%02x)" % [protocol] elsif desc = CLASS_CODES_HASH1[base_class] desc + " (%02x,%02x)" % [sub_class, protocol] else "Unknown(%02x,%02x,%02x)" % [base_class, sub_class, protocol] end end |
.has_capability?(capability) ⇒ Boolean
Check at runtime if the loaded library has a given capability. Available since libusb-1.0.9.
49 50 51 52 |
# File 'lib/libusb.rb', line 49 def self.has_capability?(capability) r = Call.libusb_has_capability(capability) return r != 0 end |
.raise_error(res, text) ⇒ Object
60 61 62 63 |
# File 'lib/libusb/constants.rb', line 60 def self.raise_error(res, text) klass = ErrorClassForResult[res] raise klass, "#{klass} #{text}" end |
.version ⇒ Version
Get version of the underlying libusb library. Available since libusb-1.0.10.
39 40 41 |
# File 'lib/libusb.rb', line 39 def self.version Version.new(Call.libusb_get_version) end |