class USB::Configuration

Public Instance Methods

bConfigurationValue() click to toggle source

#bConfigurationValue

static VALUE rusb_config_bConfigurationValue(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bConfigurationValue); }

/* USB::Configuration#iConfiguration */
static VALUE rusb_config_iConfiguration(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->iConfiguration); }

/* USB::Configuration#bmAttributes */
static VALUE rusb_config_bmAttributes(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bmAttributes); }

/* USB::Configuration#bMaxPower */
static VALUE rusb_config_bMaxPower(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->MaxPower); }

/* USB::Configuration#interfaces */
static VALUE
rusb_config_interfaces(VALUE v)
{
  struct usb_config_descriptor *p = get_usb_config_descriptor(v);
  int i;
  VALUE interface = rb_ary_new2(p->bNumInterfaces);
  for (i = 0; i < p->bNumInterfaces; i++)
    rb_ary_store(interface, i, rusb_interface_make(&p->interface[i], v));
  return interface;
}
bDescriptorType() click to toggle source

#bDescriptorType

static VALUE rusb_config_bDescriptorType(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bDescriptorType); }

/* USB::Configuration#wTotalLength */
static VALUE rusb_config_wTotalLength(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->wTotalLength); }

/* USB::Configuration#bNumInterfaces */
static VALUE rusb_config_bNumInterfaces(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bNumInterfaces); }

/* USB::Configuration#bConfigurationValue */
static VALUE rusb_config_bConfigurationValue(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bConfigurationValue); }

/* USB::Configuration#iConfiguration */
static VALUE rusb_config_iConfiguration(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->iConfiguration); }

/* USB::Configuration#bmAttributes */
static VALUE rusb_config_bmAttributes(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bmAttributes); }

/* USB::Configuration#bMaxPower */
static VALUE rusb_config_bMaxPower(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->MaxPower); }

/* USB::Configuration#interfaces */
static VALUE
rusb_config_interfaces(VALUE v)
{
  struct usb_config_descriptor *p = get_usb_config_descriptor(v);
  int i;
  VALUE interface = rb_ary_new2(p->bNumInterfaces);
  for (i = 0; i < p->bNumInterfaces; i++)
    rb_ary_store(interface, i, rusb_interface_make(&p->interface[i], v));
  return interface;
}
bLength() click to toggle source

#bLength

static VALUE rusb_config_bLength(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bLength); }

/* USB::Configuration#bDescriptorType */
static VALUE rusb_config_bDescriptorType(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bDescriptorType); }

/* USB::Configuration#wTotalLength */
static VALUE rusb_config_wTotalLength(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->wTotalLength); }

/* USB::Configuration#bNumInterfaces */
static VALUE rusb_config_bNumInterfaces(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bNumInterfaces); }

/* USB::Configuration#bConfigurationValue */
static VALUE rusb_config_bConfigurationValue(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bConfigurationValue); }

/* USB::Configuration#iConfiguration */
static VALUE rusb_config_iConfiguration(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->iConfiguration); }

/* USB::Configuration#bmAttributes */
static VALUE rusb_config_bmAttributes(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bmAttributes); }

/* USB::Configuration#bMaxPower */
static VALUE rusb_config_bMaxPower(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->MaxPower); }

/* USB::Configuration#interfaces */
static VALUE
rusb_config_interfaces(VALUE v)
{
  struct usb_config_descriptor *p = get_usb_config_descriptor(v);
  int i;
  VALUE interface = rb_ary_new2(p->bNumInterfaces);
  for (i = 0; i < p->bNumInterfaces; i++)
    rb_ary_store(interface, i, rusb_interface_make(&p->interface[i], v));
  return interface;
}
bMaxPower() click to toggle source

#bMaxPower

static VALUE rusb_config_bMaxPower(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->MaxPower); }

/* USB::Configuration#interfaces */
static VALUE
rusb_config_interfaces(VALUE v)
{
  struct usb_config_descriptor *p = get_usb_config_descriptor(v);
  int i;
  VALUE interface = rb_ary_new2(p->bNumInterfaces);
  for (i = 0; i < p->bNumInterfaces; i++)
    rb_ary_store(interface, i, rusb_interface_make(&p->interface[i], v));
  return interface;
}
bNumInterfaces() click to toggle source

#bNumInterfaces

static VALUE rusb_config_bNumInterfaces(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bNumInterfaces); }

/* USB::Configuration#bConfigurationValue */
static VALUE rusb_config_bConfigurationValue(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bConfigurationValue); }

/* USB::Configuration#iConfiguration */
static VALUE rusb_config_iConfiguration(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->iConfiguration); }

/* USB::Configuration#bmAttributes */
static VALUE rusb_config_bmAttributes(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bmAttributes); }

/* USB::Configuration#bMaxPower */
static VALUE rusb_config_bMaxPower(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->MaxPower); }

/* USB::Configuration#interfaces */
static VALUE
rusb_config_interfaces(VALUE v)
{
  struct usb_config_descriptor *p = get_usb_config_descriptor(v);
  int i;
  VALUE interface = rb_ary_new2(p->bNumInterfaces);
  for (i = 0; i < p->bNumInterfaces; i++)
    rb_ary_store(interface, i, rusb_interface_make(&p->interface[i], v));
  return interface;
}
bmAttributes() click to toggle source

#bmAttributes

static VALUE rusb_config_bmAttributes(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bmAttributes); }

/* USB::Configuration#bMaxPower */
static VALUE rusb_config_bMaxPower(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->MaxPower); }

/* USB::Configuration#interfaces */
static VALUE
rusb_config_interfaces(VALUE v)
{
  struct usb_config_descriptor *p = get_usb_config_descriptor(v);
  int i;
  VALUE interface = rb_ary_new2(p->bNumInterfaces);
  for (i = 0; i < p->bNumInterfaces; i++)
    rb_ary_store(interface, i, rusb_interface_make(&p->interface[i], v));
  return interface;
}
bus() click to toggle source
# File lib/usb.rb, line 311
def bus() self.device.bus end
description() click to toggle source
# 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
device() click to toggle source

#device

static VALUE rusb_config_device(VALUE v) { return get_rusb_config_descriptor(v)->parent; }

/* USB::Configuration#bLength */
static VALUE rusb_config_bLength(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bLength); }

/* USB::Configuration#bDescriptorType */
static VALUE rusb_config_bDescriptorType(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bDescriptorType); }

/* USB::Configuration#wTotalLength */
static VALUE rusb_config_wTotalLength(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->wTotalLength); }

/* USB::Configuration#bNumInterfaces */
static VALUE rusb_config_bNumInterfaces(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bNumInterfaces); }

/* USB::Configuration#bConfigurationValue */
static VALUE rusb_config_bConfigurationValue(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bConfigurationValue); }

/* USB::Configuration#iConfiguration */
static VALUE rusb_config_iConfiguration(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->iConfiguration); }

/* USB::Configuration#bmAttributes */
static VALUE rusb_config_bmAttributes(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bmAttributes); }

/* USB::Configuration#bMaxPower */
static VALUE rusb_config_bMaxPower(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->MaxPower); }

/* USB::Configuration#interfaces */
static VALUE
rusb_config_interfaces(VALUE v)
{
  struct usb_config_descriptor *p = get_usb_config_descriptor(v);
  int i;
  VALUE interface = rb_ary_new2(p->bNumInterfaces);
  for (i = 0; i < p->bNumInterfaces; i++)
    rb_ary_store(interface, i, rusb_interface_make(&p->interface[i], v));
  return interface;
}
endpoints() click to toggle source
# File lib/usb.rb, line 314
def endpoints() self.settings.map {|d| d.endpoints }.flatten end
iConfiguration() click to toggle source

#iConfiguration

static VALUE rusb_config_iConfiguration(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->iConfiguration); }

/* USB::Configuration#bmAttributes */
static VALUE rusb_config_bmAttributes(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bmAttributes); }

/* USB::Configuration#bMaxPower */
static VALUE rusb_config_bMaxPower(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->MaxPower); }

/* USB::Configuration#interfaces */
static VALUE
rusb_config_interfaces(VALUE v)
{
  struct usb_config_descriptor *p = get_usb_config_descriptor(v);
  int i;
  VALUE interface = rb_ary_new2(p->bNumInterfaces);
  for (i = 0; i < p->bNumInterfaces; i++)
    rb_ary_store(interface, i, rusb_interface_make(&p->interface[i], v));
  return interface;
}
inspect() click to toggle source
# 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
interfaces() click to toggle source

#interfaces

static VALUE
rusb_config_interfaces(VALUE v)
{
  struct usb_config_descriptor *p = get_usb_config_descriptor(v);
  int i;
  VALUE interface = rb_ary_new2(p->bNumInterfaces);
  for (i = 0; i < p->bNumInterfaces; i++)
    rb_ary_store(interface, i, rusb_interface_make(&p->interface[i], v));
  return interface;
}
revoked?() click to toggle source

#revoked?

static VALUE
rusb_config_revoked_p(VALUE v)
{
  return RTEST(!check_usb_config_descriptor(v));
}
settings() click to toggle source
# File lib/usb.rb, line 313
def settings() self.interfaces.map {|d| d.settings }.flatten end
wTotalLength() click to toggle source

#wTotalLength

static VALUE rusb_config_wTotalLength(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->wTotalLength); }

/* USB::Configuration#bNumInterfaces */
static VALUE rusb_config_bNumInterfaces(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bNumInterfaces); }

/* USB::Configuration#bConfigurationValue */
static VALUE rusb_config_bConfigurationValue(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bConfigurationValue); }

/* USB::Configuration#iConfiguration */
static VALUE rusb_config_iConfiguration(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->iConfiguration); }

/* USB::Configuration#bmAttributes */
static VALUE rusb_config_bmAttributes(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->bmAttributes); }

/* USB::Configuration#bMaxPower */
static VALUE rusb_config_bMaxPower(VALUE v) { return INT2FIX(get_usb_config_descriptor(v)->MaxPower); }

/* USB::Configuration#interfaces */
static VALUE
rusb_config_interfaces(VALUE v)
{
  struct usb_config_descriptor *p = get_usb_config_descriptor(v);
  int i;
  VALUE interface = rb_ary_new2(p->bNumInterfaces);
  for (i = 0; i < p->bNumInterfaces; i++)
    rb_ary_store(interface, i, rusb_interface_make(&p->interface[i], v));
  return interface;
}