class USB::Setting

Public Instance Methods

bAlternateSetting() click to toggle source

#bAlternateSetting

static VALUE rusb_setting_bAlternateSetting(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bAlternateSetting); }

/* USB::Setting#bNumEndpoints */
static VALUE rusb_setting_bNumEndpoints(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bNumEndpoints); }

/* USB::Setting#bInterfaceClass */
static VALUE rusb_setting_bInterfaceClass(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceClass); }

/* USB::Setting#bInterfaceSubClass */
static VALUE rusb_setting_bInterfaceSubClass(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceSubClass); }

/* USB::Setting#bInterfaceProtocol */
static VALUE rusb_setting_bInterfaceProtocol(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceProtocol); }

/* USB::Setting#iInterface */
static VALUE rusb_setting_iInterface(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->iInterface); }

/* USB::Setting#endpoints */
static VALUE
rusb_setting_endpoints(VALUE v)
{
  struct usb_interface_descriptor *p = get_usb_interface_descriptor(v);
  int i;
  VALUE endpoint = rb_ary_new2(p->bNumEndpoints);
  for (i = 0; i < p->bNumEndpoints; i++)
    rb_ary_store(endpoint, i, rusb_endpoint_descriptor_make(&p->endpoint[i], v));
  return endpoint;
}
bDescriptorType() click to toggle source

#bDescriptorType

static VALUE rusb_setting_bDescriptorType(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bDescriptorType); }

/* USB::Setting#bInterfaceNumber */
static VALUE rusb_setting_bInterfaceNumber(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceNumber); }

/* USB::Setting#bAlternateSetting */
static VALUE rusb_setting_bAlternateSetting(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bAlternateSetting); }

/* USB::Setting#bNumEndpoints */
static VALUE rusb_setting_bNumEndpoints(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bNumEndpoints); }

/* USB::Setting#bInterfaceClass */
static VALUE rusb_setting_bInterfaceClass(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceClass); }

/* USB::Setting#bInterfaceSubClass */
static VALUE rusb_setting_bInterfaceSubClass(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceSubClass); }

/* USB::Setting#bInterfaceProtocol */
static VALUE rusb_setting_bInterfaceProtocol(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceProtocol); }

/* USB::Setting#iInterface */
static VALUE rusb_setting_iInterface(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->iInterface); }

/* USB::Setting#endpoints */
static VALUE
rusb_setting_endpoints(VALUE v)
{
  struct usb_interface_descriptor *p = get_usb_interface_descriptor(v);
  int i;
  VALUE endpoint = rb_ary_new2(p->bNumEndpoints);
  for (i = 0; i < p->bNumEndpoints; i++)
    rb_ary_store(endpoint, i, rusb_endpoint_descriptor_make(&p->endpoint[i], v));
  return endpoint;
}
bInterfaceClass() click to toggle source

#bInterfaceClass

static VALUE rusb_setting_bInterfaceClass(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceClass); }

/* USB::Setting#bInterfaceSubClass */
static VALUE rusb_setting_bInterfaceSubClass(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceSubClass); }

/* USB::Setting#bInterfaceProtocol */
static VALUE rusb_setting_bInterfaceProtocol(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceProtocol); }

/* USB::Setting#iInterface */
static VALUE rusb_setting_iInterface(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->iInterface); }

/* USB::Setting#endpoints */
static VALUE
rusb_setting_endpoints(VALUE v)
{
  struct usb_interface_descriptor *p = get_usb_interface_descriptor(v);
  int i;
  VALUE endpoint = rb_ary_new2(p->bNumEndpoints);
  for (i = 0; i < p->bNumEndpoints; i++)
    rb_ary_store(endpoint, i, rusb_endpoint_descriptor_make(&p->endpoint[i], v));
  return endpoint;
}
bInterfaceNumber() click to toggle source

#bInterfaceNumber

static VALUE rusb_setting_bInterfaceNumber(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceNumber); }

/* USB::Setting#bAlternateSetting */
static VALUE rusb_setting_bAlternateSetting(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bAlternateSetting); }

/* USB::Setting#bNumEndpoints */
static VALUE rusb_setting_bNumEndpoints(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bNumEndpoints); }

/* USB::Setting#bInterfaceClass */
static VALUE rusb_setting_bInterfaceClass(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceClass); }

/* USB::Setting#bInterfaceSubClass */
static VALUE rusb_setting_bInterfaceSubClass(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceSubClass); }

/* USB::Setting#bInterfaceProtocol */
static VALUE rusb_setting_bInterfaceProtocol(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceProtocol); }

/* USB::Setting#iInterface */
static VALUE rusb_setting_iInterface(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->iInterface); }

/* USB::Setting#endpoints */
static VALUE
rusb_setting_endpoints(VALUE v)
{
  struct usb_interface_descriptor *p = get_usb_interface_descriptor(v);
  int i;
  VALUE endpoint = rb_ary_new2(p->bNumEndpoints);
  for (i = 0; i < p->bNumEndpoints; i++)
    rb_ary_store(endpoint, i, rusb_endpoint_descriptor_make(&p->endpoint[i], v));
  return endpoint;
}
bInterfaceProtocol() click to toggle source

#bInterfaceProtocol

static VALUE rusb_setting_bInterfaceProtocol(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceProtocol); }

/* USB::Setting#iInterface */
static VALUE rusb_setting_iInterface(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->iInterface); }

/* USB::Setting#endpoints */
static VALUE
rusb_setting_endpoints(VALUE v)
{
  struct usb_interface_descriptor *p = get_usb_interface_descriptor(v);
  int i;
  VALUE endpoint = rb_ary_new2(p->bNumEndpoints);
  for (i = 0; i < p->bNumEndpoints; i++)
    rb_ary_store(endpoint, i, rusb_endpoint_descriptor_make(&p->endpoint[i], v));
  return endpoint;
}
bInterfaceSubClass() click to toggle source

#bInterfaceSubClass

static VALUE rusb_setting_bInterfaceSubClass(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceSubClass); }

/* USB::Setting#bInterfaceProtocol */
static VALUE rusb_setting_bInterfaceProtocol(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceProtocol); }

/* USB::Setting#iInterface */
static VALUE rusb_setting_iInterface(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->iInterface); }

/* USB::Setting#endpoints */
static VALUE
rusb_setting_endpoints(VALUE v)
{
  struct usb_interface_descriptor *p = get_usb_interface_descriptor(v);
  int i;
  VALUE endpoint = rb_ary_new2(p->bNumEndpoints);
  for (i = 0; i < p->bNumEndpoints; i++)
    rb_ary_store(endpoint, i, rusb_endpoint_descriptor_make(&p->endpoint[i], v));
  return endpoint;
}
bLength() click to toggle source

#bLength

static VALUE rusb_setting_bLength(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bLength); }

/* USB::Setting#bDescriptorType */
static VALUE rusb_setting_bDescriptorType(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bDescriptorType); }

/* USB::Setting#bInterfaceNumber */
static VALUE rusb_setting_bInterfaceNumber(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceNumber); }

/* USB::Setting#bAlternateSetting */
static VALUE rusb_setting_bAlternateSetting(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bAlternateSetting); }

/* USB::Setting#bNumEndpoints */
static VALUE rusb_setting_bNumEndpoints(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bNumEndpoints); }

/* USB::Setting#bInterfaceClass */
static VALUE rusb_setting_bInterfaceClass(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceClass); }

/* USB::Setting#bInterfaceSubClass */
static VALUE rusb_setting_bInterfaceSubClass(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceSubClass); }

/* USB::Setting#bInterfaceProtocol */
static VALUE rusb_setting_bInterfaceProtocol(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceProtocol); }

/* USB::Setting#iInterface */
static VALUE rusb_setting_iInterface(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->iInterface); }

/* USB::Setting#endpoints */
static VALUE
rusb_setting_endpoints(VALUE v)
{
  struct usb_interface_descriptor *p = get_usb_interface_descriptor(v);
  int i;
  VALUE endpoint = rb_ary_new2(p->bNumEndpoints);
  for (i = 0; i < p->bNumEndpoints; i++)
    rb_ary_store(endpoint, i, rusb_endpoint_descriptor_make(&p->endpoint[i], v));
  return endpoint;
}
bNumEndpoints() click to toggle source

#bNumEndpoints

static VALUE rusb_setting_bNumEndpoints(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bNumEndpoints); }

/* USB::Setting#bInterfaceClass */
static VALUE rusb_setting_bInterfaceClass(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceClass); }

/* USB::Setting#bInterfaceSubClass */
static VALUE rusb_setting_bInterfaceSubClass(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceSubClass); }

/* USB::Setting#bInterfaceProtocol */
static VALUE rusb_setting_bInterfaceProtocol(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceProtocol); }

/* USB::Setting#iInterface */
static VALUE rusb_setting_iInterface(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->iInterface); }

/* USB::Setting#endpoints */
static VALUE
rusb_setting_endpoints(VALUE v)
{
  struct usb_interface_descriptor *p = get_usb_interface_descriptor(v);
  int i;
  VALUE endpoint = rb_ary_new2(p->bNumEndpoints);
  for (i = 0; i < p->bNumEndpoints; i++)
    rb_ary_store(endpoint, i, rusb_endpoint_descriptor_make(&p->endpoint[i], v));
  return endpoint;
}
bus() click to toggle source
# File lib/usb.rb, line 352
def bus() self.interface.configuration.device.bus end
configuration() click to toggle source
# File lib/usb.rb, line 354
def configuration() self.interface.configuration end
description() click to toggle source
# File lib/usb.rb, line 347
def description
  return @description if defined? @description
  @description = self.device.open {|h| h.get_string_simple(self.iInterface) }
end
device() click to toggle source
# File lib/usb.rb, line 353
def device() self.interface.configuration.device end
endpoints() click to toggle source

#endpoints

static VALUE
rusb_setting_endpoints(VALUE v)
{
  struct usb_interface_descriptor *p = get_usb_interface_descriptor(v);
  int i;
  VALUE endpoint = rb_ary_new2(p->bNumEndpoints);
  for (i = 0; i < p->bNumEndpoints; i++)
    rb_ary_store(endpoint, i, rusb_endpoint_descriptor_make(&p->endpoint[i], v));
  return endpoint;
}
iInterface() click to toggle source

#iInterface

static VALUE rusb_setting_iInterface(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->iInterface); }

/* USB::Setting#endpoints */
static VALUE
rusb_setting_endpoints(VALUE v)
{
  struct usb_interface_descriptor *p = get_usb_interface_descriptor(v);
  int i;
  VALUE endpoint = rb_ary_new2(p->bNumEndpoints);
  for (i = 0; i < p->bNumEndpoints; i++)
    rb_ary_store(endpoint, i, rusb_endpoint_descriptor_make(&p->endpoint[i], v));
  return endpoint;
}
inspect() click to toggle source
# File lib/usb.rb, line 333
def inspect
  if self.revoked?
    "\#<#{self.class} revoked>"
  else
    attrs = []
    attrs << self.bAlternateSetting.to_s
    devclass = USB.dev_string(self.bInterfaceClass, self.bInterfaceSubClass, self.bInterfaceProtocol)
    attrs << devclass
    desc = self.description
    attrs << desc if desc != '?'
    "\#<#{self.class} #{attrs.join(' ')}>"
  end
end
interface() click to toggle source

USB::Interface#interface

static VALUE rusb_setting_interface(VALUE v) { return get_rusb_interface_descriptor(v)->parent; }

/* USB::Setting#bLength */
static VALUE rusb_setting_bLength(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bLength); }

/* USB::Setting#bDescriptorType */
static VALUE rusb_setting_bDescriptorType(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bDescriptorType); }

/* USB::Setting#bInterfaceNumber */
static VALUE rusb_setting_bInterfaceNumber(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceNumber); }

/* USB::Setting#bAlternateSetting */
static VALUE rusb_setting_bAlternateSetting(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bAlternateSetting); }

/* USB::Setting#bNumEndpoints */
static VALUE rusb_setting_bNumEndpoints(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bNumEndpoints); }

/* USB::Setting#bInterfaceClass */
static VALUE rusb_setting_bInterfaceClass(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceClass); }

/* USB::Setting#bInterfaceSubClass */
static VALUE rusb_setting_bInterfaceSubClass(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceSubClass); }

/* USB::Setting#bInterfaceProtocol */
static VALUE rusb_setting_bInterfaceProtocol(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->bInterfaceProtocol); }

/* USB::Setting#iInterface */
static VALUE rusb_setting_iInterface(VALUE v) { return INT2FIX(get_usb_interface_descriptor(v)->iInterface); }

/* USB::Setting#endpoints */
static VALUE
rusb_setting_endpoints(VALUE v)
{
  struct usb_interface_descriptor *p = get_usb_interface_descriptor(v);
  int i;
  VALUE endpoint = rb_ary_new2(p->bNumEndpoints);
  for (i = 0; i < p->bNumEndpoints; i++)
    rb_ary_store(endpoint, i, rusb_endpoint_descriptor_make(&p->endpoint[i], v));
  return endpoint;
}
revoked?() click to toggle source

#revoked?

static VALUE
rusb_setting_revoked_p(VALUE v)
{
  return RTEST(!check_usb_interface_descriptor(v));
}