class USB::Bus

Public Instance Methods

configurations() click to toggle source
# File lib/usb.rb, line 139
def configurations() self.devices.map {|d| d.configurations }.flatten end
devices() click to toggle source
# File lib/usb.rb, line 129
def devices
  result = []
  device = self.first_device
  while device
    result << device
    device = device.next
  end
  result.sort_by {|d| d.filename }
end
dirname() click to toggle source

#dirname

static VALUE rusb_bus_dirname(VALUE v) { return rb_str_new2(get_usb_bus(v)->dirname); }

/* USB::Bus#location */
static VALUE rusb_bus_location(VALUE v) { return UINT2NUM(get_usb_bus(v)->location); }

/* USB::Bus#first_device */
static VALUE rusb_bus_first_device(VALUE v) { return rusb_device_make(get_usb_bus(v)->devices, v); }

/* -------- USB::Device -------- */

/* USB::Bus#revoked? */
static VALUE
rusb_device_revoked_p(VALUE v)
{
  return RTEST(!check_usb_device(v));
}
endpoints() click to toggle source
# File lib/usb.rb, line 142
def endpoints() self.settings.map {|d| d.endpoints }.flatten end
find_device(n) click to toggle source
# File lib/usb.rb, line 144
def find_device(n)
  device = self.first_device
  while device
    return device if n == device.filename.to_i
    device = device.next
  end
  return nil
end
first_device() click to toggle source

#first_device

static VALUE rusb_bus_first_device(VALUE v) { return rusb_device_make(get_usb_bus(v)->devices, v); }

/* -------- USB::Device -------- */

/* USB::Bus#revoked? */
static VALUE
rusb_device_revoked_p(VALUE v)
{
  return RTEST(!check_usb_device(v));
}
inspect() click to toggle source
# File lib/usb.rb, line 121
def inspect
  if self.revoked?
    "\#<#{self.class} revoked>"
  else
    "\#<#{self.class} #{self.dirname}>"
  end
end
interfaces() click to toggle source
# File lib/usb.rb, line 140
def interfaces() self.configurations.map {|d| d.interfaces }.flatten end
location() click to toggle source

#location

static VALUE rusb_bus_location(VALUE v) { return UINT2NUM(get_usb_bus(v)->location); }

/* USB::Bus#first_device */
static VALUE rusb_bus_first_device(VALUE v) { return rusb_device_make(get_usb_bus(v)->devices, v); }

/* -------- USB::Device -------- */

/* USB::Bus#revoked? */
static VALUE
rusb_device_revoked_p(VALUE v)
{
  return RTEST(!check_usb_device(v));
}
next() click to toggle source

#next

static VALUE rusb_bus_next(VALUE v) { return rusb_bus_make(get_usb_bus(v)->next, Qnil); }

/* USB::Bus#dirname */
static VALUE rusb_bus_dirname(VALUE v) { return rb_str_new2(get_usb_bus(v)->dirname); }

/* USB::Bus#location */
static VALUE rusb_bus_location(VALUE v) { return UINT2NUM(get_usb_bus(v)->location); }

/* USB::Bus#first_device */
static VALUE rusb_bus_first_device(VALUE v) { return rusb_device_make(get_usb_bus(v)->devices, v); }

/* -------- USB::Device -------- */

/* USB::Bus#revoked? */
static VALUE
rusb_device_revoked_p(VALUE v)
{
  return RTEST(!check_usb_device(v));
}
prev() click to toggle source

#prev

static VALUE rusb_bus_prev(VALUE v) { return rusb_bus_make(get_usb_bus(v)->prev, Qnil); }

/* USB::Bus#next */
static VALUE rusb_bus_next(VALUE v) { return rusb_bus_make(get_usb_bus(v)->next, Qnil); }

/* USB::Bus#dirname */
static VALUE rusb_bus_dirname(VALUE v) { return rb_str_new2(get_usb_bus(v)->dirname); }

/* USB::Bus#location */
static VALUE rusb_bus_location(VALUE v) { return UINT2NUM(get_usb_bus(v)->location); }

/* USB::Bus#first_device */
static VALUE rusb_bus_first_device(VALUE v) { return rusb_device_make(get_usb_bus(v)->devices, v); }

/* -------- USB::Device -------- */

/* USB::Bus#revoked? */
static VALUE
rusb_device_revoked_p(VALUE v)
{
  return RTEST(!check_usb_device(v));
}
revoked?() click to toggle source

#revoked?

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