class USB::Interface

Public Instance Methods

bus() click to toggle source
# File lib/usb.rb, line 326
def bus() self.configuration.device.bus end
configuration() click to toggle source

#configuration

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

/* USB::Interface#num_altsetting */
static VALUE rusb_interface_num_altsetting(VALUE v) { return INT2FIX(get_usb_interface(v)->num_altsetting); }

/* USB::Interface#settings */
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;
}
device() click to toggle source
# File lib/usb.rb, line 327
def device() self.configuration.device end
endpoints() click to toggle source
# File lib/usb.rb, line 329
def endpoints() self.settings.map {|d| d.endpoints }.flatten end
inspect() click to toggle source
# File lib/usb.rb, line 318
def inspect
  if self.revoked?
    "\#<#{self.class} revoked>"
  else
    "\#<#{self.class}>"
  end
end
num_altsetting() click to toggle source

#num_altsetting

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

/* USB::Interface#settings */
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;
}
revoked?() click to toggle source

#revoked?

static VALUE
rusb_interface_revoked_p(VALUE v)
{
  return RTEST(!check_usb_interface(v));
}
settings() click to toggle source

#settings

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;
}