Class: USB::Device

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Comparable
Defined in:
lib/libusb/compat.rb

Instance Method Summary collapse

Constructor Details

#initialize(dev) ⇒ Device

Returns a new instance of Device.



166
167
168
# File 'lib/libusb/compat.rb', line 166

def initialize(dev)
  @dev = dev
end

Instance Method Details

#<=>(o) ⇒ Object



176
177
178
# File 'lib/libusb/compat.rb', line 176

def <=>(o)
  @dev<=>o.instance_variable_get(:@dev)
end

#busObject



193
# File 'lib/libusb/compat.rb', line 193

def bus; default_bus; end

#configurationsObject



194
# File 'lib/libusb/compat.rb', line 194

def configurations; @dev.configurations.map{|c| Configuration.new(c) }; end

#endpointsObject



197
# File 'lib/libusb/compat.rb', line 197

def endpoints; @dev.endpoints.map{|c| Endpoint.new(c) }; end

#interfacesObject



195
# File 'lib/libusb/compat.rb', line 195

def interfaces; @dev.interfaces.map{|c| Interface.new(c) }; end

#openObject



180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/libusb/compat.rb', line 180

def open
  h = DevHandle.new(@dev.open)
  if block_given?
    begin
      yield h
    ensure
      h.usb_close
    end
  else
    h
  end
end

#settingsObject



196
# File 'lib/libusb/compat.rb', line 196

def settings; @dev.settings.map{|c| Setting.new(c) }; end