Class: USB::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/usb.rb

Instance Method Summary collapse

Instance Method Details

#busObject



311
# File 'lib/usb.rb', line 311

def bus() self.device.bus end

#descriptionObject



306
307
308
309
# File 'lib/usb.rb', line 306

def description
  return @description if defined? @description
  @description = self.device.open {|h| h.get_string_simple(self.iConfiguration) }
end

#endpointsObject



314
# File 'lib/usb.rb', line 314

def endpoints() self.settings.map {|d| d.endpoints }.flatten end

#inspectObject



291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/usb.rb', line 291

def inspect
  if self.revoked?
    "\#<#{self.class} revoked>"
  else
    attrs = []
    attrs << self.bConfigurationValue.to_s
    bits = self.bmAttributes
    attrs << "SelfPowered" if (bits & 0b1000000) != 0
    attrs << "RemoteWakeup" if (bits & 0b100000) != 0
    desc = self.description
    attrs << desc if desc != '?'
    "\#<#{self.class} #{attrs.join(' ')}>"
  end
end

#settingsObject



313
# File 'lib/usb.rb', line 313

def settings() self.interfaces.map {|d| d.settings }.flatten end