Class: USB::Interface

Inherits:
Data
  • Object
show all
Defined in:
lib/usb.rb,
ext/usb/usb.c

Instance Method Summary collapse

Instance Method Details

#busObject



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

def bus() self.configuration.device.bus end

#configurationObject

USB::Interface#configuration



328
# File 'ext/usb/usb.c', line 328

static VALUE rusb_interface_configuration(VALUE v) { return get_rusb_interface(v)->parent; }

#deviceObject



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

def device() self.configuration.device end

#endpointsObject



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

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

#inspectObject



320
321
322
323
324
325
326
# File 'lib/usb.rb', line 320

def inspect
  if self.revoked?
    "\#<#{self.class} revoked>"
  else
    "\#<#{self.class}>"
  end
end

#num_altsettingObject

USB::Interface#num_altsetting



331
# File 'ext/usb/usb.c', line 331

static VALUE rusb_interface_num_altsetting(VALUE v) { return INT2FIX(get_usb_interface(v)->num_altsetting); }

#revoked?Boolean

USB::Interface#revoked?

Returns:

  • (Boolean)


321
322
323
324
325
# File 'ext/usb/usb.c', line 321

static VALUE
rusb_interface_revoked_p(VALUE v)
{
  return RTEST(!check_usb_interface(v));
}

#settingsObject

USB::Interface#settings



334
335
336
337
338
339
340
341
342
343
# File 'ext/usb/usb.c', line 334

static VALUE
rusb_interface_settings(VALUE v)
{
  struct usb_interface *p = get_usb_interface(v);
  int i;
  VALUE altsetting = rb_ary_new2(p->num_altsetting);
  for (i = 0; i < p->num_altsetting; i++)
    rb_ary_store(altsetting, i, rusb_interface_descriptor_make(&p->altsetting[i], v));
  return altsetting;
}